PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > alt.php > need for idea for function/procedure to link a record in adatabaselist to an form.
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
need for idea for function/procedure to link a record in adatabaselist to an form.

Réponse
 
LinkBack Outils de la discussion
Vieux 18/10/2007, 18h59   #1
Arne Essa Madsen
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut need for idea for function/procedure to link a record in adatabaselist to an form.

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
  Réponse avec citation
Vieux 18/10/2007, 19h10   #2
J.O. Aho
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: need for idea for function/procedure to link a record inadatabase list to an form.

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
  Réponse avec citation
Vieux 18/10/2007, 19h22   #3
Arne Essa Madsen
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: need for idea for function/procedure to link a record inadatabase list to an form.

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.
>

  Réponse avec citation
Vieux 18/10/2007, 19h35   #4
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: need for idea for function/procedure to link a record inadatabase list to an form.

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
==================

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 13h42.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10549 seconds with 12 queries