Re: Update does not work...but no errors either

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, May 31, 2008 at 4:23 AM, Ryan S <genphp@xxxxxxxxx> wrote:
>
>
>  Hey,
>
> This is my code:
> ==============================================================
> $update_sql="update greetings_final set heading='$heading',message='$message',signature='$signature',font_size='$font_size',font_color='$font_color',bg_color='$bg_color' where  temp_cno='".$thecno."' and rand_string='".$randreference."' LIMIT 5";
> echo $update_sql."<br><br>";
>        $result2 = mysql_query($update_sql);
>        if(mysql_affected_rows()==0){echo "Error R093d: unable to update greeting";exit;}
> ==============================================================

    Try this:

<?php

// Shorten sanity for this email.
function m($data) {
    $data = mysql_real_escape_string($data);
    return $data;
}

$update_sql  = "UPDATE greetings_final SET heading='".m($heading)."',";
$update_sql .= "message='".m($message)."',signature='".m($signature)."',";
$update_sql .= "font_size='".m($font_size)."',font_color='".m($font_color)."',";
$update_sql .= "bg_color='".m($bg_color)."' WHERE temp_cno='".m($thecno)."' ";
$update_sql .= "AND rand_string='".m($randreference)."' LIMIT 5";

$result2 = mysql_query($update_sql) or die(mysql_error());

?>

-- 
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux