Changed servers - code doesn't work anymore

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

To clarify

Code: Select all

$result = mysql_query($query) or die(mysql_error());
ityd
Forum Newbie
Posts: 17
Joined: Tue Aug 08, 2006 8:16 am

Post by ityd »

not a valid MySQL result resource
This error usually happens when: you have not conected to the server, you have not chosen a database, or when there is a syntax error in your query to the database. Use d11wtq's advice and add or die(mysql_error());. However if your using the same code as in the other server, most likely there is a problem with your database or configuration of your new server.

Also before your while loop you initialized variable $i and incremented in the loop, yet that is all you do with it, just wondering why that is.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Code: Select all

$sql = "SELECT * FROM pixels WHERE viewable= 'Y' AND adult = 'N' ORDER BY created DESC LIMIT 0,4";
Should be..

Code: Select all

$sql = "SELECT * FROM `pixels` WHERE `viewable`= 'Y' AND `adult` = 'N' ORDER BY `created` DESC LIMIT 0,4";
Post Reply