View Full Version : Mysql - grabbing information
avelonx
08-03-2002, 05:46 AM
Could someone please show me code to select "information" as the table and search the column "uid" and look through it until it find a uid that matches $UID and now that it knows where $uid matches with $UID i want it to echo the username in that row under column "username"
firepages
08-04-2002, 04:50 AM
in what language ??
the query would be
"SELECT uid,username FROM information WHERE uid=$UID"
(assuming uid in the DB is an integer else put quotes around it (WHERE uid='$UID')
I assume you mean PHP (cos of the '$' - but could be PERL as well?)
anyway in PHP (and I am assuming there can only be one row returned)
<?
$yaks=mysql_query("SELECT uid,username FROM information WHERE uid=$UID")or die(mysql_error());
$row=mysql_fetch_row($yaks);
?>
<html><body.... etc etc
<table><tr><td>ID</td><td>Username</td></tr>
<tr><td><?echo $row[0];?></td><td><?echo $row[1];?></td></tr>
</table>
blah blah.... etc
vBulletin® v3.8.2, Copyright ©2000-2009, Jelsoft Enterprises Ltd.