Jump to content

Jenk

Members
  • Posts

    778
  • Joined

  • Last visited

    Never

Posts posted by Jenk

  1. It's better to redesign your script to send the header()'s before any output. Using output buffering (ob_start/ob_end_flush) does work, but it can be load inducing on the server (all output is stored in memory until flush, instead of direct output to browser)

    Also, meta tag refresh is more reliable than header('Location: ... '); as surprisingly, more browsers support meta's than do header. (Some browsers also have options to ignore header redirects)
  2. depends on your database layout.

    If you have a foreign key for Department name(s) on tbl_telephone numbers, then you can [code]SELECT *
    FROM `tbl_department`
    JOIN `tbl_telephonenumbers`
    ON `tbl_department`.`Department` = `tbl_telephonenumbers`.`Department`
    ORDER BY `tbl_department`.`Department`, `tbl_telephonenumbers`.`last_name` ASC[/code]

    Or just have:
    [code]SELECT *
    FROM `tbl_telephonenumbers`
    ORDER BY `Department`, `Last_name` ASC;[/code]

    otherwise you can add a challenge to your loop:

    [code]<?php
    while ($row = mysql_fetch_array($result)) {
        printf("%s <br>\n", $row["Department"]);
        while ($row2 = mysql_fetch_array($subresult)) {
            if ($row['Department'] == $row2['Department']) {
                printf("%s %s<br>\n", $row2["First_Name"], $row2["Last_Name"]);
            }
        }
        echo '<br><br>';
    }
    ?>[/code]must have a foreign key though.
  3. price is a bad choice for foreign key. what if different properties have the same price?

    create a new field on your clients table for the id of the property, which matches the property id from the properties table that said client is affiliated with.


    as for not escaping.. well, not going to argue but it needs escaping. what happens when you move it to production? Can you absolutely 100% guarantee you won't forget to change it? It's also bad habits to not escape even when you think it's safe. :p
  4. thanks for misquoting. Take a read at the rest of it.

    nanoweb is not default PHP like 99% of php hosts have. It is a custom made webserver, thus only hosts that install nanoweb can run 'php' (which it isn't, it's nanoweb) as a daemon.

    Therefore, it is of no use to this topic.
  5. you might want to remove your DB credentials.. and you'll also want to escape your input for the SQL query.

    As for the original question.. can you clarify please?

    you want to select clients based on property? If so, you'll need a foreign key in either table to link them together, then select based on that.

    [code]SELECT * FROM `clients` WHERE `property_id` = '$foo'[/code]
  6. Best advice: do NOT use PHP for this type of situation. PHP is not designed for this and will have dramatic performance implications.

    Redesign your system so that it does not require a 24/7/365 listener. I find it hard to believe any web-based application requires one.
×
×
  • 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.