- mysql_affected_rows – Returns the number affected rows in the last mysql operation
- mysql_client_encoding – Returns the name of the character set
- mysql_close – Close the mysql connection
- mysql_connect – Establish a connection to the mysql server
- mysql_create_db – Create a new database
- mysql_data_seek – move the pointer to the specific row
- mysql_db_name – Returns the database name from selected databases
- mysql_db_query() – Its Deprecated. Sends a MySQL query
- mysql_drop_db – Delete the databse . Its depricated
- mysql_errno – Shows the numerical values of the error messages due to mysql operations
- mysql_error – Shows the error messages due to mysql operations
- mysql_escape_string – Modify the string to use in a mysql query
- mysql_fetch_array – Fetch the result both in a numeric array and associative array
- mysql_fetch_assoc – Fetch the result in a associative array
- mysql_fetch_field – Returns column information
- mysql_fetch_lengths– Returns length of each output
- mysql_fetch_object – Fetch the result as object
- mysql_fetch_row – Returns the rows in an array
- mysql_field_flags – Returns the flags associated with the latest result
- mysql_field_len – Returns the length of a specific field
- mysql_field_name – Return the name of the field in the result
- mysql_field_seek – Can be used to move the result pointer
- mysql_field_table – Returns the table name the specified field is in
- mysql_field_type – Returns the type of the specified field in the result
- mysql_free_result – Free the memory that the result used
- mysql_get_client_info – Returns mysql information
- mysql_get_host_info – Returns the host information
- mysql_get_proto_info – Returns the Protocol information
- mysql_get_server_info – Returns the Server information
- mysql_info – Returns the information about the last query
- mysql_insert_id – Return the id generated the previous query
- mysql_list_dbs – List all the databases
- mysql_list_fields – list all the fields in atable
- mysql_list_processes – List mysql process
- mysql_list_tables – List all the tables
- mysql_num_fields – Returns the number of fields in the result
- mysql_num_rows – Returns the number of rows in the result
- mysql_pconnect – Establish a persistent connection to a MySQL server
- mysql_ping – Can be used to the connection to the server
- mysql_query – send a query to the server
- mysql_real_escape_string – Escapes special characters that a query does not support
- mysql_result – Can be used to display result in a specified row
- mysql_select_db – Used to select a database
- mysql_set_charset – Can be used to set a character set
- mysql_stat – returns current status of the mysql server
- mysql_tablename – Returns the table name of a field
- mysql_thread_id – Returns current thread id
- mysql_unbuffered_query – Send the query to the server and buffering the result
Tag Archives: Functions
var_export
It prints parsable string representation of a variable
Example
======
<?php
echo “<pre>”;
$array = array(“php”,”codez”, array(“1”, “1”, “7”),1,2);
var_export($array);
?>
Output
=====
array (
0 => ‘php’,
1 => ‘codez’,
2 =>
array (
0 => ‘1’,
1 => ‘1’,
2 => ‘7’,
),
3 => 1,
4 => 2,
)
var_dump
It displays structured information about one or more expressions .
Example
======
<?php
echo “<pre>”;
$array = array(“php”,”codez”, array(“1”, “1”, “7”),1,2);
var_dump($array);
?>
Output
=====
array(5) {
[0]=>
string(3) “php”
[1]=>
string(5) “codez”
[2]=>
array(3) {
[0]=>
string(1) “1”
[1]=>
string(1) “1”
[2]=>
string(1) “7”
}
[3]=>
int(1)
[4]=>
int(2)
}
compare php versions
if(version_compare(phpversion(), '5.2.0', '<')) {
echo “PHP 5.2.0 (or greater)';
}
Find out php version – PHP
echo phpversion();
?>
Output
====
5.3.3-1ubuntu9.5
Output details about PHP configuration – PHP
echo phpinfo();
?>
List the names of the functions of a module – PHP
$extensionName = “xml”; // Desired module name
print_r(get_extension_funcs($extensionName));
?>
Output
=====
Array
(
[0] => xml_parser_create
[1] => xml_parser_create_ns
[2] => xml_set_object
[3] => xml_set_element_handler
[4] => xml_set_character_data_handler
[5] => xml_set_processing_instruction_handler
[6] => xml_set_default_handler
[7] => xml_set_unparsed_entity_decl_handler
[8] => xml_set_notation_decl_handler
[9] => xml_set_external_entity_ref_handler
[10] => xml_set_start_namespace_decl_handler
[11] => xml_set_end_namespace_decl_handler
[12] => xml_parse
[13] => xml_parse_into_struct
[14] => xml_get_error_code
[15] => xml_error_string
[16] => xml_get_current_line_number
[17] => xml_get_current_column_number
[18] => xml_get_current_byte_index
[19] => xml_parser_free
[20] => xml_parser_set_option
[21] => xml_parser_get_option
[22] => utf8_encode
[23] => utf8_decode
List the modules compiled and loaded – PHP
print_r(get_loaded_extensions());
output
======
Array ( [0] => Core [1] => date [2] => ereg [3] => libxml [4] => openssl [5] => pcre [6] => zlib [7] => bcmath [8] => bz2 [9] => calendar [10] => ctype [11] => dba [12] => dom [13] => hash [14] => fileinfo [15] => filter [16] => ftp [17] => gettext [18] => session [19] => iconv [20] => json [21] => mbstring [22] => standard [23] => posix [24] => Reflection [25] => SPL [26] => shmop [27] => SimpleXML [28] => soap [29] => sockets [30] => Phar [31] => exif [32] => sysvmsg [33] => sysvsem [34] => sysvshm [35] => tokenizer [36] => wddx [37] => xml [38] => xmlreader [39] => xmlwriter [40] => zip [41] => apache2handler [42] => curl [43] => gd [44] => mcrypt [45] => mysql [46] => mysqli [47] => PDO [48] => pdo_mysql [49] => mhash )
check whether an extension is loaded – PHP
echo “The extension is not loaded”;
}
Test if MySQL table exists – PHP
if(mysql_num_rows( mysql_query(“SHOW TABLES LIKE ‘table_name'”)))
echo ” Table exists “