Crazydog
11-01-2006, 06:28 PM
First: Here's the script I'm testing it with
<?
$user="user";
$password="pass";
$database="db";
mysql_connect(localhost,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM saved_info";
$result=mysql_query($query);
$person='crazy2';
$num=mysql_numrows($result);
mysql_close();
echo "<b><center>Database Output</center></b><br><br>";
$i=0;
while ($i < $num &&) {
$id=mysql_result($result,$i,"id");
$test=mysql_result($result,$i,"test");
$nickname=mysql_result($result,$i,"nickname");
echo $id . $test . $nickname;
$i++;
}
?>
What this is doing right now is just grabbing+displaying data from a DB.
As you can see, I have assigned the variable $person a value. Eventually, php will pull that value from elsewhere.
The field "nickname" contains usernames of registered members. I would want this script to (after grabbing the username and assigning it to the $person variable) only show records with their username in the nickname field.
<?
$user="user";
$password="pass";
$database="db";
mysql_connect(localhost,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM saved_info";
$result=mysql_query($query);
$person='crazy2';
$num=mysql_numrows($result);
mysql_close();
echo "<b><center>Database Output</center></b><br><br>";
$i=0;
while ($i < $num &&) {
$id=mysql_result($result,$i,"id");
$test=mysql_result($result,$i,"test");
$nickname=mysql_result($result,$i,"nickname");
echo $id . $test . $nickname;
$i++;
}
?>
What this is doing right now is just grabbing+displaying data from a DB.
As you can see, I have assigned the variable $person a value. Eventually, php will pull that value from elsewhere.
The field "nickname" contains usernames of registered members. I would want this script to (after grabbing the username and assigning it to the $person variable) only show records with their username in the nickname field.