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!
This should be simple stuff and I'm probably missing something obvious (can't see the wood for the trees sort of thing) but all help is appreciated. I have a block of code that I am using for connection:
mysql_select_db($database_dggb, $dggb);
$query_member = "SELECT * FROM `membersBenefits` WHERE `active` = '1' ORDER BY `order` Asc";
$member = mysql_query($query_member, $dggb);
$row_member = mysql_fetch_assoc($member);
$totalRows_member = mysql_num_rows($member);
There is definately a table called 'membersBenefits'. It definately has a field called 'active'. This connection works perfectly fine on my local server. I have just uploaded it and found the following error.
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in join.php on line 28
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in join.php on line 29
My question of course is... what have I done wrong?
The fact that there was no SQL error was what through me in the first instance. I thought it was a problem with the database but I can log into my PHPMyAdmin panel and see the table it's looking for. If you have a look through the rest of the site, (even though there's no data there at the moment) the same block of text has been used to connect the other pages and they work perfectly well.
The other thing that is so confusing is that it's running perfectly fine on my localhost.
I have solved it. Well, solved is not technically right. I have found a way around the problem by creating a new table (called 'memben') and dumping the data in that.
I have no idea why this happened and no idea what fixed it, but thanks to everyone (especially astions) who took an interest and at least tried to help