|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Need to idea for how to make the following procedure or function:
What I have: On the screen I have a simple list with with the most important fields of a the records in an MySQL database. What I want to do: I want a program/function/procedure so I can click a link in each record and then jump to a form showing all the fields. Why I want to do it: So I can see all the fields in the record, Or edit the data in the form The problem: The problem is NOT the program for the list or the form "Show record" or the form "Edit record" What I would like to get here: Either the idea for how to implement this program/function/procedure or a complete program/function/procedure to do it. This request may be boiled down to: How can I extract the record number from a simple database list so I can use it to a search or to select a specific record. Arne flying_donald_duck@msn.com |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Arne Essa Madsen wrote:
> Need to idea for how to make the following procedure or function: > > What I have: > On the screen I have a simple list with with the most important fields > of a the records in an MySQL database. > > What I want to do: > I want a program/function/procedure so I can click a link in each record > and then jump to a form showing all the fields. while you type out the most important columns for the row, make a link to a second page with the line ID while($row=mysqli->fetch_array()) { echo "<a href=\"otherpage.php?id={$row['id']}\">Row {$row['id']}:</a>\n"; //do your code for the columns you did want to show } On the otherpage.php you can then do: $query="SELECT * FROM table WHERE id={$_GET['id']}"; > Why I want to do it: > So I can see all the fields in the record, Or edit the data in the form > > The problem: > The problem is NOT the program for the list or the form "Show record" or > the form "Edit record" > > What I would like to get here: > Either the idea for how to implement this program/function/procedure or > a complete program/function/procedure to do it. > > This request may be boiled down to: > How can I extract the record number from a simple database list so I can > use it to a search or to select a specific record. You use the ID column which you have an auto_increment, if you don't have any primary key (in which case you use that one), if you don't have anything that makes a row unique, then it's most likely you have a bad database design and you should start all over with the database. -- //Aho |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Thanks a lot,
Arne J.O. Aho wrote: > Arne Essa Madsen wrote: >> Need to idea for how to make the following procedure or function: >> >> What I have: >> On the screen I have a simple list with with the most important fields >> of a the records in an MySQL database. >> >> What I want to do: >> I want a program/function/procedure so I can click a link in each record >> and then jump to a form showing all the fields. > > while you type out the most important columns for the row, make a link to a > second page with the line ID > > while($row=mysqli->fetch_array()) { > echo "<a href=\"otherpage.php?id={$row['id']}\">Row {$row['id']}:</a>\n"; > //do your code for the columns you did want to show > } > > On the otherpage.php you can then do: > > $query="SELECT * FROM table WHERE id={$_GET['id']}"; > > >> Why I want to do it: >> So I can see all the fields in the record, Or edit the data in the form >> >> The problem: >> The problem is NOT the program for the list or the form "Show record" or >> the form "Edit record" >> >> What I would like to get here: >> Either the idea for how to implement this program/function/procedure or >> a complete program/function/procedure to do it. >> >> This request may be boiled down to: >> How can I extract the record number from a simple database list so I can >> use it to a search or to select a specific record. > > You use the ID column which you have an auto_increment, if you don't have any > primary key (in which case you use that one), if you don't have anything that > makes a row unique, then it's most likely you have a bad database design and > you should start all over with the database. > |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Arne Essa Madsen wrote:
> Need to idea for how to make the following procedure or function: > > What I have: > On the screen I have a simple list with with the most important fields > of a the records in an MySQL database. > > What I want to do: > I want a program/function/procedure so I can click a link in each record > and then jump to a form showing all the fields. > > Why I want to do it: > So I can see all the fields in the record, Or edit the data in the form > > The problem: > The problem is NOT the program for the list or the form "Show record" or > the form "Edit record" > > What I would like to get here: > Either the idea for how to implement this program/function/procedure or > a complete program/function/procedure to do it. > > This request may be boiled down to: > How can I extract the record number from a simple database list so I can > use it to a search or to select a specific record. > > Arne > flying_donald_duck@msn.com > SQL databases don't have a "record number". Rather, you need to define a primary key for the table (usually an autonumber column). -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
![]() |
| Outils de la discussion | |
|
|