-
Nov 13th, 2012, 09:27 AM
#1
Thread Starter
Junior Member
[RESOLVED] select database problem
PHP Code:
$con = mysql_connect("localhost","user1","password") or die("Cannot connect");
mysql_select_db("pmonty7_dsd", $con) or die("Cannot select database");
$query = "SELECT * FROM randquote ORDER BY Rand() LIMIT 1";
$result = mysql_query($query,$con) or die("Result Query Error");
while($rows = mysql_fetch_array($result))
{
echo $rows['quote'] . " " . $rows['LastName'];
echo "<br />";
}
mysql_close($con);
I am getting the die message "Cannot select database"
I have no idea host is all workign fine and so is phpmyadmin and so on. But cant figure it out. also the name and table name are 100% correct.
Any idea guys?
-
Nov 13th, 2012, 09:04 PM
#2
Member
Re: select database problem
bump your error level up (with error_reporting) and see what actual error the sql lib gives you
PHP Code:
error_reporting(E_ALL)
-
Nov 13th, 2012, 09:10 PM
#3
Thread Starter
Junior Member
Re: select database problem
Just added it now and still get the same message "Cannot select DB"... is it not recognizing the dbname or is it a issue on the mysql configuration end?
-
Nov 13th, 2012, 09:14 PM
#4
Thread Starter
Junior Member
Re: select database problem
hmm i added mysql_Error() and it says access denied for 'pmonty7_admin'@'localhost' to 'pmonty7_dsd'
-
Nov 14th, 2012, 04:17 AM
#5
Re: select database problem
Originally Posted by SharpCode
hmm i added mysql_Error() and it says access denied for 'pmonty7_admin'@'localhost' to 'pmonty7_dsd'
Check whether user1 has appropriate permission to access your database pmonty7_dsd.
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Nov 14th, 2012, 08:04 PM
#6
Thread Starter
Junior Member
Re: select database problem
yeh seems the user i made wasn't added to the database... common sense -.-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|