I need help coding a few sql statements in php. I made a statement to insert data into a database but its not working.
Heres the statement I made.
$query = mysql_query("Insert Into messages ('to', 'from', 'date', 'message', 'subject', 'type') VALUES ('$to', '$username', '$curdate', '$message', '$subject', '$type') ", $db);
Can some body tell me what I did wrong and post here what the correct statement should be for both statements I posted here?
The other statement I made is suppost to count how many messages a user has in the database for them. Theres 2 statements I need help on.
$result = mysql_query("SELECT count(*) FROM messages WHERE to = '$username' OR to = 'Everybody' ",$db)
$result = mysql_query("SELECT count(*) FROM messages WHERE to = '$username' OR to = 'Everybody' AND type = 'New' ",$db);
Any help will be gladly appreciated. Thanks for you help in advance.