MySQL

From: Date: Mon, 12 Feb 2001 17:14:53 +0000
Subject: MySQL
Groups: php.general 
Request: Send a blank email to php-general+get-39231@lists.php.net to get a copy of this message
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 brandon@webintellects.com 800-994-6364 www.webintellects.com --------------------------------------------

« previous php.general (#39231) next »