RE: [PHP-DB] Result is not empty
I do, however, want to notice that your tip worked IB :) THanks again, Kevin -Oorspronkelijk bericht- Van: Indioblanco [mailto:[EMAIL PROTECTED]] Verzonden: vrijdag 23 november 2001 6:30 Aan: Paul DuBois CC: Kevin Schaaps; [EMAIL PROTECTED] Onderwerp: Re: [PHP-DB] Result is not empty yes, of course you're right-- gotta stop working so late... the use of the while statement where it wasn't needed threw me off, I guess. Paul DuBois wrote: Take out the while statement-- i.e. simply use: $row = mysql_fetch_array($result); the way you have things constructed now, the while statement evaluates true on the first iteration and $row equals the result row from the query. Because the while returned true, it is evaluated a second time, returns false, and $row = NULL. -ib Why would that matter? He still sets the column variables on the first iteration? Yes, he needs no while loop, but the variables that are set inside the loop should remain set after the loop terminates. Kevin Schaaps wrote: Greetings once again, Today I hope to have a challenge for you. :) I've created a query which returns 1 record. This is confirmed when testing it in MySQL itself. Now PHP sees that there is 1 record in the result, but is completely unwilling to show the information. The css responsible for that page does not change the color of the text so it should (like all the rest of the page is) be visible. Please help :) Yours, Kevin $query = SELECT concat(rank_tbl.abbreviation, ' ', character_tbl.name, ' ', character_tbl.surname) as CO, character_tbl.ircnick, character_tbl.email FROM character_tbl, rank_tbl, sim_tbl WHERE sim_tbl.co = character_tbl.id AND character_tbl.rank = rank_tbl.id AND sim_tbl.co = character_tbl.id AND character_tbl.rank = rank_tbl.id AND sim_tbl.id = $sim_id; $result = mysql_query($query); $num_rows = mysql_num_rows($result); if ($num_rows == 1) { while ($row = mysql_fetch_array($result)); { $co = $row[CO]; $nick = $row[ircnick]; $email = $row[email]; }; echo table tr td width=\50\/td td width=\125\CO:td tda href=\$email\$co/a/td /tr tr td width=\50\/td td width=\125\IRC NICKtd td$nick/td /tr tr td width=\50\/td td width=\125\td td/td /tr /table; } else { echo br p class=\medium\No Commanding Officer assigned to $name/p; }; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Result is not empty
Take out the while statement-- i.e. simply use: $row = mysql_fetch_array($result); the way you have things constructed now, the while statement evaluates true on the first iteration and $row equals the result row from the query. Because the while returned true, it is evaluated a second time, returns false, and $row = NULL. -ib Why would that matter? He still sets the column variables on the first iteration? Yes, he needs no while loop, but the variables that are set inside the loop should remain set after the loop terminates. Kevin Schaaps wrote: Greetings once again, Today I hope to have a challenge for you. :) I've created a query which returns 1 record. This is confirmed when testing it in MySQL itself. Now PHP sees that there is 1 record in the result, but is completely unwilling to show the information. The css responsible for that page does not change the color of the text so it should (like all the rest of the page is) be visible. Please help :) Yours, Kevin $query = SELECT concat(rank_tbl.abbreviation, ' ', character_tbl.name, ' ', character_tbl.surname) as CO, character_tbl.ircnick, character_tbl.email FROM character_tbl, rank_tbl, sim_tbl WHERE sim_tbl.co = character_tbl.id AND character_tbl.rank = rank_tbl.id AND sim_tbl.co = character_tbl.id AND character_tbl.rank = rank_tbl.id AND sim_tbl.id = $sim_id; $result = mysql_query($query); $num_rows = mysql_num_rows($result); if ($num_rows == 1) { while ($row = mysql_fetch_array($result)); { $co = $row[CO]; $nick = $row[ircnick]; $email = $row[email]; }; echo table tr td width=\50\/td td width=\125\CO:td tda href=\$email\$co/a/td /tr tr td width=\50\/td td width=\125\IRC NICKtd td$nick/td /tr tr td width=\50\/td td width=\125\td td/td /tr /table; } else { echo br p class=\medium\No Commanding Officer assigned to $name/p; }; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Result is not empty
yes, of course you're right-- gotta stop working so late... the use of the while statement where it wasn't needed threw me off, I guess. Paul DuBois wrote: Take out the while statement-- i.e. simply use: $row = mysql_fetch_array($result); the way you have things constructed now, the while statement evaluates true on the first iteration and $row equals the result row from the query. Because the while returned true, it is evaluated a second time, returns false, and $row = NULL. -ib Why would that matter? He still sets the column variables on the first iteration? Yes, he needs no while loop, but the variables that are set inside the loop should remain set after the loop terminates. Kevin Schaaps wrote: Greetings once again, Today I hope to have a challenge for you. :) I've created a query which returns 1 record. This is confirmed when testing it in MySQL itself. Now PHP sees that there is 1 record in the result, but is completely unwilling to show the information. The css responsible for that page does not change the color of the text so it should (like all the rest of the page is) be visible. Please help :) Yours, Kevin $query = SELECT concat(rank_tbl.abbreviation, ' ', character_tbl.name, ' ', character_tbl.surname) as CO, character_tbl.ircnick, character_tbl.email FROM character_tbl, rank_tbl, sim_tbl WHERE sim_tbl.co = character_tbl.id AND character_tbl.rank = rank_tbl.id AND sim_tbl.co = character_tbl.id AND character_tbl.rank = rank_tbl.id AND sim_tbl.id = $sim_id; $result = mysql_query($query); $num_rows = mysql_num_rows($result); if ($num_rows == 1) { while ($row = mysql_fetch_array($result)); { $co = $row[CO]; $nick = $row[ircnick]; $email = $row[email]; }; echo table tr td width=\50\/td td width=\125\CO:td tda href=\$email\$co/a/td /tr tr td width=\50\/td td width=\125\IRC NICKtd td$nick/td /tr tr td width=\50\/td td width=\125\td td/td /tr /table; } else { echo br p class=\medium\No Commanding Officer assigned to $name/p; }; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Result is not empty
Take out the while statement-- i.e. simply use: $row = mysql_fetch_array($result); the way you have things constructed now, the while statement evaluates true on the first iteration and $row equals the result row from the query. Because the while returned true, it is evaluated a second time, returns false, and $row = NULL. -ib Kevin Schaaps wrote: Greetings once again, Today I hope to have a challenge for you. :) I've created a query which returns 1 record. This is confirmed when testing it in MySQL itself. Now PHP sees that there is 1 record in the result, but is completely unwilling to show the information. The css responsible for that page does not change the color of the text so it should (like all the rest of the page is) be visible. Please help :) Yours, Kevin $query = SELECT concat(rank_tbl.abbreviation, ' ', character_tbl.name, ' ', character_tbl.surname) as CO, character_tbl.ircnick, character_tbl.email FROM character_tbl, rank_tbl, sim_tbl WHERE sim_tbl.co = character_tbl.id AND character_tbl.rank = rank_tbl.id AND sim_tbl.co = character_tbl.id AND character_tbl.rank = rank_tbl.id AND sim_tbl.id = $sim_id; $result = mysql_query($query); $num_rows = mysql_num_rows($result); if ($num_rows == 1) { while ($row = mysql_fetch_array($result)); { $co = $row[CO]; $nick = $row[ircnick]; $email = $row[email]; }; echo table tr td width=\50\/td td width=\125\CO:td tda href=\$email\$co/a/td /tr tr td width=\50\/td td width=\125\IRC NICKtd td$nick/td /tr tr td width=\50\/td td width=\125\td td/td /tr /table; } else { echo br p class=\medium\No Commanding Officer assigned to $name/p; }; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Result is not empty
the lack of proper close html code will cause a no show in Netscape, but will show in Ie |table |tr |td width=\50\/td |td width=\125\CO:td |tda href=\$email\$co/a/td |/tr |tr |td width=\50\/td |td width=\125\IRC NICKtd--- |td$nick/td |/tr |tr |td width=\50\/td |td width=\125\td--- |td/td |/tr |/table; [EMAIL PROTECTED] SeaPortNetHosting: Reliable Web Hosting Plans from $17.95 www.yourname.com http://www.SeaPortNet.com/ 1(209)551-7028 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]