I keep getting this error and have spent forever to fix it:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/adminaa/public_html/admin/newsevents_update.php on line 28
Code:
<?php echo "<?xml version=\"1.0\" encoding=\"\"?".">"; ?>
<?php require_once('Connections/conn1.php');
// Check, if you clicked "Submit" button
if($_POST['Submit']){
// Get parameters from form.
$id=$_POST['id'];
$date=$_POST['date'];
$body=$_POST['body'];
$title=$_POST['title'];
// Do update statement.
mysql_query("update newsevents set title='$title', date='$date', body='$body' where id='$id'");
}
// ************* End update part *************
// *** Select data to show on text fields in form. ***
// Get id parameter (GET method) from select.php
$id=$_GET['id'];
// Get records in all columns from table where column id equal in $id and put it in $result.
$Recordset1 = mysql_query("select * from newsevents where id='$id'");
// Split records in $result by table rows and put them in $row.
$row = mysql_fetch_assoc($Recordset1);
// Close database connection.
mysql_close();
?>
I keep getting this error and have spent forever to fix it:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/adminaa/public_html/admin/newsevents_update.php on line 28
[CODE]
Oftentimes the cause of this error is that the query isn't returning any results. If you go to process the non-existent result then you get the "not a valid resource" error. Are you certain that your query is in fact returning one or more rows?