Jump to content

Getting an error supplied argument is not a valid MySQL result resource


Collegeboox

Recommended Posts

This is the full error...Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in

 

This is what I am trying to do...

    1. get data from the page before which it gets fine in the $_GET function...

    2. then set the sersion[username] to $username...(I think I am doing something wrong there)

    3. then if the $username doesnt match the username pulled from the database (according to the $_GET info) then open a different databse and update a value in that table.

    4. then kill the code die ();

 

someone please help I have been trying to figure this out all day

 

 

 

<?php

$username = $_SESSION['username'];		
$deleted = $_GET['deleted'];

	// Connect to MySQL
	$connect = mysql_connect("db","user","pass") or die("Not connected");
	mysql_select_db("dv") or die("could not log in");

// grab the information according to the isbn number
$query = "SELECT * FROM 'boox' WHERE isbn='$deleted'";
$result = mysql_query($query);
while($row = mysql_fetch_array($result))
{

if 	($username==$row['username'])
{	
	echo"Welcome, ".$_SESSION['username']."";
	// Delete entry where isbn number matches accordingly
	mysql_query("DELETE * FROM 'boox' WHERE isbn='$deleted'");  
}
elseif ($username!=$row['username'])

{
	$username = $_SESSION['username'];

	$connect = mysql_connect("db","user","pass") or die("Not connected");
	mysql_select_db("db") or die("could not log in");

	// run a query to deactivete a account
	$acti = mysql_query("UPDATE 'desiredusers' SET activated='2' WHERE username='$username'");
	$byebye = "SELECT * FROM 'desiredusers' WHERE isbn='$deleted'";
	$results = mysql_query($byebye);
	while($row2 = mysql_fetch_array($results))
	echo "here".$username."here";
	die("Your account is deactivated contact College Boox Store to get your account back.");
}
else
	echo "there is nothing being checked" . $username . "";
}
?>  

Your query is failing. You need to see what the MySQL error is. Change the line that runs the query so you can see the error

$result = mysql_query($query) or die(mysql_error()."<br />\nQuery:{$query}");

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.