hello
im new to this forum, i hope someone could help me on this...
i have a problem on updating a database...
my code is
mysql_query("UPDATE test_table SET subscribe = ' ', unsubscribe = 'True' WHERE email = '$email'");
the problem is on the records on the email column, if the record is test@test.com the email won't compare with $email (where $email has a value of test@test.com), it doesn't update the subscribe or unsubscribe column
but if the record on my email column is test and the value of $email is test it updates my database...
can anyone help on this?
PHP mysql problem
Moderator: General Moderators
-
thecodewall
- Forum Commoner
- Posts: 33
- Joined: Sun Dec 26, 2010 8:37 am
Re: PHP mysql problem
I try to create your table but there's a problem in naming field to subscribe , I think you need to check it.
codewall.blogspot.com
codewall.blogspot.com
Re: PHP mysql problem
i left subscribe to be blank because the record on it on the database is true,
my code is when the email and $mail matches the record on subscribe would be blank and the unsubcribe will have a record of true...
my problem is when the record is something like "test@test.com" the query won't work but if the record is something like "test" the query works...
my code is when the email and $mail matches the record on subscribe would be blank and the unsubcribe will have a record of true...
my problem is when the record is something like "test@test.com" the query won't work but if the record is something like "test" the query works...
Re: PHP mysql problem
here is my code
---------------- this one doesn't work
--------------- this one works
---------------- this one doesn't work
Code: Select all
<?php
$email = 'test@test.com';
$connect = mysql_connect("localhost","root","123456");
$conToDB = mysql_select_db("test_database",$connect);
$result = mysql_query("SELECT * FROM test_database");
mysql_query("UPDATE test_table SET subscribe = '', unsubscribe = 'True' WHERE email = '$email'");
?>--------------- this one works
Code: Select all
<?php
$email = 'test';
$connect = mysql_connect("localhost","root","123456");
$conToDB = mysql_select_db("test_database",$connect);
$result = mysql_query("SELECT * FROM test_database");
mysql_query("UPDATE test_table SET subscribe = '', unsubscribe = 'True' WHERE email = '$email'");
?>
Last edited by Benjamin on Mon Jan 10, 2011 1:31 am, edited 1 time in total.
Reason: Added [syntax=php] tags.
Reason: Added [syntax=php] tags.