我尝试调试这次没有成功。到目前为止,这是我尝试过的
//import java.time.LocalDate;
//import java.time.format.DateTimeFormatter;
String s = "190415";
DateTimeFormatter dtfIn = DateTimeFormatter.ofPattern("yyMMdd");
DateTimeFormatter dtfOut = DateTimeFormatter.ofPattern("yyyyMMdd");
LocalDate ld = LocalDate.parse(s, dtfIn);
System.out.println("NEW : " + dtfOut.format(ld));
答案 0 :(得分:2)
此代码将有效并且更安全
<?php
//Connection part
$servername = "server_adress"; //It can be localhost or 127.0.0.1 or some other IP
$username = "XXXXXX"; //Username for DB
$password = "YYYYYY"; //Password for that user
$database = "ZZZZZZ"; //DB name you are connecting to
//Create a new connection
$conn_to_db = new mysqli($servername, $username, $password,$database);
// Check connection
if ($conn_to_db -> connect_error) {
die("Connection failed: " . $conn_to_db ->connect_error);
}
//Finished connection part
$cid = mysqli_real_escape_string($conn_to_db, $_GET['cid']); //Escapes special characters in a string for use in an SQL statement
$array = array();
if($stmt = $conn_to_db -> ("SELECT * FROM questions WHERE QType = ?")) {
$stmt -> bind_param("s", $cid);
$stmt -> execute();
$stmt -> bind_result($question_from_db); //Here you can put all variables you are fetching from DB
while($stmt -> fetch()){
//Iterate over rows - put your code here to fetch everything you need from DB and put in array
$array[] = array('question' => $question_from_db);
}
$stmt -> close();
}
}
//you can iterate over rows like this
foreach($array as $key => $value) {
echo $value['question'];
}
?>
要记住的事情: