chrometweaks.org

iPage, Domain and Web Hosting Problem.?

Click Here To View All Answers...


My question is iPage, Domain and Web Hosting Problem.? Looking forward for any comment. Another question... Hi. I am making a new shipping module for my site. It will be the only option. What happens, is there are certain products that go into one of four categories.

Then, I have a line that says if (products_group where products id = cart[loop]) = 1, then num1 +=1. I get this error when I run the page....

1064 - 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']' at line 1.

SELECT products_group FROM products_description WHERE products_id = ['id'].

This is my line of code:.

For($i=0;$i=sizeof($products);$i++).

{.

If (tep_db_query("SELECT products_group FROM products_description WHERE products_id = $products[$i]['id']") == 1).

$num1 += 1;.

... etc etc.

}.

I've tried using back slash before the single quotes, and stopping the double quote before the variable $products. anyone got any suggestions?? thanks a lot..

Comments (78)

I'm stumped. I'm not so sure what is the answer. I'll do some investigation and get back to you if I find an anything. You should email the people at iPage as they probably know..

Comment #1

I keep getting this error:.

1226 - User 'mosier' has exceeded the 'max_questions' resource (current value: 72000).

Is there any way to not use so many resources? this is my code right now:.

For($i=0;$i=sizeof($products);$i++).

{.

$this_query = tep_db_query("SELECT products_group FROM "TABLE_PRODUCTS_DESCRIPTION" WHERE products_id = '"$products[$i]['id']"'");.

If (tep_db_num_rows($this_query) == 1).

$num1 += 1;.

If (tep_db_num_rows($this_query) == 2).

$num2 += 1;.

If (tep_db_num_rows($this_query) == 3).

$num3 += 1;.

If (tep_db_num_rows($this_query) == 4).

$num4 += 1;.

}.

If there is no solution, how often do you think this error would come up? for instance, if there are more than a certain amount of customers in one day, I dont want the rest of them not be able to order any items..

This post has been edited by.

Deadrecords.

: 29 March 2004, 04:32..

Comment #2

Try this:.

For($i=0;$i=sizeof($products);$i++).

{.

$this_query = tep_db_query("SELECT products_group FROM "TABLE_PRODUCTS_DESCRIPTION" WHERE products_id = '"$products[$i]['id']"'");.

$counter = tep_db_num_rows($this_query);.

If ($counter == '1').

  $num1 += 1;.

If ($counter == '2').

  $num2 += 1;.

If ($counter == '3').

  $num3 += 1;.

If ($counter == '4').

  $num4 += 1;.

}.

HTH..

Comment #3

It appears that I wont be able to access the iPage site tonight. i've reached the max resources so i'll have to wait until tomorrow. this happened last night so I just gave up until today. thanks for the help though. I added in that piece of code and will try that tomorrow; thanks again...

Comment #4

I keep getting a blank for $products. This is what I get in the error:.

SELECT products_group FROM products_description WHERE products_id = ''.

This is the code so far:.

$products = $cart->get_products();    .

$num1 = 0;.

$num2 = 0;.

$num3 = 0;.

$num4 = 0;.

For($i=0;$i=sizeof($products);$i++).

 {.

 $this_query = tep_db_query("SELECT products_group FROM "TABLE_PRODUCTS_DESCRIPTION" WHERE products_id = '"$products[$i]['id']"'");.

 $counter = tep_db_num_rows($this_query);.

 if ($counter == '1').

   $num1 += 1;.

 if ($counter == '2').

   $num2 += 1;.

 if ($counter == '3').

   $num3 += 1;.

 if ($counter == '4').

   $num4 += 1;.

 }.

//etc etc.

Is there a problem with the first line? I'm at checkout_shipping.php. is this the right way to call the products in the cart?..

Comment #5

Only english is enabled. either way, it should return the product[loop]'s id. shouldn't it? I will try to print it really fast....

Comment #6

All right it's returning the right id, name, etc. i'll look through my code some more, thanks for the help eveyone...

Comment #7

Hi. I am making a new shipping module for my site. It will be the only option. What happens, is there are certain products that go into one of four categories. my script adds all of the products in a certain category together and then if any of them are greater than 0, it displays a thing that says 'you have this many products in this category, would you like regular or over-night shipping?' Anyway, I added a column to products_description called products_group. Then, I have a line that says if (products_group where products id = cart[loop]) = 1, then num1 +=1.



1064 - 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']' at line 1.

SELECT products_group FROM products_description WHERE products_id = ['id'].

This is my line of code:.

For($i=0;$i=sizeof($products);$i++).

{.

If (tep_db_query("SELECT products_group FROM products_description WHERE products_id = $products[$i]['id']") == 1).

$num1 += 1;.

... etc etc.

}.

I've tried using back slash before the single quotes, and stopping the double quote before the variable $products. anyone got any suggestions?? thanks a lot..

Comment #8

For($i=0;$i=sizeof($products);$i++).

{.

If (tep_db_query("SELECT products_group FROM products_description WHERE products_id = $products[$i]['id']") == 1).

$num1 += 1;.

... etc etc.

}.

Should be.

For($i=0;$i=sizeof($products);$i++).

{.

$this_query = tep_db_query("SELECT products_group FROM "TABLE_PRODUCTS_DESCRIPTION" WHERE products_id = '"$products[$i]['id']"'");.

If (tep_db_num_rows($this_query) == 1) {.

// do whatever here..

$num1 += 1;.

... etc etc.

}.

}.

...as the tep_query function will return an array if results are found. This is why you want to pull the query, and then check the number of results based off of the query..

HTH,.

-Chris..

Comment #9


This question was taken from a support group/message board and re-posted here so others can learn from it.