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 August 3rd, 2003, 12:30 PM
Fallbi Fallbi is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 1 Fallbi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
An other problem with shopping cart

Hello everybody,
I'm using the shopping cart tutorial of this site. But it is that I have some difficulties. In my data base, I have a table "cart" which contains information on each item stored by the user, with the champs(cartId, cookieId, ref_prod, qty). At the time of the use of the AddItem function of which here the code


PHP Code:
function AddItem($itemId$qty
   { 
// Will check whether or not this item 
// already exists in the cart table. 
// If it does, the UpdateItem function 
// will be called instead 
       
global $dbServer$dbUser$dbPass$dbName

// Get a connection to the database 

$cxn = @ConnectToDb($dbServer$dbUser$dbPass$dbName); 
$cartid GetCartId(); 
       
    
    
// Check if this item already exists in the users cart table 
    
// requête posant problème    
$query "select count(*) from cart where cookieId = '" GetCartId() . "' and ref_prod = $itemId"

$result mysql_query($query/*or die("Couldn't execute query")*/
    
$row mysql_fetch_row($result); 
$numRows $row[0]; 

if(
$numRows == 0)   { 
// This item doesn't exist in the users cart, 
// we will add it with an insert query 

@mysql_query("insert into cart(cookieId, ref_prod, qty) values('" GetCartId() . "', $itemId, $qty)"); 
      } 
else 

// This item already exists in the users cart, 
// we will update it instead 
          
UpdateItem($itemId$qty); 




I have a problem with the request query, in fact after several test it is as if the table cart did not exist. I have the error message according to:
Warning: mysql_fetch_row(): supplied argument is not has valid MySQL result resource
When I make an echo of the request "query" the result:
count(*) from cart where cookieId = ' bd0791c67082e8c34a07ca4b6a006a9b' and ref_prod = 12
I have done a select cookieId on this one (the table cart) and tried to post the result, but anything. Whereas the table exists indeed. I will like to know which could be the problem.
Thank you in advance

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > An other problem with shopping cart


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 5 hosted by Hostway
Stay green...Green IT