I have several DB queries that I know should be returning results and aren't. I have a feeling it has to do with the several while loops that should be outputting the data.
One more issue is that when I echo the num_rows they are all 0 except the first one.
BTW I checked that all variables were being populated and they were.
Here is my code:
Code: $sql1 = "SELECT * FROM player1 where player = '$username'";
$sql2 = "SELECT * FROM player2 where player = '$username'";
$sql3 = "SELECT * FROM player3 where player = '$username'";
$sql4 = "SELECT * FROM player4 where player = '$username'";
$sql5 = "SELECT * FROM player5 where player = '$username'";
$sql6 = "SELECT * FROM player6 where player = '$username'";
$result1 = mysql_query($sql1);
$result2 = mysql_query($sql2);
$result3 = mysql_query($sql3);
$result4 = mysql_query($sql4);
$result5 = mysql_query($sql5);
$result6 = mysql_query($sql6);
$num1 = mysql_num_rows($result1);
$num2 = mysql_num_rows($result2);
$num3 = mysql_num_rows($result3);
$num4 = mysql_num_rows($result4);
$num5 = mysql_num_rows($result5);
$num6 = mysql_num_rows($result6);
Code: while ($b < $num1){
$game=mysql_result($result1,$b,chatId);
$g="SELECT * from chats where name = '$game'";
$gResult= mysql_query($g);
$info=mysql_fetch_assoc($gResult);
echo "
<tr>
<td>" . $info['realName'] . "</td>
<td>" . $info['dm'] . "</td>
</tr>
";
$b++;
}
while ($b < $num2){
$game=mysql_result($result2,$b,chatId);
$g="SELECT * from chats where name = '$game'";
$gResult= mysql_query($g);
$info=mysql_fetch_assoc($gResult);
echo "
<tr>
<td>" . $info['realName'] . "</td>
<td>" . $info['dm'] . "</td>
</tr>
";
$b++;
}
while ($b < $num3){
$game=mysql_result($result3,$b,chatId);
$g="SELECT * from chats where name = '$game'";
$gResult= mysql_query($g);
$info=mysql_fetch_assoc($gResult);
echo "
<tr>
<td>" . $info['realName'] . "</td>
<td>" . $info['dm'] . "</td>
</tr>
";
$b++;
}
while ($b < $num4){
$game=mysql_result($result4,$b,chatId);
$g="SELECT * from chats where name = '$game'";
$gResult= mysql_query($g);
$info=mysql_fetch_assoc($gResult);
echo "
<tr>
<td>" . $info['realName'] . "</td>
<td>" . $info['dm'] . "</td>
</tr>
";
$b++;
}
while ($b < $num5){
$game=mysql_result($result5,$b,chatId);
$g="SELECT * from chats where name = '$game'";
$gResult= mysql_query($g);
$info=mysql_fetch_assoc($gResult);
echo "
<tr>
<td>" . $info['realName'] . "</td>
<td>" . $info['dm'] . "</td>
</tr>
";
$b++;
}
while ($b < $num6){
$game=mysql_result($result6,$b,chatId);
$g="SELECT * from chats where name = '$game'";
$gResult= mysql_query($g);
$info=mysql_fetch_assoc($gResult);
echo "
<tr>
<td>" . $info['realName'] . "</td>
<td>" . $info['dm'] . "</td>
</tr>
";
$b++;
}
I have tried changing the variable $b to something else in each loop but that didnt work either.
Email Processor
I have a few questions so this post will be a larger one! Sorry, but I'm a bit of a PHP newbie so be gentle with me! Awhile back I wrote out a simple forum to email processor that I used with a few
Extract specific information from a PHP Multidimensional Array
Howdy! I've racked my brain over this for 24 hours now. I think it's time I asked for help. I'm learning PHP and believe my I've manipulated many code blocks trying to get this to work with for and
Email "$"
Hello!!Any PHP guy with a bit of a knowledge in Flash ?When I send a JPEG from flash how to get it to email in PHP.
Sequre login with cookies.
I want to build secure login with cookies. I just want your ideas about this, your suggestions. What fields should go to sql table, after username and password? How to keep data in cookies safely? And
PHP doesn't send my mail
Hi all, I found this and used it to send mail. Simple contact form with some required fields. The validation works a bit but I don't get the mail HTML:some Javascript...Code: [Select]<form
values not being entered into table
hi. I;ve created a form, so that when a user enters data into it, it gets added to a table in a database. the form submits some data to one table, and other data to another table. my problem is that
Coefficient of a Restitution Hints
Hello. I was wondering if anyone can give me hints on how to write this program...The coefficient of a restitution of a ball, a number between 0 and 1, specifiies how much energy is conserved when a
echo $rows help
Hi all,Hopefully something simple that I don't know!I have this:Code: [Select]<div id="marquee"><?php$query = mysql_query("SELECT stock_id, stock_code, t_val, y_val
php form help
Hey,I use a control file to set my meta tags and titlesHere's an exampleCode: <?phpswitch ($sheet_name) { case 'page-2'://The page that has $sheet_name equal to the case value, this is the
private constructor
Hello,Can we create a constructor as private? If yes, what is the use of it? If no, why can't we make it?Please suggest...Thanks