Created
June 23, 2018 12:05
-
-
Save u-r-w/d83ee3ab3e19bd2f256611eb98625226 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$link = mysqli_connect("localhost", "newuser", "password", "proj1"); | |
if($link === false){ | |
die("ERROR: Could not connect. " . mysqli_connect_error()); | |
} | |
// Attempt select query execution | |
$q = $_GET['q']; | |
$sql = "SELECT * FROM t2 WHERE f1 = '$q'"; | |
if($result = mysqli_query($link, $sql)){ | |
if(mysqli_num_rows($result) > 0){ | |
$row = mysqli_fetch_array($result); | |
$loc = $row['f2']; | |
} | |
} | |
mysqli_close($link); | |
header('Location: '.$loc); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment