PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
CREATE TABLE admin ( id int auto_increment primary key, username varchar(64), password varchar(64) ); INSERT INTO admin (username, password) VALUES ('user1', 'user1_password'); INSERT INTO admin (username, password) VALUES ('user2', 'user2_password'); INSERT INTO admin (username, password) VALUES ('user3', 'user3_password');
Copy Clear
Copy Format Clear
<?php $conn = &$mysqli; $_POST['username'] = 'user1'; $username = mysqli_real_escape_string($conn, $_POST['username']); $query = "SELECT * FROM `admin`"; $result = mysqli_query($mysqli, $query); while($row = mysqli_fetch_assoc($result)){ echo $row['username']; } $result->data_seek(0); while($row = mysqli_fetch_assoc($result)){ echo $row['username']; }
Show:  
Copy Clear