Page 1 of 1

Connect and query mysql

Posted: Sun Sep 05, 2010 1:32 pm
by slowcoach620
I had managed to get an small application working with mysqli_connect() and mysqli_query() but the web host I am using is running PHP 5.2.13.

I seem to be able to connect to the database using mysql_connect() and when I use something like: $result = mysql_query($query); to query the database i get a message saying that no database has been selected. I've tried using $db_selected = mysql_select_db(DB_NAME, $dbc); but I get the message saying that it cannot select the database. Can anyone suggest where I'm going wrong

Kind regards
slowcoach620

Re: Connect and query mysql

Posted: Sun Sep 05, 2010 1:49 pm
by Jonah Bron
You don't need to put mysql_select_db in a variable. If it can't select the database, that means you don't have permission, or it doesn't exist.

Re: Connect and query mysql

Posted: Mon Sep 06, 2010 4:13 pm
by slowcoach620
Thanks Jonah I'll give that a try

Regards
John