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
Connect and query mysql
Moderator: General Moderators
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Connect and query mysql
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.
-
slowcoach620
- Forum Newbie
- Posts: 4
- Joined: Tue Aug 10, 2010 5:17 am
Re: Connect and query mysql
Thanks Jonah I'll give that a try
Regards
John
Regards
John