22, November 2008

Error - Warning: sprintf() [function.sprintf]: - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  DB_cart Class (Moderator: Olaf)
Topic: Error - Warning: sprintf() [function.sprintf]:
« previous next »
Pages: [1] Print

Author Topic: Error - Warning: sprintf() [function.sprintf]:  (Read 696 times)
Kill the googlebot
*
Posts: 6
48 credits
Members referred : 0


« on: May 04, 2007, 12:44:46 PM »

when using your cart i seem to get this error:

Warning: sprintf() [function.sprintf]: Too few arguments in /home/chris/public_html/rock/classes/db_cart/db_cart_class.php on line 92

function remove_old_orders($remove_only_zeros = true) {
      if (RECOVER_ORDER) {
LINE 92--->   $sql = sprintf("DELETE FROM %s WHERE open = 'y' AND  order_date < (NOW() - %d)", ORDERS, VALID_UNTIL * 86400);
      } else {
         $sql = sprintf("DELETE FROM %s WHERE open = 'y' AND customer = %d AND order_date < (NOW() - %d)", ORDERS, VALID_UNTIL * 86400);
      }
      $sql .= ($remove_only_zeros) ? " AND customer = 0" : "";
      mysql_query($sql);
   }

Any help welcomed.
Chris M
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6440
39464 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: May 04, 2007, 12:47:19 PM »

not that row, here is a bug:

$sql = sprintf("DELETE FROM %s WHERE open = 'y' AND customer = %d AND order_date < (NOW() - %d)", ORDERS, VALID_UNTIL * 86400);

there must the customer number between ORDERS and VALID_UNTIL * 86400


Last blog : Just a better Internet portal provided by Google
Kill the googlebot
*
Posts: 6
48 credits
Members referred : 0


« Reply #2 on: May 04, 2007, 12:53:12 PM »

i'm not sure i understand, i have chanegd that line so it now calls the customer_no variable and looks like this:

ORDERS, customer_no, VALID_UNTIL * 86400);

but now i get the following error:

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/chris/public_html/rock/classes/db_cart/db_cart_checkout_stock_example.php on line 82
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6440
39464 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: May 04, 2007, 12:57:29 PM »

i'm not sure i understand, i have chanegd that line so it now calls the customer_no variable and looks like this:

ORDERS, customer_no, VALID_UNTIL * 86400);

but now i get the following error:

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/chris/public_html/rock/classes/db_cart/db_cart_checkout_stock_example.php on line 82

this is wrong: "customer_no"

check the script for the right var name (could not be so hard to find)


Last blog : Just a better Internet portal provided by Google
Kill the googlebot
*
Posts: 6
48 credits
Members referred : 0


« Reply #4 on: May 04, 2007, 02:56:26 PM »

first off sorry for all the posts, but am having problems when updating the order quantity. Once im at the checkout, if i enter 0 as my qunatity and then update i get this error:

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/chris/public_html/rock/classes/db_cart/db_cart_checkout_stock_example.php on line 82

Thanks,
Chris M
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6440
39464 credits
Members referred : 374


It's time to use PHP5!


« Reply #5 on: May 04, 2007, 11:15:12 PM »

don't worry about the questions Wink

this query is only related to your product/stock value database:

$query_stock = sprintf("SELECT art_no, amount AS on_stock FROM db_cart_stock_article_example WHERE art_no IN (%s) ORDER BY art_no", $search_in);

this will work only with the included database. Look the cart class is not stand alone, you need at last am existing product catalog and maybe a customer database.


Last blog : Just a better Internet portal provided by Google
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=6507
Tags : error db_cart Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  DB_cart Class (Moderator: Olaf)
Topic: Error - Warning: sprintf() [function.sprintf]:
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Nov 22, 2008, 03:35:34 PM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 37.736
Total Topics: 7.650
Total Members: 4.397
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: Janai

35 Guests, 5 Users online :

11 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.