Current location: Hot Scripts Forums » Programming Languages » PHP » quick help


quick help

Reply
  #1 (permalink)  
Old 10-09-08, 10:07 AM
CodeNameJeff CodeNameJeff is offline
New Member
 
Join Date: Oct 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
quick help

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();
?>
Reply With Quote
  #2 (permalink)  
Old 10-09-08, 02:14 PM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
Quote:
Originally Posted by CodeNameJeff View Post
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?
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to use quick reply? imagerage New Members & Introductions 1 08-01-05 06:49 AM
Quick ImageMagick problem fix jasong Job Offers & Assistance 1 11-24-04 10:52 AM
Web Designer Looking For Quick $20 Kevinnaia Job Offers & Assistance 0 08-16-04 07:41 PM
Easy, Quick Keyword (Quick Jump) dudeman248 Script Requests 1 08-11-03 01:20 AM


All times are GMT -5. The time now is 08:21 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.