[thelist] mysql error [was mysql help]

Mark Mckee lists at soddengecko.com
Tue Oct 3 07:13:12 CDT 2006

Hi Phil

Maybe it is somethign I have midified while tidying up the code but I do 
not appear to be getting the error message anymore.

I have a colleague who is going to install the app and see if they get 
any errors on that page as well.

lol, I know categories is spelt wrong, comes form coding way into the 
night. far too many to change now so that is an update for a boring day.

I would still like to output a message that states that the categories 
are empty and one should be created. also having a little difficulty 
creating an export/import function so the db can be backed up via the 
application itself.

any ideas or resources would be brilliant, searched google all night and 
what I founf either did not work or was command line info.

Kind regards

Mark M...

Phil Turmel wrote:
> Mark Mckee wrote:
>> Warning: mysql_fetch_array(): supplied argument is not a valid MySQL 
>> result resource in /opt/lampp/htdocs/link_manager/add_link.php on line 16
>> <?
>> // Connect to the correct database
>> include "dbconnect.php";
>> // Select correct fileds to show
>> $sql="SELECT id, catagory FROM catagories ORDER BY catagory";
>> $result=mysql_query($sql);
>> // Populate the OPTIONS variable
>> $options="";
>> // Fetch the data
>> while ($row=mysql_fetch_array($result)) {              <---------line 16
>> // Display data in this format
>>      $id=$row["id"];
>>      $catagory=$row["catagory"];
>>      $options.="<OPTION VALUE=\"$catagory\">$catagory</option>\n";
>> }
>> ?>
>> what would i have to do so that the script will detect that no category 
>> has been created and output a message to say that?
> Mark,
> Something else must be wrong, as a zero-rows-result is still a valid 
> result.  If you put in an error check right after mysql_query, you'll 
> learn more:
> if ($result===FALSE)
>      printf("Query Error, #%u\n%s\n", mysql_errno(), mysql_error());
> Any chance it's the way you are misspelling category?
> HTH,
> Phil

More information about the thelist mailing list