Bob wrote:
>Hi,
>I'm using UPDATE for the first time and can't get it working.
>If a do an update on it's own, it works but overwrites the record item.
>
>$msgid is a TIMESTAMP and there are a few other items,
>but I only want to add some text to the message item,
>so I read the record item first:
>
>$sql = "SELECT message FROM sleepdesk WHERE logged='$msgid' LIMIT 1";
>$result = mysql_query($sql);
>$row = mysql_fetch_row($result);
>$update = $row[0].$addition;
>
>/*
>Message is now in $update with additional text OK
>If I do an update now, it doesn't work?
>*/
>
>$sql = "UPDATE sleepdesk SET message='$update' WHERE logged='$msgid'";
>mysql_query($sql);
>
>Where have I gone wrong?
>Thanks, Bob E.
>
>
>
>Community email addresses:
> Post message: [email protected]
> Subscribe: [EMAIL PROTECTED]
> Unsubscribe: [EMAIL PROTECTED]
> List owner: [EMAIL PROTECTED]
>
>Shortcut URL to this page:
> http://groups.yahoo.com/group/php-list
>Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>
Try doing some error checking:
$sql = "UPDATE sleepdesk SET message='$update' WHERE logged='$msgid'";
$success=mysql_query($sql) or die mysql_error();
if ($success)
{echo"This should have worked";}
else
{echo"What does the error message say?";}
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/