Jump to content

[SOLVED] Getting 'No database selected' in php runtime


Recommended Posts

Hi there, I'm using the WAMP 2.0 (the latest version downloaded)

 

 

I've just transferred my database from on pc to another. The data is showing up okay in phpmyadmin, and can run successful queries, yet when i use the same standalone php scripts that I used on the original pc, they are coming through with the 'No database selected' (the error message comes from a 'or die (mysql_error())')

 

i've kept the user/pass as root/'' to eliminate a password error.

 

What does everyone recommend i check?

Thanks,JJ

Link to comment
Share on other sites

What does everyone recommend i check?

 

I recommend you check you are actually selecting a database to use. if your db is working fine and you can view it via phpmyadmin, I really don't see that this is an installation issue.

Link to comment
Share on other sites

I feel like such a (enid blyton) noddy. just realised that i coded this before i upgraded to a WAMP version that requires you to put <?php instead of getting away with just <? on the first line. this was missing from my config db files!

 

Thanks for your help, it made me look in the right place, just fell asleep in my PHP101 lecture.

 

JJ

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.