Re: Select record by ID

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux