Jump to content
MakeWebGames

Look at this please


? Sparks ?

Recommended Posts

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,'')

Link to comment
Share on other sites

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')");

Link to comment
Share on other sites

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')

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...