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 8626485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:02:35+00:00 2026-06-12T08:02:35+00:00

I am creating a quoting system for our company and I have come into

  • 0

I am creating a quoting system for our company and I have come into a small problem. Here’s the rundown; I have two tables, one named data, the other named zips. The client enters their gender, age, if they use tobacco, zipcode, and state.

Here’s the data table:

image

Here’s the zips table:

image

I’ve queried the two tables to join based on zip lookup code. Here’s the query I’m using:

SELECT data.Monthly_Rate, zips.ZIP_LOOKUP_CODE AS Expr1, zips.State, zips.County, zips.City, zips.Zipcode
FROM data INNER JOIN
zips ON data.ZIP_LOOKUP_CODE = zips.ZIP_LOOKUP_CODE
WHERE (zips.Zipcode = '$zipcode') AND 
(data.Company_Old LIKE '%Blue Cross%') AND
(data.Plan IN ('A','F','F (High)','G','N')) AND 
(data.Gender = '$gender') AND 
(data.Age = '$age') AND 
(data.Tobacco = '$tobacco') AND 
(data.State = '$state');

Now what I want to do is output this in php in a table. The problem I’m coming across is there are multiple Plan letters under the “Plan” column. I only want to return 5 different ones, but the issue is some companies don’t offer all 5 of those plans, so in this instance when I’m outputting the array, the rate for a certain plan will line up in the wrong column in the table.

Basically, I don’t know how to align the data correctly in the specific column it should be in. In a scenario where a plan A, F, and N are only available for the company, it will fill the first three fields, and the rate for plan N will not line up in the plan N column.

I need to figure out how to associate a given rate with the Plan letter, and output it correctly in the table. In the instance below Plan A rate is $111.40, Plan F is 135.37 and Plan N rate is $96.52. As you see, the Plan N rate is not aligning correctly. How do I go about fixing this?

Table output:

image

This is what I’m using to output the array in PHP:

while($row = mysql_fetch_array($PlanRates))
{   
$Plan = "$" . number_format($row['Monthly_Rate'], 2, '.', '');
echo "<td align='center'>$Plan</td>";           
}
echo "</tr>";
mysql_free_result($PlanRates);
  • 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-12T08:02:36+00:00Added an answer on June 12, 2026 at 8:02 am

    Retrieve plan as well in your SQL query

    SELECT data.Monthly_Rate, data.Plan ...
    

    Then use the below code

    while($row = mysql_fetch_array($PlanRates)) {   
      $Plans[$row['Plan']] = "$" . number_format($row['Monthly_Rate'], 2, '.', '');
    }
    echo "<td align='center'>".(isset($Plans['A']) ? $Plans['A'] : '')."</td>"; 
    echo "<td align='center'>".(isset($Plans['F']) ? $Plans['F'] : '')."</td>"; 
    echo "<td align='center'>".(isset($Plans['F (High)']) ? $Plans['F (High)'] : '')."</td>"; 
    echo "<td align='center'>".(isset($Plans['G']) ? $Plans['G'] : '')."</td>"; 
    echo "<td align='center'>".(isset($Plans['N']) ? $Plans['N'] : '')."</td>"; 
    

    You shouldn’t be mixing your data processing logic and your presentation this way though. You should use a function from which to run the query and return the data as an array. Then iterate over the array in the html markup.

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

Sidebar

Related Questions

I'm creating a quoting system within a custom bulletin board. What I need to
Creating column at runtime, with DataTemplateSelector. Have exception at XamlReader.Load: System.Windows.StaticResourceExtension. How can i
Creating a voting system just like stackoverflow. Questions like this have been asking several
Creating a call stack diagram We have just recently been thrown into a big
Creating liquid layouts is an immense pain. Now, I totally understand that tables should
Creating a JApplet I have 2 Text Fields, a button and a Text Area.
I creating a web application using JSF,Hibernate,Spring. I have added a filter for checking
Creating the closure is easy but using it is confusing for me. Here is
creating 20 viewcontrollers and calling them one after the other from the mainviewcontroller as
Creating a rating system and the info is not being transmitted through my $_GET

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.