28, May 2012

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

 
Webdigity webmaster forums
[ 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
Instabuck - The easy way to sell digital products online

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


« on: May 04, 2007, 11:44:46 am »

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: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: May 04, 2007, 11:47:19 am »

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

Kill the googlebot
*
Posts: 6
48 credits
Members referred : 0


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

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: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: May 04, 2007, 11:57:29 am »

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)

Kill the googlebot
*
Posts: 6
48 credits
Members referred : 0


« Reply #4 on: May 04, 2007, 01: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: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #5 on: May 04, 2007, 10: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.

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....

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?
May 28, 2012, 10:23:41 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!






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