Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'poor coding?'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 1 result

  1. Hi All. I am having a problem displaying results of my page, maybe I think because I've poorly written the code. I have these tables: 1. customers (cust_id, name, address, TIN, price, timestamp) 2. purchases(po_id, cust_id, delivery_address, delivered, receivedby, paid, encoderid, agentid, timestamp) 3. po_content(table_id, po_id, prod_id, ordered, delivered, srp, timestamp) when generating a query, now that the database have a lot of content inside It's taking a while to display the result on the server and it shows "page cannot be displayed" while querying it from another computer via LAN. here's what I wrote: $rownum = 1; $a = "SELECT * FROM purchases ORDER BY timestamp ASC LIMIT $start $display"; $b = mysql_query($a); while ($c = mysql_fetch_array($) { $d = "SELECT * FROM po_content WHERE po_id='{$c['po_id']}'"; $e = mysql_query($d); while ($f = mysql_fetch_array($e)) { $amount = $amount + ($f['srp'] * $f['delivered']); } $total = $total + $amount; $g = "SELECT * FROM customers WHERE cust_id='{$c['cust_id']}'"; $h = mysql_query($g); $i = mysql_fetch_array($h); //bg stuff so it would be seen nicely if ($rownum % 2 == 0 ) { $bgcolor = '"bgcolor=#f3f3f3"'; } else { $bgcolor = '"bgcolor=#ffffff"'; } print ' <table width="100%" border="0" cellspacing="0" cellpadding="0" ' . $bgcolor . '> <tr> <td>' . $rownum . '. </td> <td>' . $c['po_id'] . '</td> <td>' . $i['name'] . '</td> <td>' . date('m d, Y', $c['timestamp']) . '</td> <td>$ ' . number_format($amount, 2) . '</td> <td>' . $agent . '</td> <td>' . $encoder . '</td> </tr> </table> '; $amount = 0; //reset the amount before looping again. } print '<td><div align="right">' . $number_format($total, 2) . '</div></td>'; There. $agent and $encoder has been called from an if(in_array) but still I think it adds up to the whole process. Now that the structure of the database has been like that. Would there be a damage control type thing that would optimize my queries? Many many thanks in advance!
×
×
  • Create New...