Going crazy, need help with phpprobid error
08-30-2007, 09:47 PM
|
Going crazy, need help with phpprobid error
|
Posts: 53
Name: Shaun
|
Hey guys, been trying to figure this out but cant seem to find the problem.
I get the following errors:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /usr/home/bidorbug/public_html/auctiondetails.php on line 717
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /usr/home/bidorbug/public_html/auctiondetails.php on line 719
Here is the code snippet thats apparently creating the error:
if ($auctionDetails['maxbid']>0) {
echo " - ";
if ($auctionDetails['private']!="Y") {
$getBidderId=mysql_query("SELECT * FROM probid_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);
Please help guys, I'm stuck like mad here.
Regards,
Shaun
|
|
|
|
08-30-2007, 09:49 PM
|
Re: Going crazy, need help with phpprobid error
|
Posts: 53
Name: Shaun
|
Just to give a bit more info:
Apache version1.3.37 (Unix)PHP version5.2.3MySQL version5.0.27
Running with PHP Pro Bid v5.25
|
|
|
|
08-30-2007, 10:00 PM
|
Re: Going crazy, need help with phpprobid error
|
Posts: 13
Name: Alan Neller
Location: England
|
1st thing I would check is print "echo" your query to check everything is working correct like the $auctionDetails['id'].
I will have a further look to see if I can see anything else... it might even be you need to upgrade your code to use mysqli instead of mysql
|
|
|
|
08-30-2007, 10:03 PM
|
Re: Going crazy, need help with phpprobid error
|
Posts: 13
Name: Alan Neller
Location: England
|
change your code to this...
Code:
if ($auctionDetails['maxbid']>0) {
echo " - ";
if ($auctionDetails['private']!="Y") {
$getBidderId=mysqli_query("SELECT * FROM probid_bids WHERE auctionid='".$auctionDetails['id']."' AND out=0 AND invalid=0 ORDER BY id DESC");
$nbBidders = mysqli_num_rows($getBidderId);
## display only one high bidder, and a (more...) link to a popup if there are more high bidders
$highBidder=mysqli_fetch_array($getBidderId);
Make sure $auctionDetails['id'] has a value aswell (should check this before the query really)
Hope that helps
|
|
|
|
08-30-2007, 10:20 PM
|
Re: Going crazy, need help with phpprobid error
|
Posts: 53
Name: Shaun
|
Hi man, that didn't work too well, infact generated additional errors:
Warning: mysqli_query() expects at least 2 parameters, 1 given in /usr/home/bidorbug/public_html/auctiondetails.php on line 716
Thanks for the effort though, I need this fixed as the launch for the site is tomorrow and only now discovered the error
|
|
|
|
08-30-2007, 10:33 PM
|
Re: Going crazy, need help with phpprobid error
|
Posts: 53
Name: Shaun
|
Okay, I'll pay anyone 20 bucks that can succesfully solve this?
I will supply you with my site details and then you can log on and solve the problem?
Let me know.
Shaun
|
|
|
|
08-30-2007, 10:36 PM
|
Re: Going crazy, need help with phpprobid error
|
Posts: 53
Name: Shaun
|
I just checked and when I try to view the bidding history for the item I get this:
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 'out FROM probid_bids WHERE id='1'' at line 1
INVALID QUERY: SELECT out FROM probid_bids WHERE id='1'
I suspect highly that the two errors are related...
Any ideas?
|
|
|
|
08-30-2007, 10:46 PM
|
Re: Going crazy, need help with phpprobid error
|
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
|
That is not two errors, but a sql error message and a printout of the query string. I don't see any sytax issues, but you might try to drop the quotes around the id number
__________________
<mgraphic /> - I don't have a solution but I admire the problem.
|
|
|
|
08-30-2007, 10:56 PM
|
Re: Going crazy, need help with phpprobid error
|
Posts: 53
Name: Shaun
|
Hi mgraphic, drop the quotes but still receiving the same errors bro.
Any more ideas?
|
|
|
|
08-30-2007, 11:03 PM
|
Re: Going crazy, need help with phpprobid error
|
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
|
Add this before your query:
echo "SELECT * FROM probid_bids WHERE auctionid='".$auctionDetails['id']."' AND out=0 AND invalid=0 ORDER BY id DESC";
and post what shows on the screen
__________________
<mgraphic /> - I don't have a solution but I admire the problem.
|
|
|
|
08-30-2007, 11:09 PM
|
Re: Going crazy, need help with phpprobid error
|
Posts: 53
Name: Shaun
|
I did a echo on
echo $bidderName = getSqlField("SELECT username FROM probid_users WHERE id='".$highBidder['bidderid']."'","username");
and still get the same error
|
|
|
|
08-30-2007, 11:17 PM
|
Re: Going crazy, need help with phpprobid error
|
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
|
OK, There is a syntax error with this example:
"SELECT username FROM probid_users WHERE id='".$highBidder['bidderid']."'","username";
username is a value from an unidentified column field, so you would want to use something like this:
$bidderName = getSqlField("SELECT username FROM probid_users WHERE id = " . $highBidder['bidderid'] . " AND username = '" . $username . "'");
__________________
<mgraphic /> - I don't have a solution but I admire the problem.
|
|
|
|
08-30-2007, 11:32 PM
|
Re: Going crazy, need help with phpprobid error
|
Posts: 53
Name: Shaun
|
I apologise Keith, I did a echo on the wrong string before (below is the correct error string)
echo $getBidderId = mysql_query("SELECT * FROM probid_bids WHERE auctionid='".$auctionDetails['id']."' AND out=0 AND invalid=0 ORDER BY id DESC");
and get the following:
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 'out FROM probid_bids WHERE id='1'' at line 1
INVALID QUERY: SELECT out FROM probid_bids WHERE id='1'
But it seems like the two errors at the top of the page I gave (main topic) is only half related as those errors are on different lines and are not related to this errors functions.
I'm sooooo confused right now but the above is whats going on for now...
One step at a time I guess.
Shaun
|
|
|
|
08-30-2007, 11:36 PM
|
Re: Going crazy, need help with phpprobid error
|
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
|
There is something that I'm not seeing, is it possible to post the entire code inside php code?
__________________
<mgraphic /> - I don't have a solution but I admire the problem.
|
|
|
|
08-31-2007, 01:44 AM
|
Re: Going crazy, need help with phpprobid error
|
Posts: 53
Name: Shaun
|
Hi mgraphic, Neller has been a great help and has offered to try and sort things out.
I've given him access to my site so hopefully things will work soon.
Thanks for all your help, if things still wont work I will reply for further help.
Thanks again guys,
Shaun
|
|
|
|
08-31-2007, 02:52 AM
|
Re: Going crazy, need help with phpprobid error
|
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
|
Cool! Hope you can trouble-shoot the problem!
__________________
<mgraphic /> - I don't have a solution but I admire the problem.
|
|
|
|
08-31-2007, 10:44 AM
|
Re: Going crazy, need help with phpprobid error
|
Posts: 13
Name: Alan Neller
Location: England
|
Sorted a couple of the problems but theres quite a few to be honest.. working my way through them.
Some are just silly things like not having '' in the database queries on the columns that are strings.
|
|
|
|
09-07-2007, 09:53 AM
|
Re: Going crazy, need help with phpprobid error
|
Posts: 1
|
hi
may I know how to fix this problem ?
thx
Regards Roslan
Last edited by roslan1984; 09-07-2007 at 09:54 AM..
|
|
|
|
02-07-2008, 10:09 PM
|
Re: Going crazy, need help with phpprobid error
|
Posts: 1
|
so i just registered on this site just so i can give my two cents on this problem. i have absolutely no php knowledge but i think i may have fixed this, or at least for me it works.
This is the original code:
Code:
if ($auctionDetails['maxbid']>0) {
echo " - ";
if ($auctionDetails['private']!="Y") {
$getBidderId=mysql_query("SELECT * FROM probid_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
What i did was remove this:
AND out=0 AND invalid=0 ORDER BY id DESC
from the code and now it works. I hope this helps anyone out there.
|
|
|
|
04-19-2008, 11:40 AM
|
Re: Going crazy, need help with phpprobid error
|
Posts: 1
Name: Stephen Jay
|
You will find this error on a lot of pages. It has to do with using the word "out" as a field name in a database. That word is a reserved word for MySQL.
http://dev.mysql.com/doc/refman/5.0/...ved-words.html
What I have been doing is putting double quotes around the field name to address this, so in your example you would do the following:
PHP Code:
$getBidderId=mysql_query("SELECT * FROM probid_bids WHERE auctionid='".$auctionDetails['id']."' AND \"out\"=0 AND invalid=0 ORDER BY id DESC");
You need to escape the double quotes, of course.
|
|
|
|
|
« Reply to Going crazy, need help with phpprobid error
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|