mysql not sending

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
User avatar
paqman
Forum Contributor
Posts: 125
Joined: Sun Nov 14, 2004 7:41 pm
Location: Burnaby, BC, Canada

mysql not sending

Post by paqman »

This code isn't sending the data to the table, but no error shows and it still echo's.

Code: Select all

if($cmd == "submit") {

$title = $_POST["title"];
$system = $_POST["system"];
$subsystem = $_POST["subsystem"];
$username = $_POST["username"];
$image = $_POST["image"];
$ext = $_POST["ext"];
$link = $_POST["link"];
$rate1 = $_POST["rate1"];
$rate2 = $_POST["rate2"];
$rate3 = $_POST["rate3"];
$rate4 = $_POST["rate4"];
$rating1 = $_POST["rating1"];
$rating2 = $_POST["rating2"];
$rating3 = $_POST["rating3"];
$rating4 = $_POST["rating4"];
$comment1 = $_POST["comment1"];
$comment2 = $_POST["comment2"];
$comment3 = $_POST["comment3"];
$comment4 = $_POST["comment4"];
$finalcomment = $_POST["finalcomment"];

$submittodatabase=MYSQL_QUERY("INSERT INTO review (id,title,subsystem,username,image,ext,link,rate1,rate2,rate3,rate4,rating1,rating2,rating3,rating4,comment1,comment2,comment3,comment4,finalcomment)".
"VALUES ('NULL', '$title', '$system', '$subsystem', '$username', '$image', '$ext', '$link', '$rate1', '$rate2', '$rate3', '$rate4', '$rating1', '$rating2', '$rating3', '$rating4', '$comment1', '$comment2', '$comment3', '$comment4', '$finalcomment')");

echo "Thank you $c_name for submitting a review. To view it, <a href=\"index.php?id=reviews&cmd=view&title=$title&subsystem=$subsystem\">Click Here</a>.";

}
Did I type something in wrong? Thanks!!!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

no error shows because you aren't detecting for errors to happen:

Code: Select all

$query = mysql_query($sql) or die(mysql_error());
User avatar
paqman
Forum Contributor
Posts: 125
Joined: Sun Nov 14, 2004 7:41 pm
Location: Burnaby, BC, Canada

Post by paqman »

Column count doesn't match value count at row 1
User avatar
paqman
Forum Contributor
Posts: 125
Joined: Sun Nov 14, 2004 7:41 pm
Location: Burnaby, BC, Canada

Post by paqman »

sorry i just figured it out, don't bother replying. I missed 'system' in the first part. thanks for the help
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you don't have a matching column name for $system
Post Reply