I'm using the following code:
$con = mysql_connect("NOTGIVEN","NOTGIVEN","NOTGIVEN");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("user_live", $con);
$result = mysql_query("SELECT * FROM user_new_post ORDER BY user_date_post DESC");
while($row = mysql_fetch_array($result))
{
print($row['user_full_name']);
}
And instead of selecting the table/row user_new_post
how can I be able to select individual values "users" and then print/echo them out?
Either you have another table "user" on which you can use
SELECT * FROM user
or you can use a WHERE clause
SELECT * FROM user_new_post WHERE user_full_name like 'a%' ORDER BY user_date_post DESC
to get all user full name starting with 'a'
You may perform a search for exactly a user name like this:
$result = mysql_query("SELECT * FROM user_new_post WHERE user_name= '".$user."'");
Or perform a regular expression in the query to search for user's name match your pattern:
$result = mysql_query("SELECT * FROM user_new_post WHERE user_name REGXP '".$pattern."'");
Or use like keywork provied by MySQL:
$result = mysql_query("SELECT * FROM user_new_post WHERE user_name like '".$user."'");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.