hi
i m new in php programming
i have made simple page to retrieve information from mysql database but the error showed is this:
mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\wamp\www\sampe app\sample.php on line 21
Just i want to print data from database
please reply
wht can i do for it[/syntax]
Problem in fetching data from mysql database [solved]
Moderator: General Moderators
Re: Problem in fetching data from mysql database
Your supplied argument is invalid or you may have a spell mistake.ravi1511 wrote:hi
i m new in php programming
i have made simple page to retrieve information from mysql database but the error showed is this:
mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\wamp\www\sampe app\sample.php on line 21
Just i want to print data from database
please reply
wht can i do for it[/syntax]
Try like this:
Code: Select all
$sql = "select * from mytable";
$result = mysql_query($sql, $connection) or die(mysql_error());
while($row=mysql_fetch_array($result)){
$id=$row['id'];
$name=$row['name'];
}
echo "$id<br>$name";Thanks
Thanks for giving me reply so quickly.
My problem is now solved
problem is in connection string.
i h made one use in mysql with password
and use it in connection string
but that user is not working
so when i used localhost with blank pass and blank username
it worked
once again thanks for replying me
bye
My problem is now solved
problem is in connection string.
i h made one use in mysql with password
and use it in connection string
but that user is not working
so when i used localhost with blank pass and blank username
it worked
once again thanks for replying me
bye