Jump to content

[SOLVED] (Fatal error: Call to a member function query) Error please read


juelpatwary

Recommended Posts

Hi, On my game website i get this error

 

Fatal error: Call to a member function query() on a non-object in /home/bfp111/public_html/carmarket.php on line 31

 

And on line 31 it says this

$q=$db->query("SELECT cm.*, u.*,ct.* FROM carmarket cm LEFT JOIN users u ON u.userid=cm.cmADDER LEFT JOIN cars_types ct ON ct.carID=cm.cmCAR ORDER BY cmPRICE ASC",$c);

 

These are lines 25 to 35 (If needed)

function cmarket_index()

{

global $ir,$c,$userid,$h;

print "

Viewing all listings...

<table width=100% border=6> <tr style='background:#cc9966'> <th>Seller</th> <th>Car</th> <th>Acceleration Level</th> <th>Handling Level</th> <th>Speed Level</th> <th>Shield Level</th> <th>Price</th> <th>Links</th> </tr>";

$q=$db->query("SELECT cm.*, u.*,ct.* FROM carmarket cm LEFT JOIN users u ON u.userid=cm.cmADDER LEFT JOIN cars_types ct ON ct.carID=cm.cmCAR ORDER BY cmPRICE ASC",$c);

while($r=mysql_fetch_row($q))

{

if($r['cmADDER'] == $userid) { $link = "<a href='carmarket.php?action=remove&ID={$r['cmID']}'>Remove</a>"; } else { $link = "<a href='carmarket.php?action=buy&ID={$r['cmID']}'>Buy</a>"; }

print "\n<tr> <td><a href='viewuser.php?u={$r['userid']}'>{$r['username']}</a> [{$r['userid']}]</td> <td>{$r['carNAME']}</td> <td>{$r['cmACC']}</td> <td>{$r['cmHAN']}</td> <td>{$r['cmSPD']}</td> <td>{$r['cmSHD']} <td>\$".number_format($r['cmPRICE'])."</td> <td>[$link]</td> </tr>";

 

Anyway, I please hope you can help me, I just dont get the error

 

as i said, The error is this

Fatal error: Call to a member function query() on a non-object in /home/bfp111/public_html/carmarket.php on line 31

 

I hope all the lines you need are there :D Thanks

 

Regards

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.