Jump to content
MakeWebGames

Error creating gangs


Monkey644

Recommended Posts

Hey everyone, got wonderful query for you all.

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 'apples','mangos','','',0,0,100,1,1,5,0,0,'','','')', '/creategang.php', unix_tim' at line 2

 

My lovely bit of codes thats in creategang.php:

 

<?phpinclude "globals.php";if($ir['money'] < 500000){die("You don't have enough money. You need \$500,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-500000 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();?>

 

 

Just the bog standard mccodes coding, can anyone help me on this fine evening?

Link to comment
Share on other sites

Replace your $db->query with this one

$db->query("INSERT INTO gangs VALUES('','$name','$desc','','',0,0,100,$userid,$userid,5,0,0,'')");

or

just copy and paste this

 

<?php
include "globals.php";

if($ir['money'] < 500000){die("You don't have enough money. You need \$500,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-500000 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();
?>
Link to comment
Share on other sites

Coming up with a syntex error now.

 

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 'a','sfgsgf','','',0,0,100,1,1,5,0,0,'')', '/creategang.php', unix_timestamp())' at line 2

Link to comment
Share on other sites

[mysql]-- phpMyAdmin SQL Dump-- version 3.2.4-- http://www.phpmyadmin.net---- Host: localhost-- Generation Time: Jul 13, 2010 at 04:42 PM-- Server version: 5.0.90-- PHP Version: 5.2.9

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;/*!40101 SET NAMES utf8 */;

---- Database: `deadlyc1_Users`--

-- --------------------------------------------------------

---- Table structure for table `gangs`--

CREATE TABLE IF NOT EXISTS `gangs` ( `gangID` int(11) NOT NULL auto_increment, `gangNAME` varchar(255) NOT NULL default '', `gangDESC` text NOT NULL, `gangPREF` varchar(12) NOT NULL default '', `gangSUFF` varchar(12) NOT NULL default '', `gangMONEY` bigint(65) NOT NULL default '0', `gangCRYSTALS` bigint(65) NOT NULL default '0', `gangRESPECT` int(11) NOT NULL default '0', `gangPRESIDENT` int(11) NOT NULL default '0', `gangVICEPRES` int(11) NOT NULL default '0', `gangCAPACITY` int(11) NOT NULL default '0', `gangCRIME` int(11) NOT NULL default '0', `gangCHOURS` int(11) NOT NULL default '0', `gangAMENT` longtext NOT NULL, `gangSIG` varchar(255) NOT NULL, `gangSIG2` varchar(255) NOT NULL, `gangSTATUS` text NOT NULL, PRIMARY KEY (`gangID`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=27 ;[/mysql]

As requested. :)

Link to comment
Share on other sites

Still getting:

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 'xvsdfg','dfgsg','','',0,0,100,1,1,5,0,0,'','','')', '/creategang.php', unix_time' at line 2

 

This is starting to annoy me now... :)

Link to comment
Share on other sites

As requested :)

 

 

 

<?php
include "globals.php";
if($ir['money'] < 500000){die("You don't have enough money. You need \$500,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-500000 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();
?>
Link to comment
Share on other sites

Try this:

<?php
include "globals.php";
if($ir['money'] < 500000){die("You don't have enough money. You need \$500,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-500000 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();
?>
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...