Jump to content

help with getting an individual record


imarockstar

Recommended Posts

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

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/101380-help-with-getting-an-individual-record/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.