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
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
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
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.