wajdan Posted March 12, 2008 Share Posted March 12, 2008 I am havint trouble in dateformat in mysql fetch below is the code please help if you thing somthing is missing <? $sql_select_dateformat = mysql_query("SELECT * FROM vendor_dateformat"); while ($date_format_details = mysql_fetch_array($sql_select_dateformat)) { ?> this displays this warning Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/vendor/public_html/general_settings.tpl.php on line xx please help me ASAP Quote Link to comment Share on other sites More sharing options...
CMNetworx Posted March 12, 2008 Share Posted March 12, 2008 <? $info = mysql_query("SELECT * FROM vendor_dateformat"); while ($info = mysql_fetch_array($sql_select_dateformat)) { } ?> You declared your query as $sql_select_dateformat, but then ran a while statement for $date_format_details which has not been set.. Quote Link to comment Share on other sites More sharing options...
wajdan Posted March 12, 2008 Author Share Posted March 12, 2008 How should I set please help its very urgent can you tell me? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted March 12, 2008 Share Posted March 12, 2008 The name of the variable for the result resource is correct in both of the original lines of code. The code CMNetworx posted is using two different variables and won't ever work. The error means (and we see this error about three times a day on this forum) that your mysql_query() failed (there are about 3-5 common reasons and there is no way anyone in a forum can tell which one based on just seeing two of your lines of code) but your code has absolutely no error checking logic (which is curious because even the examples in the php manual have error checking logic) to get it to tell you why it failed. Change your mysql_query to the following to get php/mysql to tell you why it failed - $sql_select_dateformat = mysql_query("SELECT * FROM vendor_dateformat") or die("Query failed: " . mysql_error()); Quote Link to comment Share on other sites More sharing options...
wajdan Posted March 12, 2008 Author Share Posted March 12, 2008 WOW THANX MATE YOU DID GR8 JOB PROBLEM CURED Quote Link to comment Share on other sites More sharing options...
CMNetworx Posted March 20, 2008 Share Posted March 20, 2008 oops, your right, that wouldn't work.. not sure how I got that bassackwards.. Quote Link to comment 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.