Jump to content

SQL PHP help


IAMPrometheus

Recommended Posts

But I need it to go through different tables to find the user.

 

for example.

 

$this->_db->setQuery( "UPDATE #__jrleech SET `published` = '1' WHERE `id` = '". $row->id ."'" );

 

 

wont work, it needs to find it like this:

__roxsuite_membership_history -> __users.username -> __jleech.user = 1

 

The user id's are different in those 2 tables

jos_users and jos_roxsuite_membership_history id's match, but jos_jleech.user's id does not.

Link to comment
https://forums.phpfreaks.com/topic/238602-sql-php-help/
Share on other sites

But I need it to go through different tables to find the user.

 

for example.

 

$this->_db->setQuery( "UPDATE #__jrleech SET `published` = '1' WHERE `id` = '". $row->id ."'" );

 

 

wont work, it needs to find it like this:

__roxsuite_membership_history -> __users.username -> __jleech.user = 1

 

The user id's are different in those 2 tables

jos_users and jos_roxsuite_membership_history id's match, but jos_jleech.user's id does not.

 

You need a join, whether it be using the join keyword, or using the traditional method:

update #__jrleech, jos_users u, jos_roxsuite_membership_history m set `published` = '1' where `id` = '".$row->id."' and u.id = m.id;

 

That definitely won't work, since it's hard to understand your actual question, but that should give you some guidance as to pulling values from multiple tables.

Link to comment
https://forums.phpfreaks.com/topic/238602-sql-php-help/#findComment-1226185
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.