Monkey644 Posted July 8, 2010 Share Posted July 8, 2010 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? Quote Link to comment Share on other sites More sharing options...
Zero-Affect Posted July 8, 2010 Share Posted July 8, 2010 mind not putting it on a single line... it's bloody annoying. Quote Link to comment Share on other sites More sharing options...
Jordan Palmer Posted July 8, 2010 Share Posted July 8, 2010 I do have too agree, It's really hard too look and see if there's any issue's in the code if it's one line. + Problem is you have an extra row somewhere which isn't matching the entry Quote Link to comment Share on other sites More sharing options...
Uridium Posted July 9, 2010 Share Posted July 9, 2010 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(); ?> Quote Link to comment Share on other sites More sharing options...
Monkey644 Posted July 12, 2010 Author Share Posted July 12, 2010 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 Quote Link to comment Share on other sites More sharing options...
Zero-Affect Posted July 12, 2010 Share Posted July 12, 2010 go to your myphpadmin select the database and the table `gangs` count how many columns in structure or export the gangs table and paste it here. Quote Link to comment Share on other sites More sharing options...
Monkey644 Posted July 13, 2010 Author Share Posted July 13, 2010 [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. :) Quote Link to comment Share on other sites More sharing options...
Zero-Affect Posted July 13, 2010 Share Posted July 13, 2010 $db->query("INSERT INTO gangs VALUES('','$name','$desc','','',0,0,100,$userid,$userid,5,0,0,'','','')"); Try that Quote Link to comment Share on other sites More sharing options...
Monkey644 Posted July 16, 2010 Author Share Posted July 16, 2010 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... :) Quote Link to comment Share on other sites More sharing options...
Uridium Posted July 17, 2010 Share Posted July 17, 2010 It looks to me like your creategang.php is at fault your either missing some perameters for the iNSERT INTO or your missing some INPUT statements You'll need to copy and paste yout creategang.php for us to look at.. Quote Link to comment Share on other sites More sharing options...
Monkey644 Posted July 22, 2010 Author Share Posted July 22, 2010 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(); ?> Quote Link to comment Share on other sites More sharing options...
Danny696 Posted July 22, 2010 Share Posted July 22, 2010 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(); ?> 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.