Jump to content

How would i do this?


LiamProductions

Recommended Posts

<?php

$user = $_POST['user'];
$query = "SELECT col FROM users WHERE user='$user'";
$result = mysql_query($query)or die(mysql_error());

if (mysql_num_rows($result) > 0){
  echo "Found a match!";
} else {
   echo "No results found.";
}

?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/71185-how-would-i-do-this/#findComment-358047
Share on other sites

$user = mysql_real_escape_string($_POST['user']);

$sql = "SELECT * FROM `table` WHERE `username` LIKE '%$user%'";
$res = mysql_query($sql) or die(mysql_error());

if(mysql_num_rows($res) == 0){
echo "No users with that username exist!\n";
}else {
while($row = mysql_fetch_assoc($res)){
echo "<a href=\"/users.php?username=$row[username]\">$row[username]</a><br>\n";
}
}

Link to comment
https://forums.phpfreaks.com/topic/71185-how-would-i-do-this/#findComment-358049
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.