Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Going crazy, need help with phpprobid error
Old 08-30-2007, 09:47 PM Going crazy, need help with phpprobid error
VirusDoctor's Avatar
Skilled Talker

Posts: 53
Name: Shaun
Trades: 0
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
VirusDoctor is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-30-2007, 09:49 PM Re: Going crazy, need help with phpprobid error
VirusDoctor's Avatar
Skilled Talker

Posts: 53
Name: Shaun
Trades: 0
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
VirusDoctor is offline
Reply With Quote
View Public Profile
 
Old 08-30-2007, 10:00 PM Re: Going crazy, need help with phpprobid error
Neller's Avatar
Novice Talker

Posts: 13
Name: Alan Neller
Location: England
Trades: 0
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
Neller is offline
Reply With Quote
View Public Profile Visit Neller's homepage!
 
Old 08-30-2007, 10:03 PM Re: Going crazy, need help with phpprobid error
Neller's Avatar
Novice Talker

Posts: 13
Name: Alan Neller
Location: England
Trades: 0
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
Neller is offline
Reply With Quote
View Public Profile Visit Neller's homepage!
 
Old 08-30-2007, 10:20 PM Re: Going crazy, need help with phpprobid error
VirusDoctor's Avatar
Skilled Talker

Posts: 53
Name: Shaun
Trades: 0
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
VirusDoctor is offline
Reply With Quote
View Public Profile
 
Old 08-30-2007, 10:33 PM Re: Going crazy, need help with phpprobid error
VirusDoctor's Avatar
Skilled Talker

Posts: 53
Name: Shaun
Trades: 0
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
VirusDoctor is offline
Reply With Quote
View Public Profile
 
Old 08-30-2007, 10:36 PM Re: Going crazy, need help with phpprobid error
VirusDoctor's Avatar
Skilled Talker

Posts: 53
Name: Shaun
Trades: 0
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?
VirusDoctor is offline
Reply With Quote
View Public Profile
 
Old 08-30-2007, 10:46 PM Re: Going crazy, need help with phpprobid error
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
Trades: 0
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.
mgraphic is online now
Reply With Quote
View Public Profile
 
Old 08-30-2007, 10:56 PM Re: Going crazy, need help with phpprobid error
VirusDoctor's Avatar
Skilled Talker

Posts: 53
Name: Shaun
Trades: 0
Hi mgraphic, drop the quotes but still receiving the same errors bro.

Any more ideas?
VirusDoctor is offline
Reply With Quote
View Public Profile
 
Old 08-30-2007, 11:03 PM Re: Going crazy, need help with phpprobid error
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
Trades: 0
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.
mgraphic is online now
Reply With Quote
View Public Profile
 
Old 08-30-2007, 11:09 PM Re: Going crazy, need help with phpprobid error
VirusDoctor's Avatar
Skilled Talker

Posts: 53
Name: Shaun
Trades: 0
I did a echo on

echo $bidderName = getSqlField("SELECT username FROM probid_users WHERE id='".$highBidder['bidderid']."'","username");

and still get the same error
VirusDoctor is offline
Reply With Quote
View Public Profile
 
Old 08-30-2007, 11:17 PM Re: Going crazy, need help with phpprobid error
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
Trades: 0
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.
mgraphic is online now
Reply With Quote
View Public Profile
 
Old 08-30-2007, 11:32 PM Re: Going crazy, need help with phpprobid error
VirusDoctor's Avatar
Skilled Talker

Posts: 53
Name: Shaun
Trades: 0
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
VirusDoctor is offline
Reply With Quote
View Public Profile
 
Old 08-30-2007, 11:36 PM Re: Going crazy, need help with phpprobid error
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
Trades: 0
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.
mgraphic is online now
Reply With Quote
View Public Profile
 
Old 08-31-2007, 01:44 AM Re: Going crazy, need help with phpprobid error
VirusDoctor's Avatar
Skilled Talker

Posts: 53
Name: Shaun
Trades: 0
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
VirusDoctor is offline
Reply With Quote
View Public Profile
 
Old 08-31-2007, 02:52 AM Re: Going crazy, need help with phpprobid error
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
Trades: 0
Cool! Hope you can trouble-shoot the problem!
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is online now
Reply With Quote
View Public Profile
 
Old 08-31-2007, 10:44 AM Re: Going crazy, need help with phpprobid error
Neller's Avatar
Novice Talker

Posts: 13
Name: Alan Neller
Location: England
Trades: 0
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.
Neller is offline
Reply With Quote
View Public Profile Visit Neller's homepage!
 
Old 09-07-2007, 09:53 AM Re: Going crazy, need help with phpprobid error
Junior Talker

Posts: 1
Trades: 0
hi

may I know how to fix this problem ?

thx

Regards Roslan

Last edited by roslan1984; 09-07-2007 at 09:54 AM..
roslan1984 is offline
Reply With Quote
View Public Profile
 
Old 02-07-2008, 10:09 PM Re: Going crazy, need help with phpprobid error
Junior Talker

Posts: 1
Trades: 0
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.
hallowseve is offline
Reply With Quote
View Public Profile
 
Old 04-19-2008, 11:40 AM Re: Going crazy, need help with phpprobid error
Junior Talker

Posts: 1
Name: Stephen Jay
Trades: 0
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.
sjay is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Going crazy, need help with phpprobid error
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.46638 seconds with 12 queries