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.
ctype() validation - allowing illegal characters
Hello,I use ctype() to filter and validate a user form. However, I am trying to allow certain characters.Example:Code: //Validate Copay $allow = array('$', '.'); if (!empty($copay)
Alternate messaging
I have 4 strings in MySQL db1$string1 : Hello$string2 : Hi$string3 : Great$string4 : ThanksAnd I have 3 accounts MySQL db2$User1 : $Pw1$User2 : $Pw2$User3 : $Pw3expected result---------------Hello
same querie, or a new one??
Hi guys,I'm still working on this drop down list. I've got the actual drop down list to work (call all the "pname"s from the table, and I've even found how to print the result once you
Socket problem
Hello,Earlier I posted about my problem with my socket script. It took up to 100% CPU usage.Now I found the problem. With another found simple PHP socket script, I saw it has the same problem.The code
Unifying logins of two different scripts
I have two different game scripts which I want to embed on my own site. The problem is I don't want users to create 3 different accounts - one for main site and 2 other for games. I want them to just
problem with GROUP BY and ORDER BY
i usually use this query to display the last 10 entries from a sql table:Code: $query = "SELECT search_time, search_keywords FROM phpbb_popsearch ORDER BY search_time DESC limit 35"; as you
How to search for several parameters from objects in a database?
I have a database with lots of information about objects.Now I would like to search for 4 or 5 parameters at the same time (from a form) like this:I choose from a select-box one parameter and then
cURL and Sessions
Ohai.So, I'm trying to cURL a bunch of things off of a page, and put them into a session. I've added all of the items so they look like $_SESSION['fur'] = ge_item(6814)Now I just need to figure out
Storing the referrer in session... problems with tabs
Hello AllI am currently working on an ERP project based on the MVC methodology, when a user navigates the site we store the referrer in session.The problem we have is that using multiple tabs upsets
ME54/ME54N Conditional check for Release of PR
Hi Gurus,