0

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?

2 Answers 2

1

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'

Sign up to request clarification or add additional context in comments.

Comments

0

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."'");

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.