added uid to uname function
This commit is contained in:
parent
5873afae07
commit
00bffab9e2
1 changed files with 23 additions and 0 deletions
23
search.php
23
search.php
|
@ -28,3 +28,26 @@ function username($uname){
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function uid($uid){
|
||||
global $dbservername;
|
||||
global $dbusername;
|
||||
global $dbpassword;
|
||||
global $dbname;
|
||||
|
||||
$conn = new mysqli($dbservername, $dbusername, $dbpassword, $dbname);
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
$sql = "SELECT username FROM smz_messages_users WHERE uid='$uid'";
|
||||
$result = $conn->query($sql);
|
||||
$conn->close();
|
||||
if ($result->num_rows > 0) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
return $row["username"];
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue