when select that link its look like localhost/polte/name
its working fine but main problem is when I enter same names mean (rao its id 1 and another rao id is 2) the name are display in index page when i select that names I am getting data same from only id from 1 what is the problem
the Rao are different person names. But they have same names Rao one had id 1, Rao second person had id 2, when i select in list any Rao that displaying first rao information can you understanding my explanation guido2004.
The main concept is visitor can add their baby names in the my babypage some body have same names, like Rao how can I improve this one to display the information
If you have Rao (id 1) and Rao (id 2) and you click on Rao (id 2), what info do you want to display? The info from Rao (id 2)? The info from both Rao’s ?
If you want to display the info from Rao (id 2), then my second question is:
How can your script know that it must show the info from Rao (id 2) and not Rao (id 1)?
You always get the info for the first Rao because you retrieve only the first row from the mysql result set. If you want both of them, use mysql_fetch_array in a foreach loop. If you don’t know how to do that, see the examples in the manual.
I already used mysql_fetch_array no problem I am getting in list both of rao’s
My question is what info do you want to display?
I want to display both rao’s info
name, fname, age, location etc.
I already told the rao’s are different added person names. when select first rao only display first rao info, when i select second rao name display IInd rao info (but here i am getting Ist rao info) and when used different name its working fine
when i used bname on code not getting corect info. But i used babyid i am getting correct info of both
How can your script know that it must show the info from Rao (id 2) and not Rao (id 1)?
Don’t worry about troubling, and don’t worry about your english. Slowly slowly we will find the solution
The problem is the name isn’t unique. When you click on the second Rao, the query in your script gets all rows with that name, but then you only use mysql_fetch_array once, so you always get only the info from the first Rao.
The script cannot know which Rao you clicked. Impossible. That’s why you need to use a unique key. So you can:
Make sure each name is unique: only 1 Rao can exist in the table.
If 1 is not possible, then you must use the id in the url, and change the query so you use the id to extract the data.
No rao is not last name rao names are different names.
ist rao id is 1 and IInd rao Id is 5 or any id. when I select IInd rao (id=5) I am getting Ist rao data.
Calling name in your code will fetch the first (or last depending on your sql) record with that name and apply it uniformly across the board. if you use teh Id you get around that, and you can set up url rewrites to make the url be pretty vs id=14