Hi,

I have been working with php for awhile now, but I am bum fuzzled on this one:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/xxxxx/public_html/xxxxx/index.php on line 5

adminlogin.php

<?php
   include "mysql.php";

 $res=mysql_query("select * from pagelay");
 $mygrow = mysql_fetch_array($res);
?>

now the other page but it is giving it on two lines:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/xxxxx/public_html/xxxxx/index.php on line 5

I have tried placing the flush in the code and it didnt work.

And I keep getting this :

Password field is empty, please click your browsers 'back' button.
And the password is in the field and correct??

Thanks In Advance I hope I placed the (code) right

Recommended Answers

All 3 Replies

From what i know the mysql Statemants need to be caps

$res = mysql_query("SELECT * FROM pagelay");
$mygrow = mysql_fetch_array($res);

You should be good now

This is not true at all!
The following will work assuming that you are connected to a mysql database with a table named foo:

mysql_query("SelECt FRom foo");

Your problem most likely is that your query doesn't return any results. In that case, mysql_fetch_array() will not work because there are no rows to return.
If this is the issue, make sure to use mysql_num_rows() to verify there are results before getting them.

<?php
include "mysql.php";
$res=mysql_query("select * from pagelay");
if(mysql_num_rows($res) != 0) {
$mygrow = mysql_fetch_array($res);
}
?>

This might not be the case. If you have all errors suppressed, there might be a MySQL connection, database selection, or query error. Be sure error_reporting() is set to E_ALL to make sure you can see these errors. Also you should add or die(mysql_error(); to any query function to make sure that the query doesn't raise any errors.

Also please make sure you question hasn't already been answered elsewhere. Especially if your answer is in a read me thread at the top of the PHP forum.
http://www.daniweb.com/forums/thread191031.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.