Page 1 of 1
mysql_fetch_array() expects parameter 1 to be a resource
Posted: Sun Oct 10, 2010 1:59 pm
by AdrenalineSeed
Code: Select all
$result = mysqli_query($link, 'SELECT Count(name) FROM signup WHERE tourny = "' . $tournyinfo['name'] . '"');
include 'bin/verifysql.php';
$row = mysql_fetch_array($result);
I get this error when I run this code. But I have run this code many times before, its only when I do a count. But the output looks like this:
+-------------+
| count(name) |
+-------------+
| 3 |
+-------------+
1 row in set (0.00 sec)
so $result should be a valid resource.
I have a line right under it that works:
Code: Select all
$result = mysqli_query($link, 'SELECT * FROM signup where tourny = "' . $tournyinfo['name'] . '"');
include 'bin/verifysql.php';
while ($row = mysqli_fetch_array($result))
Re: mysql_fetch_array() expects parameter 1 to be a resource
Posted: Sun Oct 10, 2010 2:06 pm
by califdon
In your first example, you executed a mysqli_query, but you then tried to execute a mysql_fetch_array() function. Try adding i to that.
Re: mysql_fetch_array() expects parameter 1 to be a resource
Posted: Sun Oct 10, 2010 3:02 pm
by AdrenalineSeed
awsome thanks! Amazing find
Re: mysql_fetch_array() expects parameter 1 to be a resource
Posted: Sun Oct 10, 2010 4:32 pm
by califdon
AdrenalineSeed wrote:awsome thanks! Amazing find
If you find that amazing, you're missing a vital part of programming technique: when something isn't working,
look at each and every element of the syntax to find simple typos like that. Good luck.