Hooch Posted July 17, 2009 Report Share Posted July 17, 2009 Hey all.The following script worked in PHP4, but I cannot see the problem for it not to work in PHP5Here is the error... Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/public_html/admin_cats.php on line 74 if(isset($_GET['cat'])) { $catTbl = $_GET['cat']; $query = mysql_query("SELECT * FROM `cat" . $cat . "`"); //Show the new button 1st echo ' <span class="txtbox-small"> <a href="admin_cats.php?new_cat=' . $catTbl . '" class="light-10-link">New Category</a> </span>'; echo ' for ' . $catLevel; echo '<br><br>'; while($r = mysql_fetch_array($query)) { echo '<div class="left_box_100">'; echo '<a href="admin_cats.php?edit_cat=' . $r['id'] . '&catTbl=' . $cat . '" class="light-14-link">Edit</a>'; echo ' <a href="admin_cats.php?delete_cat=' . $r['id'] . '&catTbl=' . $cat . '" class="light-14-link">Delete</a>'; echo '</div>'; echo '<div class="right_box"> ' . stripslashes($r['cat']) . '</div>'; echo '<hr>'; } } Line 74 is while($r = mysql_fetch_array($query)) Thank you for your time and help Link to comment Share on other sites More sharing options...
Hooch Posted July 17, 2009 Author Report Share Posted July 17, 2009 (edited) I found the problem $query = mysql_query("SELECT * FROM `cat" . $cat . "`"); " . $cat . "seems to be the culprit.This has to be a variable for the code to work.I'll post back if I fix the error.In the meantime I will keep checking for suggestions.ty**EDIT**Found the error.$cat should be $catTblI am so worried about the transfer to 5 I am expecting big problems when it'sthe normal typos.Thanks for looking anyway. Edited July 17, 2009 by Hooch Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now