Jump to content

Warning: mysql_fetch_array() expects parameter 1 to be resource boolean given in


TottoBennington

Recommended Posts

HELP ME TO CHANGE THE ERROR

 

 

<?PHP

//Include connection to database

include('connect.php');

 

//Get posted values from form

$status=$_POST['status'];

$date=$_POST['date'];

 

//Strip slashes

$status = stripslashes($status);

$date = stripslashes($date);

 

//Strip tags

$status = strip_tags($status);

$date = strip_tags($date);

 

//Inset into database

 

$insert_status = mysql_query(" insert into status (status) value ('$status')") or die (mysql_error());

$insert_status = mysql_query("insert into status (date) value ('$date')") or die (mysql_error());

 

while($row = mysql_fetch_array($insert_status)) {  (ERROR IS IN THIS LINE)

$status=$row['status'];

$date=$row['date'];

}

 

 

//Line break after every 80

$status = wordwrap($status, 80, "\n", true);

 

//Line breaks

$status=nl2br($status);

 

//Display status from data base

echo '<div class="load_status">

<div class="status_img"><img src="blankSilhouette.png" /></div>

<div class="status_text"><a href="#" class="blue">Anonimo</a><p class="text">'.$status.'</p>

<div class="date">'.$date.' · <a href="#" class="light_blue">Like</a> · <a href="#"

class="light_blue">Comment</a></div>

</div>

<div class="clear"></div>

</div>';

?>

INSERT queries don't return result sets, so there's nothing to fetch.

 

What exactly are you trying to accomplish, because performing two INSERT queries on the same table for different columns does not make any sense.

//Inset into database

$insert_status = mysql_query(" insert into `status` (`status`, `date`) values ('$status', '$date')") or die (mysql_error());


//Line break after every 80
$status = wordwrap($status, 80, "\n", true);

is all you need, just make sure and use backticks around field and table names that you have used reserved words to name.

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.