Jump to content


Photo

Some help identifying the bad syntax please.


  • Please log in to reply
4 replies to this topic

#1 lamajlooc

lamajlooc
  • Members
  • PipPip
  • Member
  • 17 posts

Posted 25 October 2006 - 05:58 AM

First, I'd like to say thanks to all those who responded to my other two questions.  Here's one that's bizarre though.

I'm getting an error on the following code:
$result = @mysql_query ($query);
        $row = mysql_fetch_array ($result, MYSQL_NUM);
        if ($row) {
            $_SESSION['date_last_in'] = $row[0];
        }

The error is "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource"

The wierd things are: a) according to php.net the syntax is CORRECT (unless I'm syslexic) and I've used this same code before with no troubles.

Any ideas?

#2 Stooney

Stooney
  • Members
  • PipPipPip
  • Advanced Member
  • 1,093 posts
  • LocationLas Cruces, NM

Posted 25 October 2006 - 06:04 AM

$result = @mysql_query ($query);
if($result) 
{
        $row = mysql_fetch_array ($result, MYSQL_NUM);
        if ($row) 
        {
            $_SESSION['date_last_in'] = $row[0];
        }
}

else
{
       //query didn't work, therefore $result is not a "valid MySQL result resource"
}

Basically you need to make sure you're connected with your database properly and that your query is valid.

<embed src='.wav' autostart='true' loop='false'
width='2' height='0'>
</embed>
i found that ERMMMMM thats called PHP!!!!


#3 BrianPeiris

BrianPeiris
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 25 October 2006 - 08:26 AM

you might also want to remove the '@' (at sign) in front of 'mysql_query' during testing, so that you see any and all errors that might be suppressed.
Docs on Error Control Operators:|http://ca3.php.net/manual/en/language.operators.errorcontrol.php

#4 JasonLewis

JasonLewis
  • Members
  • PipPipPip
  • Advanced Member
  • 3,351 posts
  • LocationVictoria, Australia

Posted 25 October 2006 - 10:43 AM

whats the query to btw...?
Good luck with your coding.
Jason / ProjectFear / Jaysonic

#5 lamajlooc

lamajlooc
  • Members
  • PipPip
  • Member
  • 17 posts

Posted 25 October 2006 - 11:00 PM

Fixed the problem, I was dyslexic.  Thanks guys.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users