PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
CREATE TABLE user_value (`user_name` varchar(4), `user_pass` varchar(3)) ;
Copy Clear
Copy Format Clear
<?php $q = mysqli_prepare( $mysqli, "INSERT INTO `user_value` (`user_name`, `user_pass`) VALUES (?, ?)" ); $user_names = "lox"; $user_pass = "123"; mysqli_stmt_bind_param($q, "ss", $user_names, $user_pass); mysqli_stmt_execute($q); $query = "SELECT user_name, user_pass FROM user_value"; $result = $mysqli->query($query); if ($result) { // Fetch each row from the result set while ($row = $result->fetch_assoc()) { echo "User Name: " . $row['user_name'] . ", User Pass: " . $row['user_pass'] . "<br>"; } $result->free(); } else { // Handle the error if the query fails echo "Error: " . $mysqli->error; }
Show:  
Copy Clear