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>';

?>

Link to comment
Share on other sites

//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.

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.