Hello;
I am working on a project and in order to save resources, my supervisor says I should pass variables in an array. Some of which were working perfectly. However the fetching of the records from the database gives me the error below;
Warning: mysql_query() expects parameter 2 to be resource, string given in /nfs/c01/h12/mnt/3250/domains/zeta-clovis.sendairtime.com/html/support_mail/includes/find_order_records_function.php on line 37
The find_order_records_function.php file is as below;
<?php
// Fetch the functions file that contains the database connection
include_once $_SERVER['DOCUMENT_ROOT'].'/src/dbInfo.php';
// Run a query to fetch the records from the database table using a function
function fetch_records($input_array)
{
// Connect to the database using the function connect2DB2
$input_array['connection'] = connect2DB2(COUNTRY_ABBREVIATION);
$connection = $input_array['connection'];
$get_record_query = "SELECT * FROM Ordered_Cart_Items";
$execute_get_record = mysql_query($get_record_query,$connection) or handleDatabaseError(''. mysql_error(),$get_record_query);
//Check whether there are any rows being returned by the query
if (mysql_num_rows($execute_get_record) == 0) {
$table = "No record returned";
$input_array['table'] = $table;
return $input_array;
} else {
$table = "
These are the Items that are in the ordered_cart_items database table. Cross check these records with the report from Paypal and Yo payements.
<table border='0'>
<tr bgcolor='#999999'>
<td>Order Id</td>
<td>Session Id</td>
<td>Date added</td>
<td>Receiver</td>
<td>Receiver phone</td>
<td>Reciever email</td>
</tr>";
while ($returned_records = mysql_fetch_array($execute_get_record)) {
$order_id = $returned_records['order_id'];
$client_session_id = $returned_records['session_id'];
$date_added = $returned_records['date_added'];
$receiver_name = $returned_records['receiver_first_name'] . " " . $returned_records['receiver_last_name'];
$receiver_phone = $returned_records['receiver_phone'];
$receiver_email = $returned_records['receiver_email'];
$receiver_network_id = $returned_records['receiver_network_id'];
$item_id = $returned_records['item_id'];
$button_id = $returned_records['button_id'];
$paypal_fee = $returned_records['paypal_fee'];
$ip_country = $returned_records['ip_country'];
$ip_state = $returned_records['ip_state'];
$ip_city = $returned_records['ip_city'];
$ip_address = $returned_records['ip_address'];
$note_to_receiver = $returned_records['note_to_receiver'];
$table.="
<tr>
<td>$order_id</td>
<td>$client_session_id</td>
<td>$date_added</td>
<td>$reciever_name</td>
<td>$receiver_phone</td>
<td>$receiver_email</td>
</tr>";
}
$table.= "</table>";
$input_array['table'] = $table;
return $input_array;
}
echo $table;
}
?>
I dunno. Is it something that I may have missed out?? Pliz help