Re: Select record by ID
| From: | nitrox . | Date: | Tue, 30 Jan 2007 22:14:20 +0000 |
| Subject: | Re: Select record by ID | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-248069@lists.php.net to get a copy of this message | ||
Thanks to all who have replied. As you probably have noticed im a total novice to php who is trying to achieve big things.
Richard, ive included your suggested code and now my php script is working properly. But I dont want to be a php copy/paste newb who has no clue of how things are working. If its not too much would you (or anybody) give a brief explanation of what this code is doing? Or are there any tutorials online that I can read that will educate me on this? Thanks again to all for your replies. Ive saved them all for future reference.
atleast this part: $user_id = mysql_real_escape_string((int) $_GET['user_id']);
I understand the rest.
<?php
include "db.php";
$user_id = mysql_real_escape_string((int) $_GET['user_id']);
$query = "SELECT user_id, user_name FROM inf_member WHERE user_id=$user_id";
$result = mysql_query($query);
if ( ! $result ) {
die ("Could not perform query $query: ".mysql_error()."\n");
}
while($myrow = mysql_fetch_assoc($result))
{
echo "<br>";
echo $myrow['user_name'];
echo "<br>";
}
?>
_________________________________________________________________
Invite your Hotmail contacts to join your friends list with Windows Live Spaces http://clk.atdmt.com/MSN/go/msnnkwsp0070000001msn/direct/01/?href=http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us