TheFilmGod Posted September 1, 2007 Share Posted September 1, 2007 How can I update a whole row at a time. I know you can update each value one at a time, but I want to do the whole row, a lot like insert does it! This is what I got so far: $query="UPDATE DOCS SET notes=$notes where title=$title"; mysql_query($query); - I'm a noob. Quote Link to comment https://forums.phpfreaks.com/topic/67533-solved-update-mysql-and-php/ Share on other sites More sharing options...
Jessica Posted September 1, 2007 Share Posted September 1, 2007 First of all, you need to use quotes around strings. Secondly, it's $query="UPDATE DOCS SET notes='$notes', column2='$col2' where title='$title'"; Quote Link to comment https://forums.phpfreaks.com/topic/67533-solved-update-mysql-and-php/#findComment-339120 Share on other sites More sharing options...
TheFilmGod Posted September 1, 2007 Author Share Posted September 1, 2007 Thanks for the fast reply! I had another question. I currently fell into a trap with my script. Mysql table: id | title | des | notes I have the title of the row and I want to find out the id. So title = $title. How would I query the mysql table to find the row where title='$title' and then retrieve the id of that row? Quote Link to comment https://forums.phpfreaks.com/topic/67533-solved-update-mysql-and-php/#findComment-339126 Share on other sites More sharing options...
Jessica Posted September 1, 2007 Share Posted September 1, 2007 Have you heard of SELECT? I think you need to read some basic MYSQL tutorials. Quote Link to comment https://forums.phpfreaks.com/topic/67533-solved-update-mysql-and-php/#findComment-339127 Share on other sites More sharing options...
TheFilmGod Posted September 1, 2007 Author Share Posted September 1, 2007 Have you heard of SELECT? I think you need to read some basic MYSQL tutorials. Yes I have. But its confusing. I just got in mysql and php. And I have this huge book that talks everything about php and when it gets to mysql it totally wings it. The mysql chapter takes like 20 pages. And the whole book is over 700. This is what I think will work: $id_row = mysql_query ( "SELECT * FROM docs WHERE title='$title'"); mysql_fetch_assoc($id_row); If that works I know how to go on from there. All I want to do is select the row where title='$title' Sorry if I'm bothering you with such a newbie question, I'm just stupid... Quote Link to comment https://forums.phpfreaks.com/topic/67533-solved-update-mysql-and-php/#findComment-339133 Share on other sites More sharing options...
Jessica Posted September 1, 2007 Share Posted September 1, 2007 If the book you have doesn't answer your question, try another book, or google, or heck the DOCS. Did you TRY your query? Quote Link to comment https://forums.phpfreaks.com/topic/67533-solved-update-mysql-and-php/#findComment-339137 Share on other sites More sharing options...
TheFilmGod Posted September 1, 2007 Author Share Posted September 1, 2007 Yup, the query should work. I'm going to finish the script and then check it out. Quote Link to comment https://forums.phpfreaks.com/topic/67533-solved-update-mysql-and-php/#findComment-339140 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.