Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming > Web Coding

Reply
 
LinkBack Thread Tools
Old 02-10-08   #1 (permalink)
Programmer
 
LyokoHaCk's Avatar
 
amd nvidia

Join Date: Aug 2006
Location: United States Inc.
Posts: 1,964

Rep: 73 LyokoHaCk is acknowledged by some
Unique Rep: 68
FAQs Submitted: 1
Trader Rating: 2
Default [MySQL] Insert query error!

Code:
mysql_query("INSERT INTO `table` ( `url` , `ip` ) VALUES('http://mysite.com' , '0.0.0.0')");
When I try to execute that query in php, I get
Quote:
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 '0.0.0.0')' at line 1
Using MySQL 4 (.2 or something)

Thanks!
LyokoHaCk is offline   Reply With Quote
Old 02-10-08   #2 (permalink)
Database Developer
 
e_dogg's Avatar
 
intel nvidia

Join Date: Feb 2007
Location: Ventura, CA
Posts: 1,183

Rep: 144 e_dogg is acknowledged by manye_dogg is acknowledged by many
Unique Rep: 122
Trader Rating: 6
Default

In your "insert into" statement, you shouldn't need the quotes around the table and column names. Try this:

INSERT INTO table ( url , ip ) VALUES('http://mysite.com' , '0.0.0.0')

Also, your table name really isn't called "table", right? If so, you should really change your database schema. If for some reason you do need your table called "table", enclose it in square brackets like this: [table].

Hope that helps!
__________________
Club 0pera VIP Member

0pera 9.51
0pera Mini
IE 6 or 7 when Opera don't work

System: New Hotness
CPU
E6420 @ 2.8
Motherboard
Asus P5B-Plus
Memory
4x1gb G.Skill HZ @ 4-4-4-12
Graphics Card
Evga 8800GTS 320mb
Hard Drive
250gb + 750gb Seagate 7200.10 SATA
Power Supply
Rosewill 550w
Case
Coolermaster CM-690
CPU cooling
Zalman 9500AT
OS
Vista Ultimate x64
Monitor
Viewsonic VP171s
e_dogg is offline   Reply With Quote
Old 02-11-08   #3 (permalink)
AMD Overclocker
 
Starholdest's Avatar
 
amd nvidia

Join Date: Mar 2007
Location: █♣█
Posts: 925
Blog Entries: 1

Rep: 43 Starholdest is acknowledged by some
Unique Rep: 38
Hardware Reviews: 1
Trader Rating: 0
Default

mysql_query("INSERT INTO `table` (`url`,`ip`) VALUES ('http://mysite.com','0.0.0.0')");

Works perfectly fine for me. I'm sure you have one of your table/row names messed up.
__________________

My s939 rig build log thread - 4600+ @ 2.8Ghz stable


Aumotocnic "An unfortunate member of the overclock.net insomnia club"

Quebec Overclockers - 8019 in 3dMark06

s939 Manny 4600+ @ 2809Mhz @ 1.425V (9 hours Orthos blend test stable - 24/7 Usage) - http://valid.x86-secret.com/show_oc.php?id=289741
@ 2945Mhz @ 1.45V (YAY! - Not stable, doh!) - http://valid.x86-secret.com/show_oc.php?id=276669

System: Beast from the East
CPU
AMD x2 4600+ @ 2.8Ghz
Motherboard
Asus A8N-SLI SE
Memory
2GB Kingston Value DDR400
Graphics Card
Asus 8800GTS 320MB
Hard Drive
80G Seagate SATA
Sound Card
SoundBlaster Audigy SE
Power Supply
Thermaltake Purepower 500W
Case
Antec 900 (modded)
CPU cooling
AS5 + Zalman CNPS9700 LED
GPU cooling
Stock
OS
Windows Vista Ultimate
Monitor
Samsung Syncmaster 730B (17" yay!)

Last edited by Starholdest : 02-11-08 at 01:24 PM.
Starholdest is offline Starholdest's Gallery   Reply With Quote
Old 02-11-08   #4 (permalink)
Overclocker
 
immoral giant's Avatar
 
intel nvidia

Join Date: Jan 2007
Posts: 1,899
Blog Entries: 1

Rep: 120 immoral giant is acknowledged by manyimmoral giant is acknowledged by many
Unique Rep: 90
Hardware Reviews: 2
Trader Rating: 2
Default

Your code is fine. I imagine it is the database itself. Have you got the ip row set up as an integer? If so, I don't think it will work due to the .'s, change it to VARCHAR(15).

System: (Not so) New Rig
CPU
C2D E6750 @ 3.2GHz - 1.325v
Motherboard
Gigabyte P35-DS3R
Memory
4GB Corsair PC6400 5-5-5-18
Graphics Card
BFG 8800GTS 320MB
Hard Drive
1070GB
Sound Card
Creative X-Fi ExtremeMusic
Power Supply
Corsair HX520W
Case
Antec P182B
CPU cooling
Noctua NH-U9F
GPU cooling
ThermalRight HR-03-Plus w/ Nexus 92mm
OS
Windows Vista x64 Ultimate
Monitor
24" Dell 2407 WFP
immoral giant is offline   Reply With Quote
Old 02-12-08   #5 (permalink)
Programmer
 
LyokoHaCk's Avatar
 
amd nvidia

Join Date: Aug 2006
Location: United States Inc.
Posts: 1,964

Rep: 73 LyokoHaCk is acknowledged by some
Unique Rep: 68
FAQs Submitted: 1
Trader Rating: 2
Default

Took care of it. PHP didn't trim the url and it had backslashes at the beginning and end of the string. Thanks guys!
LyokoHaCk is offline   Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -4. The time now is 11:48 AM.


Overclock.net is a Carbon Neutral Site Creative Commons License Internet Security By ControlScan

Terms of Service / Forum Rules | Privacy Policy | Advertising | Become an Official Vendor
Copyright © 2008 Shogun Interactive Development. Most rights reserved.
Page generated in 0.14681 seconds with 9 queries