Ok I am having a problem with the WHERE clause part. I have the whole thing correct but...with the WHERE part it only pulls out 1 data out of the database when there is 4 more to be taken out. See I have the names in another database and the information in the other. Here is the one I want to work but only 1 data comes out. (userid = '1' is not in the other database I just put it there so the OR will work.
Now this code at the bottom works all information shows up with the bottom but I don't want to use that code, I want to use the top code, since the top one takes the names out of the $race (table really not called $race but called what ever the url says the $race value to be)table and use it to search the names in the other table (the other table has 789 names) and then post the information but the bottom one I have to put the names in the code myself and I don't want to do that, since people add more names everyday and more information in different tables.
Someone please help this has been a struggle for me for a long time someone help, thank you.
PHP Code:
<?php
$conn = mysql_connect("localhost","user","pass");
if (!$conn)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("user_assignment", $conn);
$qt=mysql_query("select * FROM $race");
echo mysql_error();
while($nt=mysql_fetch_array($qt)){
$f = "(userid = '$nt[name]') OR ";
$con = mysql_connect("localhost","user","pass");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("user_assignment", $con);
$qt=mysql_query("select * from sign where $f (userid = '1') LIMIT 6");
echo mysql_error();
while($nt=mysql_fetch_array($qt)){
echo "<a href='/pro.php?user=$nt[user]'><img src=$nt[filena]' width='100' height='87' border='0'/></a> ";
}
}
?>
Someone please help this has been a struggle for me for a long time someone help, thank you.
PHP Code:
<?php
$con = mysql_connect("localhost","user","pass");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("user_assignment", $con);
$qt=mysql_query("select * from sign where (userid = 'may') OR (userid = 'ron') OR (userid = 'john') OR (userid = 'homer') OR (userid = '1') LIMIT 6");
echo mysql_error();
while($nt=mysql_fetch_array($qt)){
echo "<a href='/pro.php?user=$nt[user]'><img src=$nt[filena]' width='100' height='87' border='0'/></a> ";
}
?>
Comment