Jump to content


Photo

update problem


  • Please log in to reply
2 replies to this topic

#1 viperfunk

viperfunk
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 21 June 2006 - 06:48 PM

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

#2 Buyocat

Buyocat
  • Members
  • PipPipPip
  • Advanced Member
  • 267 posts

Posted 21 June 2006 - 07:08 PM

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'";
Looking for some easy-to-use tools?  Try these, https://sourceforge....jects/utils-php -- I made them myself.  They're distinct tools which are easy to understand and use.  See some examples uses at http://www.anotherearlymorning.com

#3 viperfunk

viperfunk
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 21 June 2006 - 08:33 PM

Tried both of those solutions, still no error and no updating occurs.

any other suggestions?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users