correct mysql syntax

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phpForX
Forum Newbie
Posts: 10
Joined: Fri Jun 17, 2005 5:51 am

correct mysql syntax

Post by phpForX »

Hi there,

my issue:

Given this:

Code: Select all

UPDATE wt_licences SET
customer_id ='".$GLOBALS["webuser"]["id"]."', 
domains =$amounttracker WHERE
strLogin='".addslashes($GLOBALS["webuser"]["strLogin"])."'"  ;
An update should be conducted on wt_licences with 2 data sets.

It's about the WHERE clause:

The field 'strLogin' is in another table (tblWebuser)
How can I get this working- with join?

Thanks
Jan
ruchit
Forum Commoner
Posts: 53
Joined: Mon Sep 26, 2005 6:03 am

Post by ruchit »

you can't use a join in an update statement.. however, you can make use of a sub query
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

You'll need to ensure you have the latest version of MySQL if you wish to use a sub/nested query as earlier version do not support them (I forget which versions)
phpForX
Forum Newbie
Posts: 10
Joined: Fri Jun 17, 2005 5:51 am

Post by phpForX »

Thank you very much.

I'll try to find a better solution

Jan
Post Reply