0

i have a php question, how can i get all the data from the same column from all row in a mysql table.

Table name : user
Here's my table structure:
name
url

How can i use php to get all the data in URL column from each row? (P/S i have my connection to database established , just not sure the musql query for this)

Thanks and have a nice day.

0

2 Answers 2

3

This really is extremely basic stuff and you could have found this anywhere, it's even in the PHP manual. But alas, here you go.

$result = mysql_query("SELECT url FROM user");
while($row=mysql_fetch_assoc($result){
   echo $row['url'].'\n';
}

Please read up on some basic stuff to avoid asking these kind of questions: http://www.freewebmasterhelp.com/tutorials/phpmysql

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

1 Comment

True, matter of habit for some reason.
1
$query = "select url from user";
$result = mysql_query($query);

while( $row = mysql_fetch_assoc($result)){
echo $row['url'] . '<br>';
}

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.