Hi there guys,
I'm trying to create a script that will edit user input, and I'm using the following when the edit page comes up:
$id=($_GET['id']);
$query = "SELECT * " .
"DATE_FORMAT(postdate, '%M %D, %Y') as date " .
"FROM testimonials WHERE id=$id";
$result = mysql_query ($query);
while ($row = mysql_fetch_assoc ($result)) { <~~line 30
$date = $row['date'];
$author = stripslashes ($row['author']);
$author_email = stripslashes ($row['author_email']);
$authorweb = stripslashes ($row['authorweb']);
$authorwebname = stripslashes ($row['authorwebname']);
$title = stripslashes ($row['title']);
$testtext = stripslashes ($row['testtext']);
which nets me this error:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /my/path/to/edit.php on line 30
I've noted line 30 in the block of code above.
I'm using the same mysql call on another page, except instead of getting *, on the other page, I'm only grabbing a few values.
[EDIT] When clicking the link to edit.php, I can see that $id is getting a value placed in the URL.[/EDIT]
What would cause this problem?
thanks,
json