PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
birdie
Forum Newbie
Posts: 22 Joined: Thu Sep 15, 2005 4:37 pm
Post
by birdie » Sun Oct 09, 2005 4:58 pm
ive made this script and it just dont know why it doesnt work.. it should.
Code: Select all
<?
$commenttextposter == "test";
$commenttext == "test script 23";
mysql_connect("localhost","root","password");
mysql_select_db("dave");
mysql_query("INSERT INTO comments (commenttextposter, commenttext) VALUES ('$commenttextposter', '$commenttext')");
mysql_close();
echo "Comment added";
?>
any ideas at all? thanks
ps. it might be because $commenttext has spaces in it
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sun Oct 09, 2005 5:08 pm
it's because you used == instead of =.
= is assignment
== is checking equality
=== is checking equality and type match
birdie
Forum Newbie
Posts: 22 Joined: Thu Sep 15, 2005 4:37 pm
Post
by birdie » Sun Oct 09, 2005 5:12 pm
wow youve made my day
. thanks