[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 09-20-2005, 11:14 AM   #1 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
 
Join Date: Jan 2005
Location: UK
Posts: 2,390
316.50 NP$ (Donate)

PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice


Can anyone see anything wrong with this?

Sorry to keep troubling everyone, but I would be grateful if you could help me with this:

Code:
INSERT INTO pd_shops ('id' , 'name' , 'description' , 'keywords' , 'url' , 'category' , 'image' , 'tall_banner' , 'long_banner' , 'hit_count') VALUES ('' , '$name' , '$description' , '$keywords' , '$url' , '$category' , '$image' , '$tallbanner' , '$longbanner' , '0')
That mysql code comes up with the error:
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 ''id' , 'name' , 'description' , 'keywords' , 'url' , 'category'
Can anyone see anything wrong with it? I can't, but then again, I am thick!

Thanks
Tom
PoorDoggie is offline  
Old 09-20-2005, 11:28 AM   #2 (permalink)
NamePros Regular
 
Join Date: Aug 2005
Posts: 214
170.00 NP$ (Donate)

slantednet is on a distinguished road


Is that the actual query that is getting sent?

Try this:

In your script, right under the line where you build the SQL statement to be parsed, but before the mysql_query() call, print or echo your query statement out so you can see exactly what is being parsed by mysql_query(). i.e:

PHP Code:
$query = "insert into yada yada yada";
echo
$query;
mysql_query($query);


Also, check that ID isn't an autonumber field. I'm not 100% sure on this, but if it's autonumber, you shouldn't insert anything into it, and it may be choking on that.

Mike
__________________
OnlineGames.net
slantednet is offline  
Old 09-20-2005, 12:37 PM   #3 (permalink)
Senior Member
 
nasaboy007's Avatar
 
Join Date: Jul 2005
Location: NJ
Posts: 1,112
1,454.30 NP$ (Donate)

nasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud of


i dont see a reason to have the first data if yo ualready have the table and database created... try it w/o that.

it might also be the ID autoincrement thing, but i think u shud have the empty entry there.
nasaboy007 is offline  
Old 09-20-2005, 12:47 PM   #4 (permalink)
Account Closed
 
axilant's Avatar
 
Join Date: May 2004
Location: /etc/passwd
Posts: 2,194
0.00 NP$ (Donate)

axilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to behold


PHP Code:
mysql_query("INSERT INTO pd_shops ('name' , 'description' , 'keywords' , 'url' , 'category' , 'image' , 'tall_banner' , 'long_banner' , 'hit_count')
VALUES ('$name' , '$description' , '$keywords' , '$url' , '$category' , '$image' , '$tallbanner' , '$longbanner' , '0')"
) or die(mysql_error());
That should fix it. Let me know if you have any further problems.
axilant is offline  
Old 09-20-2005, 02:22 PM   #5 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
 
Join Date: Jan 2005
Location: UK
Posts: 2,390
316.50 NP$ (Donate)

PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice


Quote:
Originally Posted by nasaboy007
it might also be the ID autoincrement thing, but i think u shud have the empty entry there.
with the id thing... on the phpmyadmin page it says "(id) VALUES ('')" in there, so I just copied that. If $image, $tallbanner and $longbanner are empty then the query works, but the variables are just urls to images, and not anything too iffy, and should, in theory work. I will try and get the mysql query printed for you (and me) to see, but I can't at the moment.

Axillant, did you do anything apart from put it in a mysql query? That is what I do already, but I just didn't bother putting it up here. Thanks though

Thanks
Tom
PoorDoggie is offline  
Old 09-20-2005, 02:25 PM   #6 (permalink)
NamePros Regular
 
gamex's Avatar
 
Join Date: Feb 2004
Location: Student @ UConn
Posts: 408
73.95 NP$ (Donate)

gamex has a spectacular aura aboutgamex has a spectacular aura about


Did you try just doing something like this:

PHP Code:
INSERT INTO pd_shops VALUES ('' , '$name' , '$description' , '$keywords' , '$url' , '$category' , '$image' , '$tallbanner' , '$longbanner' , '0')
And removing ('id' , 'name' , 'description' , 'keywords' , 'url' , 'category' , 'image' , 'tall_banner' , 'long_banner' , 'hit_count') all together?
__________________
Joe
CarrotCash.com
gamex is offline  
Old 09-21-2005, 03:11 PM   #7 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
 
Join Date: Jan 2005
Location: UK
Posts: 2,390
316.50 NP$ (Donate)

PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice


Quote:
Originally Posted by gamex
Did you try just doing something like this:

PHP Code:
INSERT INTO pd_shops VALUES ('' , '$name' , '$description' , '$keywords' , '$url' , '$category' , '$image' , '$tallbanner' , '$longbanner' , '0')
And removing ('id' , 'name' , 'description' , 'keywords' , 'url' , 'category' , 'image' , 'tall_banner' , 'long_banner' , 'hit_count') all together?
That might work acctually! Thanks will try it.

Here is the full mysql query btw:

Code:
INSERT INTO pd_shops ('id' , 'name' , 'description' , 'keywords' , 'url' , 'category' , 'image' , 'tall_banner' , 'long_banner' , 'hit_count') VALUES ('' , 'Photo Albums, CD albums, DVD albums - Arrowfile protects, organises and presents your memories' , 'We offer you a loose-leaf binder system that allows you to break away from the limitations of other albums or collating methods. Organise every size photograph, slide, negative or collectable in a single album. Arrowfile sleeve pages are archival quality to protect your precious images for years to come.' , 'album, albums, photo album, picture album, organiser, organizer, leather photo album, anniversary, anniversary gifts, aps photo albums storage, archival library supplies, archival photo albums, autographs, photography, camera, cameras, classical music, coin collecting, collectables, collectibles, collecting, collections, family photo albums, family photographs, family photos, family pics, family pictures, holiday photos, holiday pics, holiday pictures, holidays, image, images, music cd, old coins, organising, photographer, photographers, photographs, photography, photography archival supplies, photos, pic, pics, picture, picture frames, pictures, professional photo albums, quality photo albums, rare coins,scrapbook, scrapbook album, self storage, stamp collecting, stamps, stock photography, stock photos, storage, wedding photo albums, wedding photography, wedding pictures' , 'http://scripts.affiliatefuture.com/AFClick.asp?affiliateID=17989&merchantID=1111&programmeID=3229&mediaID=0&tracking=&url=' , '6' , 'http://banners.affiliatefuture.com/1111/17054.gif' , 'http://banners.affiliatefuture.com/1111/17056.gif' , 'http://banners.affiliatefuture.com/1111/17058.gif' , '0')
PoorDoggie is offline  
Closed Thread


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Prove Me WRONG. mholt Contests Forum 169 02-03-2006 04:09 PM
JS - What is wrong here? PoorDoggie Programming 2 08-24-2005 11:40 AM

Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 05:11 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85