Jump to content

Please help any body


wajdan

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/95824-please-help-any-body/
Share on other sites

 

<?

      $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..

Link to comment
https://forums.phpfreaks.com/topic/95824-please-help-any-body/#findComment-490588
Share on other sites

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());

Link to comment
https://forums.phpfreaks.com/topic/95824-please-help-any-body/#findComment-490690
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.