Accueil > Programmation > PHP > php:mysqli
php:mysqli
Publié le 7 avril 2017, dernière mise-à-jour le 30 septembre 2017, 7 visites, visites totales.
$mysqli = @new mysqli('localhost', 'fake_user', 'my_password', 'my_db');
if ($mysqli->connect_errno) { die('Erreur de connexion : ' .$mysqli->connect_errno);}
$mysqli->query("SET NAMES <span class="base64" title="PGNvZGUgY2xhc3M9J3NwaXBfY29kZSBzcGlwX2NvZGVfaW5saW5lJyBkaXI9J2x0cic+dXRmODwvY29kZT4="></span>");
function noms_champs_dune_table($mysqli, $table ) {
$temp="SELECT * FROM ".$table." ;";
$names=array();
$result=$mysqli->query($temp);
$field = $mysqli->field_count;
while ($finfo = $result->fetch_field()) {
$names[] = $finfo->name;
}
return $names;
}
print_r( noms_champs_dune_table($mysqli,"gperiodic") );
function tables_dune_bd($mysqli){
$tables=array();
$temp='SHOW TABLES';
$requete=$mysqli->query($temp);
while ($row=$requete->fetch_row()){
$tables[]=$row[0];
}
return $tables;
}
print_r(tables_dune_bd($mysqli) );
function TableVersTableau($mysqli,$table){
$datas=array();
$temp="SELECT * FROM ".$table;
$resultat=$mysqli->query($temp);
while ($row=$resultat->fetch_array()){$datas[]=$row;}
return $datas;
}
$Lignes=TableVersTableau($mysqli,$table);
- $affected_rows
- autocommit
- begin_transaction
- change_user
- character_set_name
- $client_info
- $client_version
- close
- commit
- $connect_errno
- $connect_error
- __construct
- debug
- dump_debug_info
- $errno
- $error_list
- $error
- $field_count
- get_charset
- get_client_info
- mysqli_get_client_stats
- mysqli_get_client_version
- get_connection_stats
- $host_info
- $protocol_version
- $server_info
- $server_version
- get_warnings
- $info
- init
- $insert_id
- kill
- more_results
- multi_query
- next_result
- options
- ping
- poll
- prepare
- query
- real_connect
- real_escape_string
- real_query
- reap_async_query
- refresh
- release_savepoint
- rollback
- rpl_query_type
- savepoint
- select_db
- send_query
- set_charset
- set_local_infile_default
- set_local_infile_handler
- $sqlstate
- ssl_set
- stat
- stmt_init
- store_result
- $thread_id
- thread_safe
- use_result
- $warning_count
mysqli_result
- int $current_field ;
- int $field_count ;
- array $lengths ;
- int $num_rows ;
- /* Methods */
- bool data_seek ( int $offset )
- mixed fetch_all ([ int $resulttype = MYSQLI_NUM ] )
- mixed fetch_array ([ int $resulttype = MYSQLI_BOTH ] )
- array fetch_assoc ( void )
- object fetch_field_direct ( int $fieldnr )
- object fetch_field ( void )
- array fetch_fields ( void )
- object fetch_object ([ string $class_name = "stdClass" [, array $params ]] )
- mixed fetch_row ( void )
- bool field_seek ( int $fieldnr )
- void https://php.net/manual/en/mysqli-result.free.php ( void )