Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 01-04-2008, 06:50 PM Dumb SQL question
Truly's Avatar
Ultra Talker

Posts: 322
Trades: 0
Im sure the answer to this one is simple but I cant figure it out. This is what I have resorted to:
PHP Code:
mysql_query("UPDATE userdb SET emailupdate = '1' WHERE userID='$userID'") or die(mysql_error());
mysql_query("UPDATE userdb SET email='email' WHERE userID='$userID'") or die(mysql_error()); 
That works fine, but I want to get that all in one line so I dont have more queries then necessary. I cant get it to work. I have tried all sorts of variations , putting the AND before the WHERE and after and doubling up on different things.

Thanks
Truly is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-04-2008, 07:40 PM Re: Dumb SQL question
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
PHP Code:
mysql_query("UPDATE userdb SET emailupdate = '1',email='email' WHERE userID='$userID'") or die(mysql_error()); 
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 01-05-2008, 05:00 AM Re: Dumb SQL question
Truly's Avatar
Ultra Talker

Posts: 322
Trades: 0
Thanks for the quick response JeremyMiller, Ill have to try the code tommorow when I am more coherent.

Do you (or anyone else) know of a good mySQL tutorial (preferably one that is designed specifically for PHP), I use w3schools and then just searching on PHP but I havent found anything that uses commas in a mySQL query.

Thanks again.
Truly is offline
Reply With Quote
View Public Profile
 
Old 01-05-2008, 05:15 AM Re: Dumb SQL question
lizciz's Avatar
Super Spam Talker

Posts: 807
Name: Mattias Nordahl
Location: Sweden
Trades: 0
I usually recommend www.tizag.com
lizciz is offline
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 01-05-2008, 06:39 AM Re: Dumb SQL question
Extreme Talker

Posts: 238
Location: United States
Trades: 0
Also, I use http://dev.mysql.com/doc/refman/5.0/en/
Search for the type of query you want to run, like select, insert, update, etc., and you will find a page with the syntax.
frost is offline
Reply With Quote
View Public Profile
 
Old 01-05-2008, 07:36 AM Re: Dumb SQL question
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
Quote:
Originally Posted by frost View Post
Also, I use http://dev.mysql.com/doc/refman/5.0/en/
Search for the type of query you want to run, like select, insert, update, etc., and you will find a page with the syntax.
I'm afraid that's how I primarily learn things too: reading the syntax. Now, the ability to do that well comes from years of experience in a variety of languages -- I already know most of the concepts, just need to learn how to express the same concept in a new language. Learning the concepts, however, took a long time and a bit of formal training.

I frequently think that too many people get into programming without first taking the time to study; believing that if they just "do" then they will automatically "do well." One will do much better in the long run to take the necessary time to study a new language -- learn it's syntax; learn programming structures and design paradigms; investigate the community to see what their concerns are and how common problems are frequently overcome; ... and, it can't hurt to actually purchase an academic text used in a university you prefer (it's all listed online in their course listings). Self teaching isn't, for most, easier than formal education as a greater degree of dedication and less easy-to-access, quality assistance is available.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Reply     « Reply to Dumb SQL question
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.29939 seconds with 12 queries