Warning: mysql_fetch_array() expects parameter 1 to be resource, string given in C:\\xampp\\htdocs\\test\\index.php on line 19
Cited from PHP.net about mysql_query()
:
For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query() returns a resource on success, or FALSE on error.
For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, mysql_query() returns TRUE on success or FALSE on error.
In your case the resource is returned, but you've forgotten to assign it to anything.
Change mysql_query($sql)
to $resource = mysql_query($sql)
.
Full documentation right here: http://php.net/manual/en/function.mysql-query.php