# mysql\_fetch\_array() error

**URL:** <https://forum.kirupa.com/t/mysql-fetch-array-error/227534>\
**Category:** programming\
**Created:** [May 31, 2007, 1:52am UTC](https://forum.kirupa.com/t/mysql-fetch-array-error/227534 "2007-05-31T01:52:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lolit](https://avatars.discourse-cdn.com/v4/letter/l/8edcca/32.png) [@Lolit](https://forum.kirupa.com/u/Lolit)\
**Post date:** [May 31, 2007, 1:52am UTC](https://forum.kirupa.com/t/mysql-fetch-array-error/227534/1 "2007-05-31T01:52:00Z")

</div>

Hello,  
If anyone can help, I have the following error on my php code:  
PHP Warning: mysql\_fetch\_array(): supplied argument is not a valid MySQL result.This is part of the PHP where the problem is and the message i get on the HTML page is something wrong in artistinfo table:

artistid is varchar(20) primary key in artistinfo table  
song is varchar(20) from the same table

[COLOR=red] $query=“select MAX(artistid) as artistid from artistinfo”;  
$result=mysql\_query($query);  
if($row=mysql\_fetch\_array($result))  
{  
$artistid = ++$row[“artistid”];  
}  
else  
{  
die(“something wrong in artistinfo table!”);  
}[/COLOR]

Thank you for any response
