Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Convert to MySQL5


Alexandero

Recommended Posts

Posted

Hi Hi sorry I wanted to say I want to convert it to PHP4 could anyone please convert this code to be compatible with PHP 4 ? Because it works in two sites that has php5, but not in a third that is on php4.

 

 

<?php
for($j=0; $j<=$_POST['k']; $j++){	
if($_POST['chk'][$j]){
	$orderstausid .= $_POST['chk'][$j].',';
}
}
$orderstausid = substr($orderstausid, 0 , -1);

$pending_order_query = tep_db_query("select orders_id from orders where orders_status in(".$orderstausid.") and orders_id >= '".$_POST['toinvoice']."' and orders_id <= '".$_POST['frominvoice']."' order by orders_id");
$rows = tep_db_num_rows($pending_order_query);
$r = 0;

while($pending_order_data = tep_db_fetch_array($pending_order_query)){
$oid[] = $pending_order_data['orders_id'];
$order = new order($pending_order_data['orders_id']);
$customer_number_query = tep_db_query("select customers_id from " . TABLE_ORDERS . " where orders_id = '". tep_db_input(tep_db_prepare_input($pending_order_data['orders_id'])) . "'");
$customer_number = tep_db_fetch_array($customer_number_query);

$payment_info_query = tep_db_query("select * from " . TABLE_ORDERS . " where orders_id = '". tep_db_input(tep_db_prepare_input($pending_order_data['orders_id'])) . "'");
$payment_info = tep_db_fetch_array($payment_info_query);
$payment_info = $payment_info['orders_id'];

$oID = tep_db_prepare_input($pending_order_data['orders_id']);
$orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . tep_db_input($oID) . "'");

for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
	$opid[] = $order->products[$i]['opid'];
	$pid[] = $order->products[$i]['pid'];
}
}
?>
<tr><td valign="top"><table align="center" style="width:600px;" border="0"><tr><td>
<?php
for($o=0; $o<sizeof($opid);$o++){
$orderprodid .= $opid[$o].',';
}
$orderprodid = substr($orderprodid, 0 , -1);
$pid= str_replace("-", "", $pid);
$val = array_count_values($pid);

while(list($pid, ) = each($val)){

$showimg = tep_db_fetch_array(tep_db_query("select p.products_id, p.products_image,p.products_model,pd.products_name from products p, products_description pd where  p.products_id='".$pid."' and p.products_id = pd.products_id and pd.language_id = '". (int)$languages_id ."'"));
$imagelocation = "images/";
$imagelocation.=$showimg["products_image"];
echo '<table border="0" width="100%" style="border-bottom:1px solid #000000;"><tr>				<td valign="top"><table border="0" width="100%" align="center"><tr class="dataTableRow"><td class="dataTableContent" valign="top" align="center" height="135px;" width="80%">' . tep_image('images/' . $showimg['products_image'], $showimg['products_name'], 135, 100) . '<br>' . $showimg['products_name'] . '</td></tr><tr><td align="center">';

	$prodattribquery = tep_db_query("select opa.products_options, opa.products_options_values, op.products_quantity from orders_products_attributes opa, orders_products op where opa.orders_products_id in(".$orderprodid.") and opa.orders_products_id = op.orders_products_id and op.products_id = '".$pid."'");
	while($prodattribdata = tep_db_fetch_array($prodattribquery)){
		echo '<table><tr class="dataTableRow"><td class="dataTableContent" valign="top" align="center"> <small>'.$prodattribdata['products_quantity'] .' x '.$prodattribdata['products_options'].' :-  '.$prodattribdata['products_options_values'].'</small></td></tr></table>';
	}
	echo '</td></tr></table></td></tr></table>';

}
?>
  </td></tr></table>
</table>
<!-- body_text_eof //-->
</body>
</html>

 

Thanks a lot.

Archived

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

×
×
  • Create New...