Geekgirl,
Let me expand on the answers so far...
There are two things you can do here: add a new record or update an
existing one. In SQL this makes a big difference and in your
question you've confused the two (MySQL has a trick which kind of
mixes the two and it is limited). I'm not ex
How about:
$review = $_POST['review'];
$sql = "SELECT * FROM reviews WHERE review_id = '$id'";
$res = mysql_query($sql) or die ("Query failed: " . mysql_error());
if (mysql_num_rows($res) > 0)
{
$sql_upd = "UPDATE reviews
SET review_text = '$review'
In full agreement here. I scratched my head this morning, then looked up
"INSERT" in the MySQL Docs for a sanity check. It must be an UPDATE
statement to work as indicated below.
David
<< Sorry David Mitchell >>
==
Is that
Is that a syntax supported by MySQL? That is, an INSERT with WHERE clause?
I tried it against Oracle, and it doesn't work (can you imagine how
upsetting it would have been to have learned that, after having worked with
SQL for several years, one can do an update using an INSERT statement?).
I'm pr
geekgirl1 wrote:
First time poster.
This is the problem. I want to add the value of $_POST[review] to the
reviews table where the unique id from the reviews table equals the
review id on my form. The statement below does not work. Should I
use UPDATE instead?
"INSERT INTO reviews (review