Hướng dẫn is mysql_query deprecated?
(PHP 4, PHP 5) mysql_query — Send a MySQL query Descriptionmysql_query(string Parametersquery An SQL query The query string should not end with a semicolon. Data inside the query should be properly escaped. link_identifier
The MySQL connection. If the link identifier is not specified, the last link opened by mysql_connect() is assumed. If no such link is found, it will try to create one as if mysql_connect() had been called with no arguments. If no connection is found or established, an
Return Values For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query() returns a resource on success, or For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, mysql_query() returns
The returned result resource should be passed to mysql_fetch_array(), and other functions for dealing with result tables, to access the returned data. Use mysql_num_rows() to find out how many rows were returned for a SELECT statement or mysql_affected_rows() to find out how many rows were affected by a DELETE, INSERT, REPLACE, or UPDATE statement. mysql_query() will also fail and return ExamplesExample #1 Invalid Query The following query is syntactically invalid, so mysql_query() fails and returns
Example #2 Valid Query The following query is valid, so mysql_query() returns a resource.
See Also
jack dot whoami at gmail dot com ¶ 15 years ago
halion at gmail dot com ¶ 15 years ago
davidc at edeca dot net ¶ 19 years ago
nikhil-php at nols dot com ¶ 22 years ago
Mr. Tim ¶ 13 years ago
Anonymous ¶ 16 years ago
mysql_query($query); ialsoagree ¶ 13 years ago
ddlshack [at] gmail.dot.com ¶ 11 years ago
mysql_query('INSERT INTO `'.$table.'` (`'.implode('`,`', $keys).'`) VALUES (\''.implode('\',\'', $values).'\')'); php at arcannon dot com ¶ 16 years ago
masteracc0 at aol dot com ¶ 14 years ago
rob desbois ¶ 16 years ago
veyita_angi at hotmail dot com ¶ 15 years ago
cc+php at c2se dot com ¶ 16 years ago
mysql_query_params__callback( $at ) { fernandoleal at loytek dot com ¶ 14 years ago
Anonymous ¶ 19 years ago
rogier ¶ 14 years ago
ix at nivelzero dot ro ¶ 17 years ago
Anonymous ¶ 13 years ago
mwwaygoo at hotmail dot com ¶ 10 years ago
jon at websandbox dot net ¶ 17 years ago
allen a brooker gb net ¶ 19 years ago
Predrag Supurovic ¶ 18 years ago
Richie (at) RichieBartlett.com ¶ 12 years ago
= mysql_connect('YOUR_DB_ADDRESS','YOUR_DB_USER','YOUR_DB_PASS') or die("Database error");
chris at hotmail dot com ¶ 19 years ago
wjyong at sh263 dot net ¶ 17 years ago
|