General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 31st, 2004, 08:41 AM
Erniefrontier Erniefrontier is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 12 Erniefrontier User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation Problem with quotes on SQL insertion

Hello anyone who reads this and thankyou for taking the time.

I am trying to create a shopping cart, I have manged to implement user validation, adding stuff to the cart etc.

I am now trying to process the customers cart, trying to save the order details to the database, but I keep falling flat on my face.

$query_insert_order = "insert into orders values ('', '".$userid."', '".$total_price."', '".$date."' ,'PARTIAL', '".$ship_name."', '".$ship_address."', '".$ship_city."', '".$ship_state."', '".$ship_zip."', '".$ship_country."')";
$result1 = mysql_query($query_insert_order. $connection);


if (!$result1)
{
echo "hello";
return false;
}

is the query I'm using. All the variables exist, I have echo'd them.

The first value I'm trying to enter is auto incremented in the db, and I'm not sure if that is the correct way to do it ('').

Any help would be great.

Many thanks,

Ernie.

P.s. I am a newby to PHP and Mysql.

Reply With Quote
  #2  
Old March 31st, 2004, 05:13 PM
Pheifel Pheifel is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: Denmark
Posts: 174 Pheifel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 43 m 46 sec
Reputation Power: 5
Send a message via MSN to Pheifel
insteat of using double qoutations use the single qoutations, and then sont use the dots... try this:

PHP Code:
 $query_insert_order "insert into orders values ('', '$userid', '$total_price', '$date' ,'PARTIAL', '$ship_name', '$ship_address', '$ship_city', '$ship_state', '$ship_zip', '$ship_country')";
$result1 mysql_query($query_insert_order$connection);


if (!
$result1)
{
echo 
"hello";
return 
false;


Reply With Quote
  #3  
Old March 31st, 2004, 05:37 PM
crudesys crudesys is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: California
Posts: 25 crudesys User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
hi, i think you posted that same question earlier. i guess you didn't look back at it.

Reply With Quote
  #4  
Old April 1st, 2004, 08:44 AM
Erniefrontier Erniefrontier is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 12 Erniefrontier User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for the help but still the same prob

Thanks for all the help, but removing the " and the . didn't help still got the same prob. It doesn't run the query, it just returns false and the function says could not store data. I know exactly where it is failing but I have no idea why. Most Confused.

In another function I use to input the users details into the DB, I had to use " and . for the query to run. To be honest I'm not really sure how I got this far. All I've got is a pony book on PHP and mysql that doesn't explain much and help from people like you on the net.

Reply With Quote
  #5  
Old April 1st, 2004, 09:08 AM
Erniefrontier Erniefrontier is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 12 Erniefrontier User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Please ignore my stupidity.

I'm so sorry for having troubled yoy with my prob, it was a sytax error even though it wasn't being reported. If you look very closely you will see that I have put a . instead of a , when I pass the query to the DB.

Once again thanks for the help, and cap in hand time.

Ernie

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Problem with quotes on SQL insertion


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT