Name
mysql_query( )
Synopsis
mysql_query(sql_statement[, connection
])
Use this to execute an SQL statement given. An identifier may be
given 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
), true is returned when the function is
successful. Otherwise, a reference to a results set is returned.
... $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.
Get MySQL in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.