[SOLVED] MySQL query help

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

Post Reply
mrbirtch
Forum Newbie
Posts: 3
Joined: Thu Feb 03, 2005 10:39 am

[SOLVED] MySQL query help

Post by mrbirtch »

Hello,

i am new to PHP MySQL and am having difficulty with one particular query. My code is below:

the $connector is an object and it works fine for every other query I've tried. Is there a problem with the query that I am not seeing?

Code: Select all

$insertQuery = "INSERT INTO documents (pageTitle, headline, intro, subhead, body, category) VALUES ('".$headline."','".$intro."','".$subhead."','".$body."','".$category."')";
	//Save the form into the database
	if ($result = $connector->query($insertQuery)){
		//It worked, give confirmation
		echo '<center>Article added to the database</center><br>';
	&#125; else &#123;
		echo "<center>Sorry, there was an error saving to the database<br><a href='new.php'>Back to Form</a></center><br>";
	&#125;
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

you are inserting only 5 values into 6 columns?
mrbirtch
Forum Newbie
Posts: 3
Joined: Thu Feb 03, 2005 10:39 am

Post by mrbirtch »

Wow, that was simple...I hate missing stupid mistakes. Thankyou timvw
Post Reply