| | |
retriving the name form the databse only once
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
hi
i ahve a mysql databse in which list of name is stored. i wnate to retrive the data form that databse. i have problem in retriving it. if i have name jack 3 times in my databse, but when i wnat to show the names i get jack jack jack 3 times . i wanted to show only once if they have stored as many as times . ls anybody help me?
i ahve a mysql databse in which list of name is stored. i wnate to retrive the data form that databse. i have problem in retriving it. if i have name jack 3 times in my databse, but when i wnat to show the names i get jack jack jack 3 times . i wanted to show only once if they have stored as many as times . ls anybody help me?
•
•
Join Date: Sep 2005
Posts: 51
Reputation:
Solved Threads: 1
•
•
•
•
Originally Posted by aarya
hi
i ahve a mysql databse in which list of name is stored. i wnate to retrive the data form that databse. i have problem in retriving it. if i have name jack 3 times in my databse, but when i wnat to show the names i get jack jack jack 3 times . i wanted to show only once if they have stored as many as times . ls anybody help me?
maybe you can try the sql:
"SELECT DISTINCT FROM $table....."
•
•
Join Date: Jan 2006
Posts: 29
Reputation:
Solved Threads: 0
Your question is not clear... but
try this:
$query="SELECT * FROM table_name";
$result=mysql_query($result, $link);
while ($i++ < mysql_num_rows($result) && $rs = mysql_fetch_array($result)){
$retrieved[$i] = $rs['name_field_inthe_table'];//It will fetch all rows under the field name you specified.
print("$retrieved[$i]");//print("$retrieved[1]"), print("$retrieved[2]") etc. It will print row 1 for print("$retrieved[1]"), row 2 print("$retrieved[2]"), and so on.
}
I hope it would give you an idea to solve your problem.
try this:
$query="SELECT * FROM table_name";
$result=mysql_query($result, $link);
while ($i++ < mysql_num_rows($result) && $rs = mysql_fetch_array($result)){
$retrieved[$i] = $rs['name_field_inthe_table'];//It will fetch all rows under the field name you specified.
print("$retrieved[$i]");//print("$retrieved[1]"), print("$retrieved[2]") etc. It will print row 1 for print("$retrieved[1]"), row 2 print("$retrieved[2]"), and so on.
}
I hope it would give you an idea to solve your problem.
![]() |
Similar Threads
- how to retrive image file from mysql databse using php (PHP)
- Encrypting the Password (ASP.NET)
- HTML Form post to PHP? (PHP)
- Centering a form in VB.NET (VB.NET)
- Unable to insert form data into a database (ASP)
- Scrolling MDI Child form (Visual Basic 4 / 5 / 6)
Other Threads in the PHP Forum
- Previous Thread: PHP newbie...
- Next Thread: second page error
| Thread Tools | Search this Thread |
.htaccess ajax apache api array beginner beneath binary broadband broken button cakephp checkbox class cms code countingeverycharactersfromastring crack cron curl database date decode display dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail match menu mlm mod_rewrite multiple mysql mysql_real_escape_string oop paypal pdf php problem protocol query radio random recursion regex remote script search server sessions sms smtp soap source space sql strip_tags survey syntax system table tutorial undefined update upload url validation validator variable video virus web window.onbeforeunload=closeme; xml youtube





