need help for idea for function/procedure to link a record in adatabaselist to an form.

need help for idea for function/procedure to link a record in adatabaselist to an form.

am 18.10.2007 19:59:25 von Arne Essa Madsen

Need help 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

Re: need help for idea for function/procedure to link a record inadatabase list to an form.

am 18.10.2007 20:10:41 von Shion

Arne Essa Madsen wrote:
> Need help 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 "\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

Re: need help for idea for function/procedure to link a record inadatabase list to an form.

am 18.10.2007 20:22:55 von Arne Essa Madsen

Thanks a lot,
Arne

J.O. Aho wrote:
> Arne Essa Madsen wrote:
>> Need help 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 "\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.
>

Re: need help for idea for function/procedure to link a record inadatabase list to an form.

am 18.10.2007 20:35:35 von Jerry Stuckle

Arne Essa Madsen wrote:
> Need help 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
==================