jjxhp

<?php
$mysqli 
= new mysqli("localhost""my_user""my_password""world");

/* check connection */
if (mysqli_connect_errno()) {
    
printf("Connect failed: %s\n"mysqli_connect_error());
    exit();
}

$city "Amersfoort";

/* create a prepared statement */
if ($stmt $mysqli->prepare("SELECT District FROM City WHERE Name=?")) {

    
/* bind parameters for markers */
    
$stmt->bind_param("s"$city);

    
/* execute query */
    
$stmt->execute();

    
/* bind result variables */
    
$stmt->bind_result($district);

    
/* fetch value */
    
$stmt->fetch();

    
printf("%s is in district %s\n"$city$district);

    
/* close statement */
    
$stmt->close();
}

/* close connection */
$mysqli->close();
?> 

分类:

技术点:

相关文章:

  • 2021-12-04
  • 2021-11-04
  • 2021-10-13
  • 2022-02-16
  • 2022-03-04
  • 2022-12-23
  • 2021-11-17
  • 2021-12-26
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-02
  • 2021-12-26
  • 2021-07-26
相关资源
相似解决方案