I fixed it,

Me so stupid, I had it order by a field that wasn't there.

-----Original Message-----
From: Brandon Orther [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 12, 2001 9:15 AM
To: PHP User Group
Subject: [PHP] MySQL


Hello,

I am new to MySql and I am trying to make a simple script get info from a
table.  Can someone please look at the below code and tell me if they see
what is wrong?  The error I get is: Couldn't execute query.

Code:

<?
// create connection
$connection = mysql_connect("localhost","*****","*****")
        or die("Couldn't make connection.");

// select database
$db = mysql_select_db("nasty_db", $connection)
        or die("Couldn't select database.");

// create SQL statement
$sql = "SELECT keywords, text, ref_num
        FROM tech
        ORDER BY last_name ASC";

// execute SQL query and get result
$sql_result = mysql_query($sql,$connection)
        or die("Couldn't execute query.");

while ($row = mysql_fetch_array($sql_result)) {
        $keywords = $row["keywords"];
        $text = $row["text"];
        $ref_num = $row["ref_num"];

        echo "Keywords: $keywords<BR>\n";
        echo "Text: $text<BR>\n";
        echo "Refrence Number: $ref_num<BR>\n";
}

// free resources and close connection
mysql_free_result($sql_result);
mysql_close($connection);

?>

Thank you,

--------------------------------------------
Brandon Orther
WebIntellects Design/Development Manager
[EMAIL PROTECTED]
800-994-6364
www.webintellects.com
--------------------------------------------


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to