Jump to content

[SOLVED] "Supplied argument is not a valid MySQL result resource"


Cory94bailly

Recommended Posts

Error I'm getting:

 

<b>Warning</b>:  mysql_fetch_array() [<a href='function.mysql-fetch-array'>function.mysql-fetch-array</a>]: The result type should be either MYSQL_NUM, MYSQL_ASSOC or MYSQL_BOTH. in <b>/home/content/m/a/r/markbailly/html/fcs/includes/loggedin.php</b> on line <b>15</b><br />
<br />
<b>Warning</b>:  mysql_fetch_array(): supplied argument is not a valid MySQL result resource in <b>/home/content/m/a/r/markbailly/html/fcs/includes/loggedin.php</b> on line <b>15</b><br />

 

 

Whole php code:

 

<?
if(isset($_COOKIE['ID_fcs_member']))
{
//Connect to Members DB
mysql_connect('***', '***', '***) or die(mysql_error());
mysql_select_db('***') or die(mysql_error());

//Look for the cookies
$username1 = $_COOKIE['ID_fcs_member'];
$pass1 = $_COOKIE['Key_fcs_member'];
$username2 = $_COOKIE['ID_fcs_team'];
$pass2 = $_COOKIE['Key_fcs_team'];
$check1 = mysql_query("SELECT * FROM members WHERE username = '$username1'")or die(mysql_error());
$check2 = mysql_query("SELECT * FROM team WHERE username = '$username2'")or die(mysql_error());
while(mysql_fetch_array($check1, $check2))
{
//If the cookie exists, show the "Logout" button.
{
?>
<a href="logout.php">Logout</a>
<?
}
}
}
else

//If the cookie does not exist, show the "Login" button.
{
?>
<a href="login.php">Login</a>
<img src="images/splitter.gif" class="splitter" alt="" />
<a href="register.php">Register</a>
<?
}
?>

 

 

Line 15:

 

while(mysql_fetch_array($check1, $check2))

Link to comment
Share on other sites

if (mysql_numrows($check1) > 0) { // a record was found with the first query

} else if (mysql_numrows($check2) > 0) { // a record was found with the first query

}

 

personally, i'd run the first query, see if there are any records, then run the second query. no need to do both unless you need to do it that way.

Link to comment
Share on other sites

if (mysql_numrows($check1) > 0) { // a record was found with the first query

} else if (mysql_numrows($check2) > 0) { // a record was found with the first query

}

 

personally, i'd run the first query, see if there are any records, then run the second query. no need to do both unless you need to do it that way.

 

I now get this:

 

<b>Parse error</b>:  syntax error, unexpected $end in <b>/home/content/m/a/r/markbailly/html/fcs/includes/loggedin.php</b> on line <b>38</b><br />

 

My full code:

 

<?
if(isset($_COOKIE['ID_fcs_member']))
{
//Connect to Members DB
mysql_connect('***', '***', '***') or die(mysql_error());
mysql_select_db('***') or die(mysql_error());

//Look for the cookies
$username1 = $_COOKIE['ID_fcs_member'];
$pass1 = $_COOKIE['Key_fcs_member'];
$username2 = $_COOKIE['ID_fcs_team'];
$pass2 = $_COOKIE['Key_fcs_team'];
$check1 = mysql_query("SELECT * FROM members WHERE username = '$username1'")or die(mysql_error());
$check2 = mysql_query("SELECT * FROM team WHERE username = '$username2'")or die(mysql_error());
if (mysql_numrows($check1) > 0) { // a record was found with the first query

} else if (mysql_numrows($check2) > 0) { // a record was found with the first query

{
//If the cookie exists, show the "Logout" button.
{
?>
<a href="logout.php">Logout</a>
<?
}
}
}
else

//If the cookie does not exist, show the "Login" button.
{
?>
<a href="login.php">Login</a>
<img src="images/splitter.gif" class="splitter" alt="" />
<a href="register.php">Register</a>
<?
}
?>

 

Line 38:

 

?>

Link to comment
Share on other sites

Wherever you want the IF statement to stop, lmfao.

 

Well.. I'm not good at php so I didn't know..........

 

 

Here's my script now:

 

<?
if(isset($_COOKIE['ID_fcs_member']))
{
//Connect to Members DB
mysql_connect('p41mysql145.secureserver.net', 'cory_fcs', 'Sils1234') or die(mysql_error());
mysql_select_db('cory_fcs') or die(mysql_error());

//Look for the cookies
$username1 = $_COOKIE['ID_fcs_member'];
$pass1 = $_COOKIE['Key_fcs_member'];
$username2 = $_COOKIE['ID_fcs_team'];
$pass2 = $_COOKIE['Key_fcs_team'];
$check1 = mysql_query("SELECT * FROM members WHERE username = '$username1'")or die(mysql_error());
$check2 = mysql_query("SELECT * FROM team WHERE username = '$username2'")or die(mysql_error());
if (mysql_numrows($check1) > 0) { // a record was found with the first query

} else if (mysql_numrows($check2) > 0) { // a record was found with the first query

{
//If the cookie exists, show the "Logout" button.
{
?>
<a href="logout.php">Logout</a>
<?
}
}
}
}
else

//If the cookie does not exist, show the "Login" button.
{
?>
<a href="login.php">Login</a>
<img src="images/splitter.gif" class="splitter" alt="" />
<a href="register.php">Register</a>
<?
}
?>

 

I am getting no actual "errors"..

 

But when I am logged out, it works.. if you log in, it just shows nothing.

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.