Welcome, Guest
Username: Password: Remember me

TOPIC: extending users table

extending users table 14 Jan 2012 06:32 #972

  • mossss
  • mossss's Avatar
  • Offline
  • Premium Member
  • Posts: 100
  • Thank you received: 7
  • Karma: 9
Hi, I have a table with a few extra details for users. The id for the table is equal to the id of the Users table. I thought it would just be a matter of duplicating the join in the models file for the view. I am trying to get the my_location field from the my_garden table.

This is my query:
$query = ' SELECT a.*'
	.	' , _gardener_.username AS `_gardener_username`'
	.	' , _mygarden_.mylocation AS `_mygarden_mylocation`'					
	.	' , _myplant_key_.foto_a AS `_myplant_key_foto_a`'
	.	' , _myplant_key_.epithet AS `_myplant_key_epithet`'
	.	' , _myplant_key_.english_name AS `_myplant_key_english_name`'
	.	' , _myplant_key_.german_name AS `_myplant_key_german_name`'
	.	' , _myplant_key_.thai_name AS `_myplant_key_thai_name`'
	.	' , _myplant_key_.flower_colour AS `_myplant_key_flower_colour`'

. $this->_buildQuerySelect()

. ' FROM `#__garden_mygardenplants` AS a '
	.	' LEFT JOIN `#__users` AS _gardener_ ON _gardener_.id = a.gardener'
	.	' LEFT JOIN `#__garden_mygarden` AS _mygarden_ ON _gardener_.id = a.mygarden'	
	.	' LEFT JOIN `#__garden_plants` AS _myplant_key_ ON _myplant_key_.id = a.myplant_key'

however I just get an error
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean

I cannot understand as really, in all ways, the users table and the my_garden table are identical.

any ideas?

thanks
Last Edit: 14 Jan 2012 10:53 by admin.
The administrator has disabled public write access.

Re: extending users table 14 Jan 2012 11:02 #984

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
I don't remember very well. But I think there is nothing to do with your query wich seems ok.

It come from the model when the list is empty. (when it get count, for the pagination)
But I don't remember very well.

Does your original query working without warning ?

If you modify the query step by step, can you identify what statement could generate this ?

Mosss, you are good coder and I think you will find. I'm very busy if you want more functionalities.
I'm preparing the server migration now.

Thanks to understand. I really appreciate you participation on the forum, I'm infinitly grateful.
Coding is now a piece of cake
The administrator has disabled public write access.

Re: extending users table 14 Jan 2012 16:56 #996

  • mossss
  • mossss's Avatar
  • Offline
  • Premium Member
  • Posts: 100
  • Thank you received: 7
  • Karma: 9
sure, do appreciate that you are busy.

but still struggling on this. The query works fine without the join to the mygarden table and the related select fields. The full query also works fine in phpmyadmin. I would have expected, even if there were no matching records in the joined table for it still to select the records from the FROM table.

I know this must be something really basic. I'll keep fighting it, I normally win in the end, but if you do have any thoughts of ways to pin down the problem, let me know.

thanks
The administrator has disabled public write access.

Re: extending users table 15 Jan 2012 04:46 #999

  • mossss
  • mossss's Avatar
  • Offline
  • Premium Member
  • Posts: 100
  • Thank you received: 7
  • Karma: 9
ok, got it.
The administrator has disabled public write access.

Re: extending users table 22 Feb 2012 17:54 #1435

  • wennips
  • wennips's Avatar
  • Offline
  • New Member
  • Posts: 2
  • Karma: 0
Please tell me how you did it.
I have tried joined queries before but the didn't work. I've tried a view in the mysql database but this failed also.
The administrator has disabled public write access.
Time to create page: 0.096 seconds

Get Started