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 . "";
}
?>  

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.