Conexión básica con el objeto My
/* Connection */
$ con = new mysqli ("localhost " , "root " , "" , "name_database " );
if ( $ con ->connect_errno ){
echo "Fallo al conectar a MySQL " ;
return ;
}
$ con ->query ("SET NAMES 'UTF8' " );
$ con ->set_charset ('utf-8 ' );
/* Query */
$ resut = $ con ->query ("SELECT * FROM table " );
$ num_rows = $ result ->num_rows ; // For num_rows
$ rows = array ();
while ($ row = $ select ->fetch_array ()){
$ rows [] = $ row ;
}
/* Close Connection */
$ con ->close ();
WHERE LOWER (text ) LIKE LOWER (' %SearchTerm%' )
Saber las filas afectadas de la última query
$ var = $ con ->affected_rows
$ current_date = date ('Y-m-d H:i:s ' );
$ query = "INSERT INTO Table (datetime) VALUES ( $ current_date) "
if (isset ($ _SERVER ['HTTP_X_FORWARDED_FOR ' ]) && $ _SERVER ['HTTP_X_FORWARTDED_FOR ' ] != '' ) {
$ ip_address = $ _SERVER ['HTTP_X_FORWARDED_FOR ' ];
} else {
$ ip_address = $ _SERVER ['REMOTE_ADDR ' ];
}
$ query = "INSERT INTO Table (ip) VALUES ( $ ip_address) "
ciudad a partir de IP (en varchar)
http://www.geoplugin.net/json.gp?ip=
Envío de Mails con PHPMailer
$ mail ->AddAttachment ($ _FILES ['file ' ]['tmp_name ' ],
$ _FILES ['file ' ]['name ' ]);