Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

SQL select help needed


svepe

Recommended Posts

Hi all,

 

I?ve been trying to write a "simple" SQL sentence now for some while and I can?t get it right so I would need some help from a guru.

 

This is what I would have done:

 

from table "orders_total" select "text" where "class=ot_total" where orders_id = '" . tep_db_input($order_id) . "'

 

(I would like to print order total where order_id = selected order)

 

Can anybody help me complete this sentence? :unsure:

 

Thanx in advance!!

Link to comment
Share on other sites

$query='SELECT text FROM orders_total WHERE orders_id = "' . $array_that_contains_vaule[$order_id] . '"';

 

I don't think that tep_db_input is the array you are looking for that contains the order_id though.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

LOL, I thought it was a 'simple sql sentence'.

 

All well, best of luck, and let us know how it goes.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

Well, yes, define simple.. ;)

 

Actually I don?t belive this is hard at all, you just have to write the words needed, hehe.

 

Yes, I let You know, if it turns out to be useful i?ll try to make it a new contrib!

 

Thanx alot for Your help!

Link to comment
Share on other sites

Back again to the problem.

 

Could this be used somehow (in /admin/includes/orders.php; line 30):

 

      $totals_query = tep_db_query("select title, text from " . TABLE_ORDERS_TOTAL . " where orders_id =
'" . tep_db_input($order_id) . "' order by sort_order");
     while ($totals = tep_db_fetch_array($totals_query)) {
       $this->totals[] = array('title' => $totals['title'],
                               'text' => $totals['text']);

 

 

in invoice.php; arround line 174 following is used to print all the states on invoice.

 

<?php
 for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) {
   echo '          <tr>' . "\n" .
        '            <td align="right" class="smallText">' . $order->totals[$i]['title'] . '</td>' . "\n" .
        '            <td align="right" class="smallText">' . $order->totals[$i]['text'] . '</td>' . "\n" .
        '          </tr>' . "\n";
 }
?>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...