Jump to content

Search the Community

Showing results for tags 'mixed queries and loops'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hello, maybe someone can help me untangle this to make it do as I want it to... SQL Query objective 3 Tables: #1 – product product_ID , product_name , page_group , default_price TILE1212 , 12 X 12 Tile , ElsoT , 40.35 TILE810 , 8 X 10 Tile , ElsoT , 29.75 TILE88 , 8 X 8 Tile , ElsoT , 27.95 TILE68 , 6 X 8 Tile , ElsoT , 25.75 #2 – product_options option_number , product_ID 1920 , TILE1212 1945 , TILE810 1947 , TILE88 1966 , TILE68 #3 – option_choices option_number , disp_value , percentage 1920 , 1-2 , 0.000 1920 , 3-11 , 0.063 1920 , 12-23 , 0.094 1920 , 24-35 , 0.125 1920 , 36-47 , 0.156 1920 , 48-59 , 0.188 1920 , 60-71 , 0.219 1920 , 72+ , 0.250 1945 , 1-2 , 0.000 1945 , 3-11 , 0.000 1945 , 12-23 , 0.000 1945 , 24-35 , 0.000 1945 , 36-47 , 0.000 1945 , 48-59 , 0.000 1945 , 60-71 , 0.000 1945 , 72+ , 0.000 1947 , 1-2 , 0.000 1947 , 3-11 , 0.000 1947 , 12-23 , 0.000 1947 , 24-35 , 0.000 1947 , 36-47 , 0.000 1947 , 48-59 , 0.000 1947 , 60-71 , 0.000 1947 , 72+ , 0.000 1966 , 1-2 , 0.000 1966 , 3-11 , 0.000 1966 , 12-23 , 0.000 1966 , 24-35 , 0.000 1966 , 36-47 , 0.000 1966 , 48-59 , 0.000 1966 , 60-71 , 0.000 1966 , 72+ , 0.000 Objective is to create a pricing grid with column headings: Tile size, to be populated with “product.product_name” next 8 column headings to be populated with “option_choices.disp_value” These 8 columns under “option_choices.disp_value” to be polulated with “option_choices.percentage” This has gotten me close but not yet what I am looking for; $group_query="SELECT * FROM product, product_options, option_choices WHERE product.page_group='ElsoT' AND product.product_ID=product_options.product_ID AND product_options.option_number=option_choices.option_number "; $group_result=mysql_query($group_query); $num=mysql_numrows($group_result); the $num here results in all 32 records but really only want the 4 product records. Next we build our display table Heading using while loop to populate column headings: <table border="1" cellspacing="2" cellpadding="2"> <tr><td><font face="Arial, Helvetica, sans-serif">Size</font></td> <?php $numss=8; $iii=0; while ($iii < $numss) { $f9=mysql_result($group_result,$iii,"disp_value"); ?> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f9; ?></font></td> <?php $iii++; } ?> </tr> Last the actual display table <?php $i=0; do { $f3=mysql_result($group_result,$i,"product_name"); $f4=mysql_result($group_result,$i,"default_price"); ?> <tr> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f3; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f4; ?></font></td> <?php $nums=8; $ii=0; while ($ii < $nums) { $f8=mysql_result($group_result,$ii,"percentage"); ?> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f8; ?></font></td> <?php $ii++; } ?> </tr> <?php $i++; } while ($i < $num) ; ?> </table> What I am after is for this example to display: 4 rows plus the header row with once only tile name first column Base price in second column percentage discounts to loop to remain in the same row as the tile it represents. See my working result page to better see what I am after... or not after..http://www.elsographics.com/tiles/elso.php Thanks in advance to anyone who can help me sort this out
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.