? Sparks ? Posted June 20, 2009 Share Posted June 20, 2009 Ok so I got the gangs file, But I need help with a query error. Here Is the file <?php include "globals.php"; if($ir['money'] < 5000000) { die("You don't have enough money. You need \$5,000,000."); } if($ir['gang']) { die ("You're already in a gang!"); } if($_POST['submit']) { $name=htmlspecialchars($_POST['name']); $desc=htmlspecialchars($_POST['desc']); $db->query("INSERT INTO gangs VALUES('','$name','$desc','','',0,0,100,$userid,$userid,5,0,0,'')"); $i=$db->insert_id(); $db->query("UPDATE users SET gang=$i,money=money-5000000 where userid=$userid"); print "Gang created!"; } else { print "<h3> Create A Gang </h3><form action='creategang.php' method='post'><input type='hidden' name='submit' value='1' />Name:<input type='text' name='name' /> Description: <textarea name='desc' cols='40' rows='7'></textarea> <input type='submit' value='Create Gang for \$500,000' /></form>"; } $h->endpage(); ?> And here Is the error QUERY ERROR: Column count doesn't match value count at row 1 Query was INSERT INTO gangs VALUES('','Druggie Drunk Veterans','Welcome','','',0,0,100,6,6,5,0,0,'') Quote Link to comment Share on other sites More sharing options...
jon182 Posted June 20, 2009 Share Posted June 20, 2009 Re: Look at this please your doing ("INSERT INTO gangs VALUES('','Druggie Drunk Veterans','Welcome','','',0,0,100,6,6,5,0,0,'') it should be ("INSERT INTO gangs (blah, blah, blah, blah) VALUES ('blah', 'blah', 'blah', 'blah')") Quote Link to comment Share on other sites More sharing options...
? Sparks ? Posted June 20, 2009 Author Share Posted June 20, 2009 Re: Look at this please LOL is this suppose to be a joke Quote Link to comment Share on other sites More sharing options...
MrGi Posted June 20, 2009 Share Posted June 20, 2009 Re: Look at this please $db->query("INSERT INTO gangs VALUES('','$name','$desc','','',0,0,100,$userid,$userid,5,0,0,'')"); Should be: $db->query ("INSERT INTO gangs ('$name' , ' $desc' , '', '' ,'$userid' , '$userid')VALUES('0' , '0' , '100' , '5' , '0' , '0')"); Quote Link to comment Share on other sites More sharing options...
? Sparks ? Posted June 20, 2009 Author Share Posted June 20, 2009 Re: Look at this please QUERY ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''Druggie Drunk Veterans' , ' :P' , '', '' ,'6' , '6')VALUES('0' , '0' , '100' , ' at line 1 Query was INSERT INTO gangs ('Druggie Drunk Veterans' , ' :P' , '', '' ,'6' , '6')VALUES('0' , '0' , '100' , '5' , '0' , '0') Quote Link to comment Share on other sites More sharing options...
SouIAssassin Posted June 20, 2009 Share Posted June 20, 2009 Re: Look at this please hey m8 you need to look at your gangs table in your database and you have o have the say number of feilds as like your insret into lnto I.E if you have 15 like mine then it has to be $db->query("INSERT INTO gangs VALUES('','$name','$desc','','',0,0,100,$userid,$userid,5,0,0,'',0)"); in order it is the gangid gang name gang desc gang perf gang suff gang money gang crystals gang president gang vice president gang capacity gang crime gang chours gang ament gang amoury if you don't have a gang amoury just take the ,0 from the end of the query so it would now be. $db->query("INSERT INTO gangs VALUES('','$name','$desc','','',0,0,100,$userid,$userid,5,0,0,'')"); the '' inside the vaules are ' ' not " hope that helps Quote Link to comment Share on other sites More sharing options...
? Sparks ? Posted June 20, 2009 Author Share Posted June 20, 2009 Re: Look at this please Query was INSERT INTO gangs VALUES('','Druggie Drunk Veterans','h','','',0,0,100,6,6,5,0,0,'') I will check the order right now Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.