I'm a newbie dealing with php:
I've a string like $string=admin which i wanna check in my database column named "username" including the values like: guest, admin, abc, def, .... Then wanna display a message if found the string within that column.
I was doing something like:
$query=mysql_query("SELECT * FROM 'table_name' where 'username' like '$string'",$link);
//where $link is connection to my database
$row = mysql_fetch_row($query);
echo $row;
I am getting the following error message when using the code above:
Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\abc\def.php on line 22
I was also thinking to do something like:
$query = mysql_query("SELECT username FROM table_name",$link);
if ($query){
while ($data=mysql_fetch_array($query)){
echo $data['username'];
}
}
Many thanks in advance for the guidance!