big-dog1965 Posted December 21, 2008 Share Posted December 21, 2008 error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'id']."' AND out=0 AND invalid=0 ORDER BY id DESC SELECT * FROM bids WHERE auctionid='".$auctionDetails['id']."' AND out=0 AND invalid=0 ORDER BY id DESC what am I not seeing Manual is just confusing me even more said something about white space "what?" I put spaces all over but I just dont know Please help Link to comment https://forums.phpfreaks.com/topic/137905-syntax-error-i-cant-solve-please-help/ Share on other sites More sharing options...
redarrow Posted December 21, 2008 Share Posted December 21, 2008 try this. SELECT * FROM bids WHERE auctionid='".$auctionDetails['id']."' AND out='0' AND invalid='0' ORDER BY id DESC somthink about this i guess auctionid='".$auctionDetails['id']."' Link to comment https://forums.phpfreaks.com/topic/137905-syntax-error-i-cant-solve-please-help/#findComment-720759 Share on other sites More sharing options...
PFMaBiSmAd Posted December 21, 2008 Share Posted December 21, 2008 Your SQL statement contains a PHP variable. How are you attempting to execute this query? Link to comment https://forums.phpfreaks.com/topic/137905-syntax-error-i-cant-solve-please-help/#findComment-720760 Share on other sites More sharing options...
big-dog1965 Posted December 21, 2008 Author Share Posted December 21, 2008 Yes its a php file the whole error is Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /public_html/MyBid/auctiondetails.php on line 704 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /public_html/MyBid/auctiondet.php on line 706 n/a (0) I thought I had it norrowed down to the 1st post I made but I guess not here code block 700 through 709 700 if ($auctionDetails['maxbid']>0) { echo " - "; if ($auctionDetails['private']!="Y") { 704 $getBidderId=mysql_query("SELECT * FROM bids WHERE auctionid='".$auctionDetails['id']."' AND out='0' AND invalid='0' ORDER BY id DESC"); $nbBidders = mysql_num_rows($getBidderId); ## display only one high bidder, and a (more...) link to a popup if there are more high bidders 706 $highBidder=mysql_fetch_array($getBidderId); $bidderName = getSqlField("SELECT username FROM probid_users WHERE id='".$highBidder['bidderid']."'","username"); 709 echo $bidderName." <a href=\"viewfeedback.php?owner=".$highBidder['bidderid']."&auction=".$auctionDetails['id']."\">".getFeedback($highBidder['bidderid'])."</a>"; Link to comment https://forums.phpfreaks.com/topic/137905-syntax-error-i-cant-solve-please-help/#findComment-720815 Share on other sites More sharing options...
Mark Baker Posted December 21, 2008 Share Posted December 21, 2008 Yes its a php file But the code you gave us (SELECT * FROM bids WHERE auctionid='".$auctionDetails['id']."' AND out=0 AND invalid=0 ORDER BY id DESC) isn't PHP It might be better if you gave us the actual PHP, e.g $query = "SELECT * FROM bids WHERE auctionid='".$auctionDetails['id']."' AND out=0 AND invalid=0 ORDER BY id DESC"; Link to comment https://forums.phpfreaks.com/topic/137905-syntax-error-i-cant-solve-please-help/#findComment-720862 Share on other sites More sharing options...
big-dog1965 Posted December 21, 2008 Author Share Posted December 21, 2008 I hope this reads better these are the errors and the block of code is from the php file. Sorry it’s been a while sense I’ve been on here. I apologize for vague post. Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /public_html/MyBid/auctiondetails.php on line 704 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /public_html/MyBid/auctiondet.php on line 706 n/a (0) I thought I had it norrowed down to the 1st post I made but I guess not here code block 700 through 709 700 if ($auctionDetails['maxbid']>0) { 701 echo " - "; 702 if ($auctionDetails['private']!="Y") { 703 $getBidderId=mysql_query("SELECT * FROM bids WHERE auctionid='".$auctionDetails['id']."' AND out='0' AND invalid='0' ORDER BY id DESC"); 704 $nbBidders = mysql_num_rows($getBidderId); 705 ## display only one high bidder, and a (more...) link to a popup if there are more high bidders 706 $highBidder=mysql_fetch_array($getBidderId); 708 $bidderName = getSqlField("SELECT username FROM probid_users WHERE id='".$highBidder['bidderid']."'","username"); 709 echo $bidderName." <ahref=\"viewfeedback.php?owner=".$highBidder['bidderid']."&auction=".$auctionDetails['id']."\">".getFeedback($highBidder['bidderid'])."</a>"; Link to comment https://forums.phpfreaks.com/topic/137905-syntax-error-i-cant-solve-please-help/#findComment-720885 Share on other sites More sharing options...
redarrow Posted December 21, 2008 Share Posted December 21, 2008 You best show your whole page, As you got a array in the select, so we need to no what going on mate. we just need to no how your programming your code to get a clue what going wrong. As what i can see is the select query, is falling due to the array in the select statement. I get the impression the array in the select is not defined or empty. When i look harder at your code, It like your comparing a array value to a select query statement and matching it to the database. very wired database select query condition. Link to comment https://forums.phpfreaks.com/topic/137905-syntax-error-i-cant-solve-please-help/#findComment-720887 Share on other sites More sharing options...
big-dog1965 Posted December 21, 2008 Author Share Posted December 21, 2008 The whole file exceed the post heres probably everything pertaining to what you need I hope. <? if ($auctionDetails['rp']=="Y") { if ($auctionDetails['rpwinner']==0) echo ($auctionDetails['rpvalue']>$auctionDetails['maxbid']) ? $lang[reservenotmet] : $lang[reservemet]; echo ($auctionDetails['closed']==1&&$auctionDetails['rpvalue']>$auctionDetails['maxbid']&&$_SESSION['memberid']==$auctionDetails['ownerid']&&$auctionDetails['nrbids']>0&&$auctionDetails['rpwinner']==0) ? " <span class=\"contentfont\">[ <a href=\"reserveoffers.php?id=".$auctionDetails['id']."\"><strong>$lang[makeresoffer]</strong></a> ]</span>" : ""; } ?> </font> </td> </tr> <tr class="c3"> <td colspan="2" class="contentfont"><? if ($setts['swap_items']==1&&$auctionDetails['ownerid']!=$_SESSION['memberid']&&$auctionDetails['closed']!=1&&$auctionDetails['isswap']=="Y"&&$auctionDetails['deleted']!=1) { echo "<a href=\"swapitems.php?id=".$auctionDetails['id']."\">".$lang[offerswap]."</a>"; } ?> </td> </tr> <? if (!$binAuction||$auctionDetails['closed']==1) { ?> <tr class="c2"> <td><b> <? echo ($auctionDetails['closed']==1) ? $lang[winnerss] : $lang[highbid]; ?> :</b></td> <td class="contentfont"><b> <? if ($auctionDetails['closed'] == 1) { $getAuctionWinner = mysql_query("SELECT buyerid, bnpurchase, amount FROM bid_winners WHERE auctionid='".$auctionDetails['id']."'") or die(mysql_error()); $nbWinners = mysql_num_rows($getAuctionWinner); while ($auctionWinner = mysql_fetch_array($getAuctionWinner)) { $bidderName = getSqlField("SELECT username FROM bid_users WHERE id='".$auctionWinner['buyerid']."'","username"); echo "<font class='greenfont'>".displayAmount($auctionWinner['amount'],$auctionDetails['currency'])."</font> - ".$bidderName." <a href=\"viewfeedback.php?owner=".$auctionWinner['buyerid']."&auction=".$auctionDetails['id']."\">".getFeedback($auctionWinner['buyerid'])."</a>"; if ($auctionWinner['bnpurchase']==1) echo "</b> [ ".$lang[purchasedwithbn]." ] <b>"; if ($nbWinners>0) echo "<br>"; $foundWinner = TRUE; } if (!$foundWinner) echo $lang[na]; } else { echo ($auctionDetails['rpvalue']<=$auctionDetails['maxbid'])?"<font class='greenfont'><b>":""; echo displayAmount($auctionDetails['maxbid'],$auctionDetails['currency']); echo ($auctionDetails['rpvalue']<=$auctionDetails['maxbid'])?"</b></font><br>":""; if ($auctionDetails['maxbid']>0) { echo " - "; if ($auctionDetails['private']!="Y") { $getBidderId=mysql_query("SELECT * FROM bids WHERE auctionid='".$auctionDetails['id']."' AND out='0' AND invalid='0' ORDER BY id DESC"); $nbBidders = mysql_num_rows($getBidderId); ## display only one high bidder, and a (more...) link to a popup if there are more high bidders $highBidder=mysql_fetch_array($getBidderId); $bidderName = getSqlField("SELECT username FROM bid_users WHERE id='".$highBidder['bidderid']."'","username"); echo $bidderName." <a href=\"viewfeedback.php?owner=".$highBidder['bidderid']."&auction=".$auctionDetails['id']."\">".getFeedback($highBidder['bidderid'])."</a>"; if ($nbBidders>1) echo " [ <a href=\"javascript:popUpSmall('popup_allbidders.php?id=$_GET[id]');\">".$lang[more_bidders]."</a> ]"; } else { echo $lang[bidderhidden]; } } } ?> </b></td> </tr> <? } ?> Link to comment https://forums.phpfreaks.com/topic/137905-syntax-error-i-cant-solve-please-help/#findComment-720899 Share on other sites More sharing options...
redarrow Posted December 21, 2008 Share Posted December 21, 2008 echo the query out please see if it correct and post it here so we all see it cheers. <?php if ($auctionDetails['rp']=="Y") { if ($auctionDetails['rpwinner']==0) echo ($auctionDetails['rpvalue']>$auctionDetails['maxbid']) ? $lang[reservenotmet] : $lang[reservemet]; echo ($auctionDetails['closed']==1&&$auctionDetails['rpvalue']>$auctionDetails['maxbid']&&$_SESSION['memberid']==$auctionDetails['ownerid']&&$auctionDetails['nrbids']>0&&$auctionDetails['rpwinner']==0) ? " <span class=\"contentfont\">[ <a href=\"reserveoffers.php?id=".$auctionDetails['id']."\"><strong>$lang[makeresoffer]</strong></a> ]</span>" : ""; } ?> </font> </td> </tr> <tr class="c3"> <td colspan="2" class="contentfont"><?php if ($setts['swap_items']==1&&$auctionDetails['ownerid']!=$_SESSION['memberid']&&$auctionDetails['closed']!=1&&$auctionDetails['isswap']=="Y"&&$auctionDetails['deleted']!=1) { echo "<a href=\"swapitems.php?id=".$auctionDetails['id']."\">".$lang[offerswap]."</a>"; } ?> </td> </tr> <?php if (!$binAuction||$auctionDetails['closed']==1) { ?> <tr class="c2"> <td><b> <?php echo ($auctionDetails['closed']==1) ? $lang[winnerss] : $lang[highbid]; ?> :</b></td> <td class="contentfont"><b> <?php if ($auctionDetails['closed'] == 1) { $getAuctionWinner = mysql_query("SELECT buyerid, bnpurchase, amount FROM bid_winners WHERE auctionid='".$auctionDetails['id']."'") or die(mysql_error()); $nbWinners = mysql_num_rows($getAuctionWinner); while ($auctionWinner = mysql_fetch_array($getAuctionWinner)) { $bidderName = getSqlField("SELECT username FROM bid_users WHERE id='".$auctionWinner['buyerid']."'","username"); echo "<font class='greenfont'>".displayAmount($auctionWinner['amount'],$auctionDetails['currency'])."</font> - ".$bidderName." <a href=\"viewfeedback.php?owner=".$auctionWinner['buyerid']."&auction=".$auctionDetails['id']."\">".getFeedback($auctionWinner['buyerid'])."</a>"; if ($auctionWinner['bnpurchase']==1) echo "</b> [ ".$lang[purchasedwithbn]." ] <b>"; if ($nbWinners>0) echo "<br>"; $foundWinner = TRUE; } if (!$foundWinner) echo $lang[na]; } else { echo ($auctionDetails['rpvalue']<=$auctionDetails['maxbid'])?"<font class='greenfont'><b>":""; echo displayAmount($auctionDetails['maxbid'],$auctionDetails['currency']); echo ($auctionDetails['rpvalue']<=$auctionDetails['maxbid'])?"</b></font><br>":""; if ($auctionDetails['maxbid']>0) { echo " - "; if ($auctionDetails['private']!="Y") { $getBidderId=mysql_query("SELECT * FROM bids WHERE auctionid='".$auctionDetails['id']."' AND out='0' AND invalid='0' ORDER BY id DESC"); echo $getBidderId; // echo out $nbBidders = mysql_num_rows($getBidderId); ## display only one high bidder, and a (more...) link to a popup if there are more high bidders $highBidder=mysql_fetch_array($getBidderId); $bidderName = getSqlField("SELECT username FROM bid_users WHERE id='".$highBidder['bidderid']."'","username"); echo $bidderName." <a href=\"viewfeedback.php?owner=".$highBidder['bidderid']."&auction=".$auctionDetails['id']."\">".getFeedback($highBidder['bidderid'])."</a>"; if ($nbBidders>1) echo " [ <a href=\"javascript:popUpSmall('popup_allbidders.php?id=$_GET[id]');\">".$lang[more_bidders]."</a> ]"; } else { echo $lang[bidderhidden]; } } } ?> </b></td> </tr> <?php } ?> Link to comment https://forums.phpfreaks.com/topic/137905-syntax-error-i-cant-solve-please-help/#findComment-720912 Share on other sites More sharing options...
big-dog1965 Posted December 21, 2008 Author Share Posted December 21, 2008 still same errors if you made the change I just copied and paisted it. Link to comment https://forums.phpfreaks.com/topic/137905-syntax-error-i-cant-solve-please-help/#findComment-720934 Share on other sites More sharing options...
Mad Mick Posted December 21, 2008 Share Posted December 21, 2008 He didn't make a change but wanted you to troubleshoot by doing: echo "SELECT * FROM bids WHERE auctionid='".$auctionDetails['id']."' AND out='0' AND invalid='0' ORDER BY id DESC" (or whatever the query is) before the mysql_query and letting us see the actual SELECT statement that will be queried. Link to comment https://forums.phpfreaks.com/topic/137905-syntax-error-i-cant-solve-please-help/#findComment-720946 Share on other sites More sharing options...
big-dog1965 Posted December 21, 2008 Author Share Posted December 21, 2008 Im a dumb a!@ I tried several combinations of the echo in the php file and in sql DB get the same errors I got to go to b-day party for grand daughter be back tonight to hunt and peck more Link to comment https://forums.phpfreaks.com/topic/137905-syntax-error-i-cant-solve-please-help/#findComment-720954 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.