phantompressents Posted April 4, 2007 Posted April 4, 2007 Hi Im trying to make an extra section in account_history_info.php that querrys the database and dispalys the consignment number to the customer so they can track the parcel i know there are several of these contributions available but im looking for somthing very basic. let me exsplain ive made a new column in my orders table called tracking_id and put some temporary numbers in. now i just need it to show the customer the number . heres my code /*Tracking begin*/ $order_query = tep_db_query(" tracking_id from " . TABLE_ORDERS . " where orders_id = '" . tep_db_input($order_id) . "'"); /*Tracking end*/ echo $order_query; when i go to the account_orders_info.php page all that is displayed where the tracking number should be is "Resource id #280" can somebody help me with my SQL please or tell me what Resource id #280 is and what im doing wrong. Thanks
kirikintha Posted April 4, 2007 Posted April 4, 2007 Hi Im trying to make an extra section in account_history_info.php that querrys the database and dispalys the consignment number to the customer so they can track the parcel i know there are several of these contributions available but im looking for somthing very basic. let me exsplain ive made a new column in my orders table called tracking_id and put some temporary numbers in. now i just need it to show the customer the number . heres my code /*Tracking begin*/ $order_query = tep_db_query(" tracking_id from " . TABLE_ORDERS . " where orders_id = '" . tep_db_input($order_id) . "'"); /*Tracking end*/ echo $order_query; when i go to the account_orders_info.php page all that is displayed where the tracking number should be is "Resource id #280" can somebody help me with my SQL please or tell me what Resource id #280 is and what im doing wrong. Thanks you have an array there, so you have to loop through it to get the data out. the problem is you are echoing the array, use a while loop - there is one around there for you to look at something like $order_info = tep_db_fetch_array($order_query); while ($order_info = tep_db_fetch_array($order_query)) { echo $order_info['tracking_id']; } I don't know if that'll work perfect, but it's the loop is correct I believe Nothing unreal exists
phantompressents Posted April 5, 2007 Author Posted April 5, 2007 you have an array there, so you have to loop through it to get the data out. the problem is you are echoing the array, use a while loop - there is one around there for you to look at something like $order_info = tep_db_fetch_array($order_query); while ($order_info = tep_db_fetch_array($order_query)) { echo $order_info['tracking_id']; } I don't know if that'll work perfect, but it's the loop is correct I believe Thanks kirikintha but im still having problems understanding this loop do you think you could broaden your explanation for me. Thanks v.much
phantompressents Posted April 5, 2007 Author Posted April 5, 2007 Just putting this back out there maybe someone can advise me where to go next.
Guest Posted April 5, 2007 Posted April 5, 2007 Just putting this back out there maybe someone can advise me where to go next. advice with what? Replace your echo line with what Paul mentioned (see post#2). Have you tried it?
phantompressents Posted April 10, 2007 Author Posted April 10, 2007 Yes ive tried it but i cant get it to work properly. >_< <?php /*Tracking begin*/ $trackid = $HTTP_GET_VARS['order_id']; $order_query = tep_db_query("select tracking_id from " . TABLE_ORDERS . " where orders_id = '" . tep_db_input($order_id) . "'"); $order_info = tep_db_fetch_array($order_query); while ($order_info = tep_db_fetch_array($order_query)) { echo $order_info['tracking_id']; } /*Tracking end*/ ?> I understand what pauls means and what his part is doing but i still cant get it to pull the info up.
Guest Posted April 10, 2007 Posted April 10, 2007 Yes ive tried it but i cant get it to work properly. >_< <?php /*Tracking begin*/ $trackid = $HTTP_GET_VARS['order_id']; $order_query = tep_db_query("select tracking_id from " . TABLE_ORDERS . " where orders_id = '" . tep_db_input($order_id) . "'"); $order_info = tep_db_fetch_array($order_query); while ($order_info = tep_db_fetch_array($order_query)) { echo $order_info['tracking_id']; } /*Tracking end*/ ?> I understand what pauls means and what his part is doing but i still cant get it to pull the info up. You need to pass the correct variable (same one) when you interrogate the database. In your code replace this: $trackid = $HTTP_GET_VARS['order_id']; with this: $order_id = $HTTP_GET_VARS['order_id'];
Recommended Posts
Archived
This topic is now archived and is closed to further replies.