imarockstar Posted April 16, 2008 Share Posted April 16, 2008 Ok I will try to explain this the best I can.... I have 3 records : id html_name html_code Here is the code I am using to pull the records: <? // Connect database. mysql_connect("localhost","***","***"); mysql_select_db("source_myspace"); // Get data records from table. $result=mysql_query("select * from html"); ?> <table> <? while($row=mysql_fetch_assoc($result)){ ?> <tr> <td> <? echo $row['id']; ?> <br> <? echo $row['html_name']; ?> <br> <textarea><? echo $row['html_code']; ?> </textarea> <? $row=mysql_fetch_assoc($result); // make one record out. ?> </td> <td> <? echo $row['id']; ?> <br> <? echo $row['html_name']; ?> <br> <textarea><? echo $row['html_code']; ?> </textarea> <? $row=mysql_fetch_assoc($result); // make one record out. ?> </td> <td> <? echo $row['id']; ?> <br> <? echo $row['html_name']; ?> <br> <textarea><? echo $row['html_code']; ?> </textarea> <? $row=mysql_fetch_assoc($result); // make one record out. ?> </td> </tr> <? } // End loops. ?> </table> This works fine and you can view it here: http://themyspacesource.com/html_code.php What I want to do is take the above link and return ONLY the data for a single id, so instead of displaying all the info I get just the info for one column ... like this : http://themyspacesource.com/html_code.php?id=1 This link will display all the info for the column with ID 1 Im not sure how to do this, Im sure it is very simple, can anyone help me out with this ? thanks b Quote Link to comment https://forums.phpfreaks.com/topic/101380-help-with-getting-an-individual-record/ Share on other sites More sharing options...
fenway Posted April 16, 2008 Share Posted April 16, 2008 Is this ID from the html table? If so, just add a where clause based on the value of this GET parameter (properly escaped, of course). Quote Link to comment https://forums.phpfreaks.com/topic/101380-help-with-getting-an-individual-record/#findComment-518581 Share on other sites More sharing options...
imarockstar Posted April 16, 2008 Author Share Posted April 16, 2008 yes this is the ID from the html table ... I have no clue how to do what was said above .... Quote Link to comment https://forums.phpfreaks.com/topic/101380-help-with-getting-an-individual-record/#findComment-518586 Share on other sites More sharing options...
fenway Posted April 16, 2008 Share Posted April 16, 2008 yes this is the ID from the html table ... I have no clue how to do what was said above .... Something along the lines of: $result=mysql_query("select * from html where id = ' . mysql_real_escape_string( $_GET['item'] ) . '"); But you'd have to consult a proper php tutorial to be sure. Quote Link to comment https://forums.phpfreaks.com/topic/101380-help-with-getting-an-individual-record/#findComment-518594 Share on other sites More sharing options...
imarockstar Posted April 16, 2008 Author Share Posted April 16, 2008 hmm .. i must of did something wrong ... no worky hahah I have searched tutorials but have not found one to do just want I want .... grrr Quote Link to comment https://forums.phpfreaks.com/topic/101380-help-with-getting-an-individual-record/#findComment-518631 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.