Greetings.. MSSQL and PHP question...

From: Date: Wed, 01 May 2002 16:00:15 +0000
Subject: Greetings.. MSSQL and PHP question...
References: 1 2 3  Groups: php.db 
Request: Send a blank email to php-db+get-18929@lists.php.net to get a copy of this message
I'm toying with this script I found for doing DB queries.. Up until I added the print ("<TABLE...") and print ("</TABLE>"); code, it worked.. can anyone help me find out what I'm doing wrong? (quoting the bit of the script, so as not to do the TMI bit :) What this does now is give me "560k read" and a frozen browser :( Thanks! Glenn <snippage>...
        $db = mssql_connect(DB_HOST, DB_USER, DB_PASS) or DIE("DATABASE FAILED TO RESPOND.");
        $values = array();
                if (!empty($where)){
                if (!strstr(strtolower($where),"where ")) $where = "where $where";
        }
        $query = "select $fields from $tables $where $groupBy $orderBy";
        echo "query=$query<br><br>\n\n";
        if ($show_debug == true) echo "query=$query<br>\n";
        $stmt = mssql_query ($query, $db) or DIE("Table unavailable");
        print ("<TABLE BORDER=1><TR><TH ALIGN=LEFT>COMPANY</TH><TH ALIGN=LEFT>Contact Name</TH><TH ALIGN=LEFT>Email Address</TH></TR>");
        for ($i = 0; $i < mssql_num_rows( $stmt ); ++$i)
                             {
                                     $line = mssql_fetch_row($stmt);
                                     print("<TR><TD>$line[0]</TD><TD>$line[1]</TD><TD>$line[2]</TD></TR>");
                             }
        print ("</TABLE>");
        @mssql_free_result ($stmt);
        @mssql_close($db);
        return $values;
}
PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
--- Glenn E. Sieb, System Administrator Lumeta Corp. mailto:ges@lumeta.com +1 732 357-3514 (V) +1 732 564-0731 (Fax)

« previous php.db (#18929) next »