Jump to content
MakeWebGames

Recommended Posts

Posted

Hello. Im having a problem with one of my MySQL querys, but I fail to understand where the error is!

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home3/mafianat/public_html/parse_comments.php on line 13

Line 13 = $Query = mysql_query("SELECT * FROM `comments` WHERE `userID` = ".$_GET['u']." ORDER BY `commentID` DESC LIMIT 5", $c);

To me, that query looks fine...

Can someone please assist me here?

 

Thanks!

Posted

are you sure $c is your connection and that it is open before trying to execute the query? A common error is to forget to include the PHP files which open the connections (like global.php for mccodes)

Posted

@ Dayo: Still same error :(

I am using V.2, and the only file that is being included is config.php. Globals is not needed in this file as its included in another file with globals.

Posted

I think config.php does not connect to the database in v2. take the include out and add a mysql_connect() should then work. you could also just use something more like the mysql.php file thats in lite/v1.

Posted

It's could be a bunch of things, either the table/column does not exist. OR The connection might be faulty - as mentioned before.

Try using your own parameters first, the basic "mysql_connect".

 

<?php

$c = mysql_connect(server, user, passwd):
mysql_selectdb('db', $c);

{... and then your query ...}

?>

 

Or just include the globals.php file.

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.   Paste as plain text instead

  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...