mysql_query()
resource mysql_query(sql_statement[, connection])Use this function to execute an SQL statement given. You
may give an identifier as a second argument to query through a
different connection. The function returns false if the query is
unsuccessful. For SQL statements not designed to return a results set
(e.g., INSERT), the function returns trueif
successful. If not successful, it returns a reference to a results
set. Here is an example:
...
$sql_stmnt = "SELECT wrid, client_name, description
FROM workreq, clients
WHERE workreq.clientid = clients.clientid";
$results = mysql_query($sql_stmnt, $connection);
while($row = mysql_fetch_row($results)) {
print "WR-$row[0]: $row[1] - $row[2] \n";
}
...Here’s one line from the output of this script:
WR-5755: Farber Investments - Can't connect to network.