Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\display.php on line 10
<?php
//connect to mysql database
require ($_SERVER["DOCUMENT_ROOT"]."/Config/music.php");
$connection = mysql_connect($db_host, $db_user, $db_pw) or die(mysql_error());
mysql_select_db($db_name, $connection);
$sql = "SELECT * FROM songs";
while ($songs = mysql_fetch_array($sql)){
$ID = $songs[id];
$ARTIST = $songs[artist];
}
echo "$ID, $ARTIST";
?>
another error i cant sort out
Started by Deathskin, Jan 26 2007 12:33 AM
1 reply to this topic
#1
Posted 26 January 2007 - 12:33 AM
#2
Posted 26 January 2007 - 01:10 AM
$sql = "SELECT * FROM songs";
while ($songs = mysql_fetch_array($sql)){
$sql = string... as in not a resource. You forgot to call the mysql_query() function.$sql = mysql_query("SELECT * FROM songs") or die(mysql_error());
while ($songs = mysql_fetch_array($sql)){
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
