Jump to content

Archived

This topic is now archived and is closed to further replies.

viperfunk

update problem

Recommended Posts

My update statement isn't returning an error, but is also not updating. Is there some flaw in my php? Here is the code:

<?php

if ($edit_record == 1)
{

$db->execute("UPDATE NEWS SET (p_title = ?, p_date = ?, p_body = ?, p_author = ?) WHERE p_id = ?", Array($title, $date, $body, $author, $id));

echo "<meta http-equiv='refresh' content='0' URL='http://MYURL/admin.php'>";
}
echo "<input type='hidden' name='edit_record' value='1'>";
echo "$row[0]";
echo "<input type='hidden' name='id' value=\"$row[0]\">";
echo "<input type='text' name='title' value=\"$row[1]\"><br>";
echo "<input type='text' name='date' value=\"$row[2]\"><br>";
echo "<textarea name='body' cols=50 rows=8>$row[3]</textarea><br>";
echo "<input type='text' name='author' value=\"$row[4]\"><br>";
echo "<input type='submit' value='edit'>";
echo "</form></td></tr>";
echo "<tr><td><hr size=2 width=800></td></tr>";
}
echo "</table>";

?>


Cheers

Share this post


Link to post
Share on other sites
Try:
Update `table` SET row1 = `$value1`, row2 = `$value2` WHERE somerow = `$somevalue`
Or with the full PHP
$_q = "UPDATE $tablename SET $row = '$value', $row2 = '$value2' WHERE $somerow = '$somevalue'";

Share this post


Link to post
Share on other sites
Tried both of those solutions, still no error and no updating occurs.

any other suggestions?

Share this post


Link to post
Share on other sites

×

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.