PHP MySQL - INSERT issue

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Black Majic
Forum Newbie
Posts: 6
Joined: Sat Apr 12, 2003 11:12 pm
Location: Etobicoke, ON, CA
Contact:

PHP MySQL - INSERT issue

Post by Black Majic »

I dont know why, but this code doesent insert any data into my db.
its probably somthing small. but i have no idea what it is.
also, when it runs through phpMyAdmin's sql page, it works fine.

Code: Select all

if($_POST["submit"])
			{
				$username = $auth->userdata["username"];
				$title = $_POST["title"];
				$content = $_POST["content"];
				$query = "INSERT INTO news (newsid, username, title, date, content, editdate) VALUES ('', '$username', '$title', UNIX_TIMESTAMP(), '$content', '0')";
				$db->query($query);
				echo "News posted successfully.";
				break;
			}
any help is appreciated.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

does this line definately equate to TRUE?

Code: Select all

if($_POST["submit"])
Mark
Black Majic
Forum Newbie
Posts: 6
Joined: Sat Apr 12, 2003 11:12 pm
Location: Etobicoke, ON, CA
Contact:

Post by Black Majic »

Thank you!

ugh, i forgot to add name="submit" on my submit button :x
Post Reply