TheFilmGod Posted March 18, 2007 Share Posted March 18, 2007 how do I select a specific row in a mysql table? Quote Link to comment https://forums.phpfreaks.com/topic/43233-solved-php-and-mysql/ Share on other sites More sharing options...
vbnullchar Posted March 18, 2007 Share Posted March 18, 2007 select name from table where id='$name_id'; Quote Link to comment https://forums.phpfreaks.com/topic/43233-solved-php-and-mysql/#findComment-209911 Share on other sites More sharing options...
shaunrigby Posted March 18, 2007 Share Posted March 18, 2007 <?php $query = "SELECT * FROM `table` WHERE `column` = $variable"; $result = mysql_query($query); ?> Quote Link to comment https://forums.phpfreaks.com/topic/43233-solved-php-and-mysql/#findComment-209912 Share on other sites More sharing options...
TheFilmGod Posted March 18, 2007 Author Share Posted March 18, 2007 Awesome! That's exactly what I wanted to do. My next question is, does anybody know how to + 1 to the count to a cell already selected? I'm new to mysql, any help is greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/43233-solved-php-and-mysql/#findComment-209913 Share on other sites More sharing options...
richardw Posted March 18, 2007 Share Posted March 18, 2007 I am assuming you want to write the data back to the table... Make sure you have a field where you can increment the times accessed, in this example it is called "count". Redefine it or use an existing to match your table structure: <?php $query = "SELECT * FROM `table` WHERE `column` = $variable"; $result = mysql_query($query); ?> <?php $cnt = $row["count"]; $cnt++; mysql_query( "UPDATE table SET count = '$cnt' WHERE column= $variable";"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/43233-solved-php-and-mysql/#findComment-209917 Share on other sites More sharing options...
AndyB Posted March 18, 2007 Share Posted March 18, 2007 It'll be useful to read one or more of the tutorials. It'll help you with the terminology as well as how database queries are structured. Quote Link to comment https://forums.phpfreaks.com/topic/43233-solved-php-and-mysql/#findComment-209918 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.