tags:

views:

38

answers:

3
  1. I have added a new record to a table using phpMyAdmin
  2. I then run select * within phpMyAdmin and it works listing all records.
  3. However if run the same select * from a PHP page the new record is missing.

I am using PHP 5 and am not sure what is going on here. It used to work in PHP 4.

.php files run as PHP 5 Apache module mode.

+1  A: 

Here are a few things you can investigate:

  • You could be connecting to a different database from the one you think you are (do you have test and production databases?).
  • You may have an error or typo in your SELECT statement. Copy and paste exactly the query that works into your code. Do not manually edit it afterwards.
  • You might select the row correctly but display it incorrectly so that it appears not to be there. Try checking how many rows there are in your result set.
Mark Byers
answer: I was connecting to a different database, thanks
Harry
A: 

Try put sql query to variable and then dump it to log or use var_dump. Then put query to phpMyAdmin and check errors.

bswietochowski
A: 

Thanks for the answers but found out the answer now.

I had bookmarked a link to an older phpMyAdmin server which looked almost identical and allowed me to log in etc. My host should have forwarded me to the latest server.

I am now using the correct server. Hope this helps someone else.

Harry
Isn't that basically what I suggested in my answer? *You could be connecting to a different database from the one you think you are*
Mark Byers