Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "123";
- $dbname = "Soidud";
- //Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $userName = htmlspecialchars($_POST["userName"]);
- $userName = "Jakob";
- if ($userName == "") {
- die;
- }
- $sql = "SELECT Cars.CarMark, Cars.CarYear
- FROM Cars, Users
- WHERE 'Jakob'=Users.Name And Users.UserID=Cars.UserID;";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- // output data of each row
- while($row = $result->fetch_assoc()) {
- echo "carMark: " . $row["CarMark"]. "<br>";
- }
- } else {
- echo "0 results";
- }
- echo "finished";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement