Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

tep_db_fetch_array returning empty array


prova2123

Recommended Posts

Posted

Hello,

 

I am noob in oscommerce and trying to edit the checkout_Shipping.page to do something if the state is "california".

 

I am testing some very simple stuff, in checkout_shipping.php

 

I added just this few lines:

 

[i]      //echo $sendto; //prints correctly.[/i]
[i]       $my_query = tep_db_query("SELECT * from address_book where address_book_id = '" . (int)$sendto ."'");[/i]
[i]       $delivery_state = tep_db_fetch_array($my_query);[/i]
[i]      [/i]
[i]      $num_results = tep_db_num_rows($delivery_state); [/i]

[i]      if ($num_results > 0 ){[/i]

[i]        echo "win";[/i]
[i]      }[/i]
[i]      $my_state = $delivery_state['entry_state'];[/i]

 

Now, if i run the same query in the database return 1 row, fetch_array is returning 0 rows for me.

 

Any advice? Thank you!

Posted

$num_results = tep_db_num_rows($my_query);

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Posted

Hello,

 

Thanks for your reply. That unfortunately does not work

 

 

this however may:

 

$address_query = tep_db_query("select entry_state from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$sendto . "'");
$address = tep_db_fetch_array($address_query);

echo $address['entry_state'];

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...