(PHP 4, PHP 5) Show 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
nikhil-php at nols dot com ¶ 22 years ago
Anonymous ¶ 16 years ago
mysql_query($query); Mr. Tim ¶ 14 years ago
davidc at edeca dot net ¶ 19 years ago
ialsoagree ¶ 13 years ago
ddlshack [at] gmail.dot.com ¶ 11 years ago
mysql_query('INSERT INTO `'.$table.'` (`'.implode('`,`', $keys).'`) VALUES (\''.implode('\',\'', $values).'\')'); masteracc0 at aol dot com ¶ 14 years ago
rob desbois ¶ 16 years ago
veyita_angi at hotmail dot com ¶ 15 years ago
php at arcannon dot com ¶ 16 years ago
Anonymous ¶ 19 years ago
rogier ¶ 14 years ago
cc+php at c2se dot com ¶ 16 years ago
mysql_query_params__callback( $at ) { ix at nivelzero dot ro ¶ 17 years ago
fernandoleal at loytek dot com ¶ 14 years ago
mwwaygoo at hotmail dot com ¶ 10 years ago
jon at websandbox dot net ¶ 17 years ago
Anonymous ¶ 13 years ago
Predrag Supurovic ¶ 18 years ago
allen a brooker gb net ¶ 19 years ago
Richie (at) RichieBartlett.com ¶ 13 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
Apa fungsi mysql_query?Fungsi mysql_query dalam PHP adalah untuk menjalankan perintah atau instruksi query ke database MySQL dimana mysql_query() merupakan sarana dasar yang akan menampung jenis query apapun di dalam nya.
Apa fungsi dari mysql_connect ()?mysql_connect atau mysqli_connect adalah nama fungsi php untuk menjalankan argumen agar terkoneksi ke server mysql dan atau database.
Apa itu mysql_fetch_array ()?Fungsi mysql_fetch_array() merupakan salah satu fungsi yang banyak digunakan dalam proses pengambilan data MySQL. Fungsi ini akan menangkap data dari hasil perintah query dan membentuknya ke dalam array asosiatif dan array numerik.
Apa itu result di php?$result adalah variabel yang akan menampung hasil dari fungsi mysql_query(). Jika fungsi mysql_query() berhasil dijalankan, variabel $result akan berisi hasil query, namun jika query gagal, variabel ini akan berisi nilai boolean FALSE. Variabel $result bertipe resources (sama dengan hasil dari fungsi mysql_conncect()).
|