hi can anybody help me i need to get the data from db through php script my code is :
<?php
$con=mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("poll",$con);
echo "DB SELECTED<br>";
$result=mysql_query("select question from pollquestions",$con);
echo "QUERY EXECUTED<br>";
echo $result ;
echo "<br>DATA DISPLAYED<br>";
mysql_close($con);
?>
but its returning me only resource id#3 why i could not get the actual data from the database
mithesh
0
Newbie Poster
Recommended Answers
Jump to Postbecause you are not specifying the password for root!
e.g in my site
$host = 'localhost'; $user = 'root'; $pass = 'letmein'; $connection = mysql_connect($host, $user, $pass) or die ('Unable to connect!'); mysql_select_db('databasename') or die ('Unable to select database.'); $query = "SELECT * FROM customers" $result …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.