Redlightpacket Posted February 13, 2009 Share Posted February 13, 2009 I want to be able to update data to one particular table each time a user submits their data to a table in a database. There will be different users logging in so I want the update statement to change to that particular user and update data to that particular table with the user logged in. Is this possible or do you go about this another way? I don't know how to do this. Could you give me an example of something that works. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/145092-confused-about-how-to-use-update-in-mysql/ Share on other sites More sharing options...
corbin Posted February 13, 2009 Share Posted February 13, 2009 Have you read any MySQL tutorials? That's about as basic as it gets with MySQL x.x. UPDATE sometable SET somecolumn = 'some value' WHERE username = 'Some User'; Quote Link to comment https://forums.phpfreaks.com/topic/145092-confused-about-how-to-use-update-in-mysql/#findComment-761410 Share on other sites More sharing options...
Redlightpacket Posted February 13, 2009 Author Share Posted February 13, 2009 UPDATE $sometable SET somecolumn = 'some value' WHERE username = 'Some User'; Can you put a $ in sometable ??????????? Quote Link to comment https://forums.phpfreaks.com/topic/145092-confused-about-how-to-use-update-in-mysql/#findComment-761414 Share on other sites More sharing options...
corbin Posted February 14, 2009 Share Posted February 14, 2009 Of course you can. A query is just a string, and MySQL doesn't know/care where it came from when you pass it to mysql_query. Quote Link to comment https://forums.phpfreaks.com/topic/145092-confused-about-how-to-use-update-in-mysql/#findComment-761783 Share on other sites More sharing options...
Maq Posted February 14, 2009 Share Posted February 14, 2009 Side note - Only double quotes will interpolate, single quotes will not. Quote Link to comment https://forums.phpfreaks.com/topic/145092-confused-about-how-to-use-update-in-mysql/#findComment-761788 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.