Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $dbName = "peoples";
- $tableName = "peoples";
- $idColumn = "id";
- $firstnameColumn = "name";
- $lastnameColumn = "lastname";
- $conn1 = new mysqli("localhost", "root", "my_password", $dbName);
- /* проверка соединения */
- if ($mysqli->connect_errno) {
- printf("Не удалось подключиться: %s\n", $conn1->connect_error);
- exit();
- }
- $query = "select * from ".$tableName." where ".$idColumn."='".$id."'";
- $result = $conn1->query($query);
- while($row2 = mysqli_fetch_assoc($result))
- {
- $record[]=$row2;
- }
- print_r(json_encode($record));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement