Welcome Guest, Not a member yet? Register   Sign In
second query based on first query
#1

[eluser]sniperscope[/eluser]
Hello All
seems i am going to be a permenant visitor of this form.

I have some problem which i want to create a inner query based on outer query

My previous Sql query was below and i want to know how can i make it run in CI

Regards

Code:
$sql_price_master = mysql_query("SELECT price_id, price_name, price_remark FROM price_master ORDER BY price_id ASC");
  while($row_price_master = mysql_fetch_array($sql_price_master))
  {
   echo '
   <table class="system">
    <tr><td colspan="2" class="tdTitle">' .$row_price_master['price_name']. '</td></tr>';
    
    // SUB PRICE START
    $sql_sub = mysql_query("SELECT price_child_title, price_child_price FROM price_child WHERE price_master_id = '" .$row_price_master['price_id']. "' ORDER BY price_child_id DESC");
    while($row_sub = mysql_fetch_array($sql_sub))
     echo '
    <tr><th>' .$row_sub['price_child_title']. '</th><td>' .$row_sub['price_child_price']. '円</td></tr>';
    echo '
    <tr><td colspan="2" class="tdBiko">' .nl2br($row_price_master['price_remark']). '</td></tr>
   </table>';
  }


Messages In This Thread
second query based on first query - by El Forum - 12-16-2012, 10:02 PM
second query based on first query - by El Forum - 12-17-2012, 02:49 AM
second query based on first query - by El Forum - 12-21-2012, 07:46 PM



Theme © iAndrew 2016 - Forum software by © MyBB