NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Can anyone see anything wrong with this?

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

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 09-20-2005, 12:14 PM THREAD STARTER               #1 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie 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!
????: NamePros.com http://www.namepros.com/programming/125286-can-anyone-see-anything-wrong-with.html

Thanks
Tom
PoorDoggie is offline  
Old 09-20-2005, 12:28 PM   #2 (permalink)
NamePros Regular
Join Date: Aug 2005
Posts: 214
slantednet is on a distinguished road
 



Is that the actual query that is getting sent?
????: NamePros.com http://www.namepros.com/showthread.php?t=125286

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, 01:37 PM   #3 (permalink)
Senior Member
 
nasaboy007's Avatar
Join Date: Jul 2005
Location: NJ
Posts: 1,219
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 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, 01:47 PM   #4 (permalink)
Account Closed
 
axilant's Avatar
Join Date: May 2004
Location: /etc/passwd
Posts: 2,178
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
 

Member of the Month
July 2005

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()); 
????: NamePros.com http://www.namepros.com/showthread.php?t=125286
That should fix it. Let me know if you have any further problems.
axilant is offline  
Old 09-20-2005, 03:22 PM THREAD STARTER               #5 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



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.
????: NamePros.com http://www.namepros.com/showthread.php?t=125286

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, 03:25 PM   #6 (permalink)
NamePros Regular
Join Date: Feb 2004
Location: Student @ UConn
Posts: 411
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'
????: NamePros.com http://www.namepros.com/showthread.php?t=125286
And removing ('id' , 'name' , 'description' , 'keywords' , 'url' , 'category' , 'image' , 'tall_banner' , 'long_banner' , 'hit_count') all together?
__________________
Joe
gamex is offline  
Old 09-21-2005, 04:11 PM THREAD STARTER               #7 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



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'
????: NamePros.com http://www.namepros.com/showthread.php?t=125286
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


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

Liquid Web Smart Servers  
All times are GMT -7. The time now is 09:33 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger