Jump to content

[SOLVED] not a valid MySQL-Link resource


maxudaskin

Recommended Posts

What would Cause this error?

 

 

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/.grable/someurl/someurl.net/include/functions.php on line 10

 

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/.grable/someurl/someurl.net/include/functions.php on line 11

Link to comment
https://forums.phpfreaks.com/topic/60482-solved-not-a-valid-mysql-link-resource/
Share on other sites

The error is:

 

Error: with query

 

Do you have to be a n00b?

Post lines 8 - 15 from include/functions.php

Then maybe we can see what could be causing the error? ::)

 

Well, I think that is too much to ask :P

 

require ("dbconnect.php");

function login($username,$password){
$md5pass = md5($password);
$sql = "SELECT * FROM users WHERE pid = '{$username}'";
$sql2 = "SELECT * FROM users WHERE pass = '{$md5pass}'";
$query = mysql_query($con,$sql) or die("Error: ". mysql_error(). " with query ". $query);
$query2 = mysql_query($con,$sql2) or die("Error: ". mysql_error(). " with query ". $query2);
if (!$query || (mysql_numrows($result) < 1)){
return 1;
}
elseif(!$query2 || (mysql_numrows($result2) < 1)){
return 2;
}
else
{
return 0;
}
}

 

dbconnect.php

 

<?php
$hostname_LeadHost = "[removed]";
$database_LeadHost = "[removed]";
$username_LeadHost = "[removed]";
$password_LeadHost = "[removed]";
$con = mysql_pconnect($hostname_LeadHost, $username_LeadHost, $password_LeadHost) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db('[removed]', $con);
?>

Didn't you already start a thread about this very same problem?

 

edit: Yep -> http://www.phpfreaks.com/forums/index.php/topic,150151.msg647122.html

 

Your login function doesn't know what $con is, and your mysql_query() is not correct. You have to pass the sql query first, then the connection link.

 

edit2: ^^^ Like JayBachatero posted.

 

NO MATTER WHAT I DO OR WHAT I TRY, IT KEEPS TELLING ME THIS:

 

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/.grable/vzoom/virtualzoom.net/include/functions.php on line 13

 

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/.grable/vzoom/virtualzoom.net/include/functions.php on line 14

 

AND I AM ABOUT TO PULL MY

  • DARK BROWN
  • [PUT SWEARWORD HERE
  • GREYING FROM STRESS

HAIR BECAUSE I AM SO -- PISSED OFF WITH THIS SCRIPT.!!!

 

Edit

----------

 

Is there anything wrong with this?

$con = mysql_connect("mysql.blahblahblah.net", "admin","admin");
mysql_select_db("db", $con);
function login($username,$password){
   if(!get_magic_quotes_gpc()) {
$username = addslashes($username);
   }
$q = "select pid from users where pid = '$username'";
$q2 = "select pass from users where pid = '$username'";
$query = mysql_query($q,$con);
$query2 = mysql_query ($q2,$con);
if (!$query || (mysql_numrows($query) < 1)){
return 1;
}
elseif(!$query2 || (mysql_numrows($query2) < 1)){
return 2;
}
else
{
return 0;
}
}

Archived

This topic is now archived and is closed to further replies.

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