Mutley Posted October 18, 2008 Share Posted October 18, 2008 I can't get the following function to work, I've tested all the variables and data and they echo correctly, I can't see why it doesn't initiate. <?php function pending($var) { if($var > 0) { $result = mysql_query("SELECT 2playerpts, 4playerpts, 6playerpts, 8playerpts FROM leaderboard WHERE user_id = '$var' LIMIT 1"); while($row = mysql_fetch_array( $result )) { $pts2 = $row['2playerpts']; $pts4 = $row['4playerpts']; $pts6 = $row['6playerpts']; $pts8 = $row['8playerpts']; } echo "<tr><td class='clear'>"; displayRank($var); userOnline($var); userProfile($var); echo "</td><td class='clear'"; echo $pts2; echo "</td><td class='clear'"; echo $pts4; echo "</td><td class='clear'"; echo $pts6; echo "</td><td class='clear'"; echo $pts8; echo "</td><td class='clear'"; echo $pts2+$pts4+$pts6+$pts8; echo "</td></tr>"; } } $post_race_id = $_POST['race_id']; echo $post_race_id; echo "<<<<<"; $result = mysql_query("p1_id, p2_id, p3_id, p4_id, p5_id, p6_id, p7_id, p8_id FROM races WHERE race_id = $post_race_id"); while($row = mysql_fetch_array( $result )) { $p1_id = $row['p1_id']; $p2_id = $row['p2_id']; $p3_id = $row['p3_id']; $p4_id = $row['p4_id']; $p5_id = $row['p5_id']; $p6_id = $row['p6_id']; $p7_id = $row['p7_id']; $p8_id = $row['p8_id']; pending($p1_id); pending($p2_id); pending($p3_id); pending($p4_id); pending($p5_id); pending($p6_id); pending($p7_id); pending($p8_id); } ?> Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/128979-solved-function-wont-showwork/ Share on other sites More sharing options...
thebadbad Posted October 18, 2008 Share Posted October 18, 2008 One thing; aren't you missing "SELECT" on this line?: $result = mysql_query("p1_id, p2_id, p3_id, p4_id, p5_id, p6_id, p7_id, p8_id FROM races WHERE race_id = $post_race_id"); Link to comment https://forums.phpfreaks.com/topic/128979-solved-function-wont-showwork/#findComment-668668 Share on other sites More sharing options...
Mutley Posted October 18, 2008 Author Share Posted October 18, 2008 Argh, thanks! I hate it when it's missing something simple like that. Link to comment https://forums.phpfreaks.com/topic/128979-solved-function-wont-showwork/#findComment-668677 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.