Re: [PHP] Select record by ID



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
.



Relevant Pages

  • Re: SMS questions
    ... most of whom have PHP APIs. ... log into their web site to read any replies. ... You have to use SMPP protocol, there are many SMPP SDK's around, like ... the SMS and Pager Toolkit which comes with a PHP sample to send SMS ...
    (php.general)
  • Re: OT: MySQL And Native File Writes Versus Ports and TCP/IP
    ... as it didn't come from a TimeWarner email address. ... Is there a native database environment built into PHP, ... I think this is an Apache question though. ... Post replies to the group. ...
    (comp.lang.php)
  • Any Apache2 Experts?
    ... I posted this a few days ago but received no replies... ... I've searched online but nothing seems to ... I completely removed all the apache/php libraries and ... AddType application/x-httpd-php .php ...
    (alt.os.linux.suse)
  • Re: Which is better OOP, and why?
    ... Thanks to all those who replied (and those who replied to the replies). ... After 20+ years of various flavors of BASIC, starting with a Sinclair 1000 ... I am really enjoying getting to know PHP. ... These posts were worth more than many chapters in any php book. ...
    (comp.lang.php)
  • Re: Rare and whats not
    ... Thanks for the replies here, what on earth have I started!! ... Joe, I think I need to priv-reply to you... ... I'm thinking an SQL database somewhere with a basic PHP ... just the ability for people to blindly ...
    (comp.sys.atari.st)