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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.