PDA

Click to See Complete Forum and Search --> : why does this not work


kiwis
May 9th, 2004, 07:44 PM
<?php
mysql_connect (localhost, user, pass);
mysql_select_db (nz);
?>

<?php
if ($action == "save")
{
$result = mysql_query ("UPDATE DB_Stats_Update Values ('$details')");
?>

<p>


<hr>


<strong><font size="2">THANK YOU<br>
</font>


<?php
} else {
?>

<hr>
<?php
$result = mysql_query ("SELECT details from DB_Stats_Update");
$row = mysql_fetch_array($result);
$details = $row["details"];
?>


<hr>



<form method="POST" action="index.php?action=save">
<textarea rows="5" name="details" cols="34"><?php echo $details; ?>
</textarea>
<br>
<input type="submit" value="save" name="B1"></p>
</form>

<?php

}


?></font>

any ideas??

kows
May 9th, 2004, 08:56 PM
what errors do you get?

edit: your MySQL query where you're updating something is wrong.. it should be something like:
UPDATE table SET field='value' WHERE conditions='true'

kiwis
May 9th, 2004, 09:02 PM
Originally posted by kows
what errors do you get?

edit: your MySQL query where you're updating something is wrong.. it should be something like:
UPDATE table SET field='value' WHERE conditions='true'

Ok I get it to display fine but not to update!! a text box does not use a "value"

kows
May 9th, 2004, 10:23 PM
from what you first posted, the new value you want to have is "$details".. you just have to specify what field you are updating, and change 'field' in my code to that.

oh, and by the way, a textbox does have a value.. a textbox's value is whatever the user enters into it.