Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8391517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:17:02+00:00 2026-06-09T19:17:02+00:00

I have a shipping module I’m working to wrap up and am trying to

  • 0

I have a shipping module I’m working to wrap up and am trying to query a mysql table, count the number of rows for a given line item on a PO, and store that result in an array. I don’t think I can do group by within mysql as it will not provide a result for a line item that hasn’t had any shipments against it. The intent is to take the original order quantity, count the number of units shipped against that via my query, and then subtract the units shipped from the original amount providing the remaining units to be shipped against that line item.

To ensure I receive even the zero qty for line items without shipments and to store that in the array I am trying to loop my query and store each single result as a value within my array. I’m open to suggestions on changing the approach if there is a better way.

Here is what I have for my query:

// I have a previous query that provides the number of line items for a given po.  that number is stored in variable $num1 
$a=1;
$LiShipped = array();

while($a<$num1){

$query2="SELECT count(E3_SN) AS SCount FROM Shipped WHERE Cust_Ord_Num = '$SO_Num' AND LineItem=$a";
$LiShipped[] = mysql_fetch_array($query2);
$a++;
}

Unfortunately when I go to iterate through my array it appears as though nothing is stored in the array.

<?php
echo $LiShipped[0]; //results nothing
echo var_dump($LiShipped); // results array(1) { [0]=> NULL } array(2) { [0]=> NULL [1]=> NULL } array(3) { [0]=> NULL [1]=> NULL [2]=> NULL }
?>

Looks like all null values.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T19:17:03+00:00Added an answer on June 9, 2026 at 7:17 pm

    You need to execute the query (by calling mysql_query()) before you try and attempt to retrieve the result:

    $query2="SELECT count(E3_SN) AS SCount FROM Shipped WHERE Cust_Ord_Num = '$SO_Num' AND LineItem=$a";
    $query2 = mysql_query( $query_2); // <-- NEED THIS
    $LiShipped[] = mysql_fetch_array( $query2);
    

    Note the above omits basic error checking and sanitation of the SQL query to prevent SQL injection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have enabled free shipping for all the states under US and configured table
So I have a parent module with a bunch of sub-modules, and I'm trying
I am working on ajax module for Shopping cart in Magento. Consider i have
I'm trying to create a gift wrapping module for Drupal commerce. I have created
I have recently created a new shipping module in Magento 1.3.2 with the aid
I have a shipping/billing input form and I'm having trouble styling the input fields
I have a client who is using OpenCart v.1.5.2.1 and they have one shipping
I have a free shipping price rule which is configured like this: All customer
I have created a custom shipping method to show depo-names from which customers will
We have a Magento Shop and the shipping settings are already set and everything

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.