djfox Posted July 17, 2007 Share Posted July 17, 2007 <? if ($_GET['alert'] == "noechos") { echo "<script language=\"javascript\" type=\"text/javascript\"> alert(\"You don't have enough echos for this!\"); </script>"; } if(!$offset) $offset=0; $recent = 0; $res = mysql_query("Select id,seller,item,sellprice,price,sellerid FROM coll_sell ORDER BY id DESC")or die( mysql_error() ); echo ""; while( $row = mysql_fetch_row($res) ){ if( $recent >= $offset && $recent < ($offset + 25 )){ if( $recent%1 == 0 ){ echo "<tr><td bgcolor='312D37'><td bgcolor='312D37'><td bgcolor='312D37'><td bgcolor='312D37'><tr>"; } ?> <? $res = mysql_query("SELECT id, name, description, url, price, preview FROM collection WHERE id='$row[2]'"); $item = mysql_fetch_row($res); mysql_free_result($res); ?> <td><img src="stamps/<? echo "$item[6]" ?>"> <? echo "$item[1]" ?> <td><a href="trancer.php?g=<? echo"$row[5]" ?>"><? echo "$row[1]" ?></a> <td><? echo "$row[3]" ?> Echos <td><a href="sellbuy.php?id=<? echo "$row[0]" ?>&p=<? echo "$row[3]" ?>&pr=<? echo "$row[4]" ?>">Buy</a> <? } $recent = $recent + 1; } echo ""; ?> All the information is properly displaying. However, after all the displayed information, I get this error message: Warning: mysql_fetch_row(): 22 is not a valid MySQL result resource in /home/secrett1/public_html/testing/vendor_grovepark.php on line 109 And, it only lists one item. It will not list the other items in the coll_sell table. Line 109 is this line: while( $row = mysql_fetch_row($res) ){ Why is this error coming up? What can I do to fix it? Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted July 17, 2007 Share Posted July 17, 2007 That means you have a problem with your query: $res = mysql_query("Select id,seller,item,sellprice,price,sellerid FROM coll_sell ORDER BY id DESC") or die( mysql_error() ); Are you sure it isn't give you an error message? Try putting this at the top of your script: error_reporting(E_ALL); Quote Link to comment Share on other sites More sharing options...
djfox Posted July 17, 2007 Author Share Posted July 17, 2007 These pop up: Notice: Undefined index: alert in /home/secrett1/public_html/testing/vendor_grovepark.php on line 101 Notice: Undefined variable: offset in /home/secrett1/public_html/testing/vendor_grovepark.php on line 107 Warning: mysql_fetch_row(): 22 is not a valid MySQL result resource in /home/secrett1/public_html/testing/vendor_grovepark.php on line 111 Line 101 if ($_GET['alert'] == "noechos") { Line 107 if(!$offset) $offset=0; Line 111 while( $row = mysql_fetch_row($res) ){ Quote Link to comment Share on other sites More sharing options...
per1os Posted July 17, 2007 Share Posted July 17, 2007 <?php if (isset($_GET['alert'] && $_GET['alert'] == "noechos") { echo "<script language=\"javascript\" type=\"text/javascript\"> alert(\"You don't have enough echos for this!\"); </script>"; } // should it be $_GET['offset'] ?? if(isset($offest) && !$offset) $offset=0; $recent = 0; $res = mysql_query("Select id,seller,item,sellprice,price,sellerid FROM coll_sell ORDER BY id DESC")or die( mysql_error() ); while( $row = mysql_fetch_row($res) ){ if( $recent >= $offset && $recent < ($offset + 25 )){ if( $recent%1 == 0 ){ echo "<tr><td bgcolor='312D37'><td bgcolor='312D37'><td bgcolor='312D37'><td bgcolor='312D37'><tr>"; } // needs to be named different than what we are looping on. $res2 = mysql_query("SELECT id, name, description, url, price, preview FROM collection WHERE id='$row[2]'"); $item = mysql_fetch_row($res2); mysql_free_result($res2); ?> <td><img src="stamps/<? echo "$item[6]" ?>"> <? echo "$item[1]" ?> <td><a href="trancer.php?g=<? echo"$row[5]" ?>"><? echo "$row[1]" ?></a> <td><? echo "$row[3]" ?> Echos <td><a href="sellbuy.php?id=<? echo "$row[0]" ?>&p=<? echo "$row[3]" ?>&pr=<? echo "$row[4]" ?>">Buy</a> <?php } $recent = $recent + 1; } ?> First off use <?php as <? has been depreciated. Check that offset is not being passed GET or POST, you always check a variable for being isset to avoid the notice error. For the query error you are using $res inside the while, which is what screwed it up, change that to a different name Edits made above. Quote Link to comment Share on other sites More sharing options...
djfox Posted July 17, 2007 Author Share Posted July 17, 2007 frost110 Putting in your code, the page is blank with just this message: Parse error: syntax error, unexpected T_BOOLEAN_AND, expecting ',' or ')' in /home/secrett1/public_html/testing/vendor_grovepark.php on line 99 Line 99 is: if (isset($_GET['alert'] && $_GET['alert'] == "noechos") { Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 17, 2007 Share Posted July 17, 2007 if (isset($_GET['alert']) && $_GET['alert'] == "noechos") { you missed " )" Quote Link to comment Share on other sites More sharing options...
djfox Posted July 17, 2007 Author Share Posted July 17, 2007 if (isset($_GET['alert']) && $_GET['alert'] == "noechos") { you missed " )" You mean " )" needs to entered somewhere in that line? Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 17, 2007 Share Posted July 17, 2007 here is your code if (isset($_GET['alert'] && $_GET['alert'] == "noechos") { heres what i posed if (isset($_GET['alert']) && $_GET['alert'] == "noechos") { isset($_GET['alert']) you have to place the ) after $_GET['alert'] isset is a predefine function so it need a complete () Quote Link to comment Share on other sites More sharing options...
djfox Posted July 17, 2007 Author Share Posted July 17, 2007 Oh goodness. It`s always the simple things that slip past me. That did the trick. Thanks for the big help guys. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.