Page 1 of 1
Need Help
Posted: Tue Mar 30, 2004 7:57 pm
by brookside
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
Posted: Tue Mar 30, 2004 8:03 pm
by andre_c
what does the db table look like?
Posted: Tue Mar 30, 2004 8:07 pm
by brookside
I have an Address_ID, then Street, city, state and zip. There are three different addresses stored in the database, but it repeats the first one three times?
Posted: Tue Mar 30, 2004 8:14 pm
by tim
show some code?

Posted: Tue Mar 30, 2004 8:22 pm
by brookside
**I DO MY QUERIES UP HERE**
if($numRows > 0
{
while($rows = mysql_fetch_array($result))
{
echo '
Posted: Tue Mar 30, 2004 8:26 pm
by brookside
**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.
Posted: Wed Mar 31, 2004 2:04 am
by Pozor
Hello,
<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.
ok but was is with $rows['Number'], this is every time the same!
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