PHP Web Host - Quality Web Hosting For All PHP Applications $35/month $250/year (Unlimited) - $25/month - 200,000 impressions - Your Ad Could be Here - Click For Details
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
floppydrivez
Involved
Involved


Joined: Feb 26, 2006
Posts: 337
Location: Jackson, Mississippi

PostPosted: Thu Sep 14, 2006 10:07 am Reply with quote Back to top

When I insert my row of info its adding a row of blanks Very Happy with its own id.

Did I format any of this wrong?

Code:
CREATE TABLE nuke_league_games (
   gid int NOT NULL auto_increment,
   PRIMARY KEY (gid),
   gname text NOT NULL,
   version text NOT NULL,
   gabbr text NOT NULL
) TYPE=MyISAM;


Code:

$addgame = $db->sql_query("INSERT INTO ".$prefix."_league_games VALUES (null, '$gtitle','$version','$abrev')");
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6044

PostPosted: Thu Sep 14, 2006 10:36 am Reply with quote Back to top

Looks OK. Usually the primary key field is defined after the fields on the create statement.
View user's profile Send private message
floppydrivez
Involved
Involved


Joined: Feb 26, 2006
Posts: 337
Location: Jackson, Mississippi

PostPosted: Thu Sep 14, 2006 10:37 am Reply with quote Back to top

Yeah, I changed it to see if that made a difference. Any idea why I get a extra row with nothing defined except the gid?
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
fkelly
Moderator


Joined: Aug 30, 2005
Posts: 3186
Location: near Albany NY

PostPosted: Thu Sep 14, 2006 11:23 am Reply with quote Back to top

You are defining gid as not null and then sticking null in it for one thing.

I'd stick a 1 in it.
View user's profile Send private message Visit poster's website
floppydrivez
Involved
Involved


Joined: Feb 26, 2006
Posts: 337
Location: Jackson, Mississippi

PostPosted: Thu Sep 14, 2006 12:03 pm Reply with quote Back to top

This makes sense plus it works.

Code:
$addgame = $db->sql_query("INSERT INTO ".$prefix."_league_games VALUES ('', '$gtitle','$version','$abrev')");


I tried it without the

Code:
''


My result was an error.
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
montego
Site Admin


Joined: Aug 29, 2004
Posts: 9136
Location: Arizona

PostPosted: Fri Sep 15, 2006 7:20 am Reply with quote Back to top

floppydrivez, I used your original CREATE statement from above to create the table and then I tried this exact INSERT statement:

INSERT INTO nuke_league_games VALUES (null, 'title','version','abrev');

It inserted just fine and only 1 row. I believe that you may have had an issue with how your variables were getting defined/valued and that it had nothing to do with the actual SQL.
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum