Re: UPDATE and redirect

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

 



marcelo Wolfgang wrote:
Hi all,

I'm new to this list and new to php programming so sorry if I do something wrong here :)

Ok, now to my problem.

I've created a query to update a mysql db, and it isn't working, and it's not throwing me any errors, so I need some help to figure out what's wrong here. My code follows :

<?
if($_GET['act'] = 'a'){
    $action = 1;
} else if ($_GET['act'] = 'd'){
    $action = 0;
}
$id = $_GET['id'];

mysql_connect("localhost","XXXX","XXXX") or die (mysql_error());
mysql_select_db ("taiomara_emailList");
$email_Query = mysql_query("UPDATE 'tb_emails' SET 'bol_active' = $action WHERE `auto_id` = $id");
I think you want to use back ticks for the table and column names, not single quotes. (On my keyboard this is to the left of the '1' key) Another good idea when having query problems is to put the query into its own variable and echo it out..
like:
$sql = "UPDATE `tb_emails` SET `bol_active` = $action WHERE `auto_id` = $id";
echo "$sql<br/>\n";


mysql_close();
?>

The page is executed, but it don't update the table ... I've tried with the '' and without it ( the phpmyadmin page is where I got the idea of using the '' ). Any clues ?

Also, how can I make a redirect after the query has run ?

TIA
Marcelo Wolfgang


--
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