gw32 Posted May 2, 2011 Share Posted May 2, 2011 You guys are great, thanks again for the help last week. Now I almost got this working but a small hiccup. here is my code: <?php include("config.php"); $my_t=getdate(date("U")); $my_t1=$my_t[weekday]; $result = mysql_query("SELECT * FROM tourney where day_of_week = '$my_t1'") or die(mysql_error()); if ($result == '') echo "<br>Empty Set\n"; print_r ($my_t1); This prints correctly while ($result = mysql_fetch_array($result,MYSQL_ASSOC)) { This is my error. "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /hermes/bosweb/web017/b172/ipg.dswdesignsnet/pp4c/charity1.php on line 8" print "<b>Starting Time: <br></b>".$row{'start_time'}."<br><b>Tournament: </b><br>".$row{'tourney'}."<br><b>Buy-in: <br>".$row{'buy_in'}."<br><b>Starting Chips: <br>".$row{'start_chips'}."</font><p>"; This prints headers correctly, but no variables. } mysql_close($dbh); ?> What did I forget to do or what did I do wrong. I'm still learning mysql and php. Quote Link to comment https://forums.phpfreaks.com/topic/235338-pass-variable-from-php-to-mysql/ Share on other sites More sharing options...
spiderwell Posted May 2, 2011 Share Posted May 2, 2011 change this while ($result = mysql_fetch_array($result,MYSQL_ASSOC)) { to this while ($row= mysql_fetch_array($result)) { Quote Link to comment https://forums.phpfreaks.com/topic/235338-pass-variable-from-php-to-mysql/#findComment-1209399 Share on other sites More sharing options...
gw32 Posted May 2, 2011 Author Share Posted May 2, 2011 Thanks. It worked. I just did what was in my book on how to pass variables. Gotta get a different book! Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/235338-pass-variable-from-php-to-mysql/#findComment-1209403 Share on other sites More sharing options...
spiderwell Posted May 2, 2011 Share Posted May 2, 2011 I'd like to hope your book doesn't have errors like that in it! i'd ask for my money back if it did! Quote Link to comment https://forums.phpfreaks.com/topic/235338-pass-variable-from-php-to-mysql/#findComment-1209406 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.