I have a question. I have a database that keeps information about a person. I am accessing the database and displaying their information in the browser. I have a problem with multiple fields. For instance. We have 3 phone numbers for that one individual. When I query the database to display their information, the first phone number stored is displayed three times, instead of each phone number in a seperate text box. How can I manipulate php to get a phone number, then get the next phone number, and finally get the third. I have this problem with multiple addresses also.
Thank you
Need Help
Moderator: General Moderators
**I DO MY QUERIES UP HERE**
if($numRows > 0
{
while($rows = mysql_fetch_array($result))
{
echo '**THIS IS WHERE I ECHO OUT MY FORM THAT WILL BE DISPLAYED ON THE BROWSER CONTAINING THE INDIVIDUAL'S INFORMATION..
...
...
<input name="txtAreaCode1" type="text" id="txtAreaCode1" value="'.$rows['Area_Code'].'" size="5" maxlength="3"> **This will display a text box and put the area code in it.
<td><input name="txtPhoneNumber1" type="text" id="txtPhoneNumber1" value="'.$rows['Number'].'" size="10" maxlength="7"></td> **this puts the number into a text box
I just repeat this step three times, each time I name the txtBox and id a different name.
if($numRows > 0
{
while($rows = mysql_fetch_array($result))
{
echo '**THIS IS WHERE I ECHO OUT MY FORM THAT WILL BE DISPLAYED ON THE BROWSER CONTAINING THE INDIVIDUAL'S INFORMATION..
...
...
<input name="txtAreaCode1" type="text" id="txtAreaCode1" value="'.$rows['Area_Code'].'" size="5" maxlength="3"> **This will display a text box and put the area code in it.
<td><input name="txtPhoneNumber1" type="text" id="txtPhoneNumber1" value="'.$rows['Number'].'" size="10" maxlength="7"></td> **this puts the number into a text box
I just repeat this step three times, each time I name the txtBox and id a different name.
Hello,
Please show your table and your sql query, otherwise it will be difficult to locate the mistake...
table like this with the most important informations
name: tablename
column1: columnname varchar(20)
column2: columnname varchar(20)
etc....
SQL like:
SQL SELECT column, column2 FROM tablename WHERE id = '100' //just an example
ok but was is with $rows['Number'], this is every time the same!<td><input name="txtPhoneNumber1" type="text" id="txtPhoneNumber1" value="'.$rows['Number'].'" size="10" maxlength="7"></td> **this puts the number into a text box
I just repeat this step three times, each time I name the txtBox and id a different name.
Please show your table and your sql query, otherwise it will be difficult to locate the mistake...
table like this with the most important informations
name: tablename
column1: columnname varchar(20)
column2: columnname varchar(20)
etc....
SQL like:
SQL SELECT column, column2 FROM tablename WHERE id = '100' //just an example