Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Warning: mysql_fetch_array():


MoisesZaragoza

Recommended Posts

Hi every one I'm working on a script but I need some help with the MySQL.

 

I'm getting a waring

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/vitamin/public_html/admin/includes/functions/database.php on line 99

someheader Last Line print check

 

 

This is the code

 

<?php
require('includes/application_top.php');
$data='';
$orders_excel_query = tep_db_query("select o.orders_id, o.delivery_street_address from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_PRODUCTS . " op on (o.orders_id = op.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.orders_status_id = 'Pending' order by o.customers_name");

while($order_query = tep_db_fetch_array($order_excel_query)) {
$data .= $order_query['delivery_street_address'] . "\n";
}
$header = 'someheader';
$data .= "\n" . 'Last Line print check' . "\n";
/*
header("Content-type: application/x-msdownload"); 
header("Content-Disposition: attachment; filename=othours.xls"); 
header("Pragma: no-cache"); 
header("Expires: 0"); 
*/
print "$header\n$data"; 

?>

at the end of the day the code will be good

Link to comment
Share on other sites

oh still this?

Yea I had an error earlier. try this:

<?php
require('includes/application_top.php');
$data='';
$orders_excel_query = tep_db_query("select o.orders_id, o.delivery_street_address from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_PRODUCTS . " op on (o.orders_id = op.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.orders_status_id = '1' order by o.customers_name");

while($order_query = tep_db_fetch_array($order_excel_query)) {
$data .= $order_query['delivery_street_address'] . "\n";
}
$header = 'someheader';
$data .= "\n" . 'Last Line print check' . "\n";
/*
header("Content-type: application/x-msdownload"); 
header("Content-Disposition: attachment; filename=othours.xls"); 
header("Pragma: no-cache"); 
header("Expires: 0"); 
*/
print "$header\n$data"; 

?>

Link to comment
Share on other sites

Thanks for halping me so much I'm still getting the error. So I made Some changes.

 

I creates my own conection string and added the querry

 

It game me a message of Table not found so I change the table names to lowercase and I removed the table infront of it

 

mysql_select_db($database_Name, $MyDBNamr); // CONECTS TO MY DB 

$query_exelOrder = "select o.orders_id, o.delivery_street_address from " . orders . " o left join " . orders_products . " op on (o.orders_id = op.orders_id), " . orders_status . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.orders_status_id = 'Pending' order by o.customers_name"; // THIS IS THE QUERRY 

$exelOrder = mysql_query($query_exelOrder, $MaxInt) or die(mysql_error());
$row_exelOrder = mysql_fetch_assoc($exelOrder);
$totalRows_exelOrder = mysql_num_rows($exelOrder);

 

This runs with ok

But when I try to display the content come up empty

 

<body>
<p> </p>


<table border="0" cellpadding="10" cellspacing="0">
 <tr>
   <td>orders_id</td>
   <td>customers_id</td>
   <td>customers_name</td>
   <td>customers_company</td>
   <td>customers_street_address</td>
   <td>customers_suburb</td>
   <td>customers_city</td>
   <td>customers_postcode</td>
   <td>customers_state</td>
   <td>customers_country</td>
   <td>customers_telephone</td>
   <td>customers_email_address</td>
   <td>customers_address_format_id</td>
   <td>delivery_name</td>
   <td>delivery_company</td>
   <td>delivery_street_address</td>
   <td>delivery_suburb</td>
   <td>delivery_city</td>
   <td>delivery_postcode</td>
   <td>delivery_state</td>
   <td>delivery_country</td>
   <td>delivery_address_format_id</td>
   <td>billing_name</td>
   <td>billing_company</td>
   <td>billing_street_address</td>
   <td>billing_suburb</td>
   <td>billing_city</td>
   <td>billing_postcode</td>
   <td>billing_state</td>
   <td>billing_country</td>
   <td>billing_address_format_id</td>
   <td>payment_method</td>
   <td>cc_type</td>
   <td>cc_owner</td>
   <td>cc_number</td>
   <td>cc_expires</td>
   <td>last_modified</td>
   <td>date_purchased</td>
   <td>orders_status</td>
   <td>orders_date_finished</td>
   <td>currency</td>
   <td>currency_value</td>
 </tr>
 <?php do { ?>
 <tr>
   <td><?php echo $row_exelOrder['orders_id']; ?></td>
   <td><?php echo $row_exelOrder['customers_id']; ?></td>
   <td><?php echo $row_exelOrder['customers_name']; ?></td>
   <td><?php echo $row_exelOrder['customers_company']; ?></td>
   <td><?php echo $row_exelOrder['customers_street_address']; ?></td>
   <td><?php echo $row_exelOrder['customers_suburb']; ?></td>
   <td><?php echo $row_exelOrder['customers_city']; ?></td>
   <td><?php echo $row_exelOrder['customers_postcode']; ?></td>
   <td><?php echo $row_exelOrder['customers_state']; ?></td>
   <td><?php echo $row_exelOrder['customers_country']; ?></td>
   <td><?php echo $row_exelOrder['customers_telephone']; ?></td>
   <td><?php echo $row_exelOrder['customers_email_address']; ?></td>
   <td><?php echo $row_exelOrder['customers_address_format_id']; ?></td>
   <td><?php echo $row_exelOrder['delivery_name']; ?></td>
   <td><?php echo $row_exelOrder['delivery_company']; ?></td>
   <td><?php echo $row_exelOrder['delivery_street_address']; ?></td>
   <td><?php echo $row_exelOrder['delivery_suburb']; ?></td>
   <td><?php echo $row_exelOrder['delivery_city']; ?></td>
   <td><?php echo $row_exelOrder['delivery_postcode']; ?></td>
   <td><?php echo $row_exelOrder['delivery_state']; ?></td>
   <td><?php echo $row_exelOrder['delivery_country']; ?></td>
   <td><?php echo $row_exelOrder['delivery_address_format_id']; ?></td>
   <td><?php echo $row_exelOrder['billing_name']; ?></td>
   <td><?php echo $row_exelOrder['billing_company']; ?></td>
   <td><?php echo $row_exelOrder['billing_street_address']; ?></td>
   <td><?php echo $row_exelOrder['billing_suburb']; ?></td>
   <td><?php echo $row_exelOrder['billing_city']; ?></td>
   <td><?php echo $row_exelOrder['billing_postcode']; ?></td>
   <td><?php echo $row_exelOrder['billing_state']; ?></td>
   <td><?php echo $row_exelOrder['billing_country']; ?></td>
   <td><?php echo $row_exelOrder['billing_address_format_id']; ?></td>
   <td><?php echo $row_exelOrder['payment_method']; ?></td>
   <td><?php echo $row_exelOrder['cc_type']; ?></td>
   <td><?php echo $row_exelOrder['cc_owner']; ?></td>
   <td><?php echo $row_exelOrder['cc_number']; ?></td>
   <td><?php echo $row_exelOrder['cc_expires']; ?></td>
   <td><?php echo $row_exelOrder['last_modified']; ?></td>
   <td><?php echo $row_exelOrder['date_purchased']; ?></td>
   <td><?php echo $row_exelOrder['orders_status']; ?></td>
   <td><?php echo $row_exelOrder['orders_date_finished']; ?></td>
   <td><?php echo $row_exelOrder['currency']; ?></td>
   <td><?php echo $row_exelOrder['currency_value']; ?></td>
 </tr>
 <?php } while ($row_exelOrder = mysql_fetch_assoc($exelOrder)); ?>
</table>
</body>

 

I just get what's is in HTML

at the end of the day the code will be good

Link to comment
Share on other sites

change this

 

s.orders_status_id = 'Pending'

 

to

 

s.orders_status_id = '1'

 

I had it wrong with the previous code.

 

For the previous error you mentioned you probably getting the error if you dont run the page from the catalog root of your shop.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...