Re: Re: [PHP-WIN] Need Help with 2 MYSQL Table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Combine them in SQL and loop through the dataset

select c.*, cd.*
from customers c
inner join customer_details cd on c.id = cd.customer_id
[where clause as needed]

loop thru the recordset from that query just as you would with a query from
a single table and link the id to the edit  page

while ($rows = mysql_fetch_array($result))
{
    echo "<tr>";
    echo "<td>".$rows['id']."</td>";
    echo "<td>".$rows['name']."</td>";
    echo "<td><a href='edit_customer.php?id=".$rows['id']."</a></td>";
    echo "</tr>";
}

On Sat, Apr 25, 2015 at 4:34 AM Richard Quadling <rquadling@xxxxxxxxx>
wrote:

> On 25 April 2015 at 06:13, Guru <nagendra802000@xxxxxxxxx> wrote:
>
> > Hi All,
> >
> > Hope everyone is doing well. I need some help regarding a project. I
> have a
> > huge list of customers in a ledger in a mysql table (Table A). And in
> > another table I have their names and their ID number (Table B). What I
> want
> > is when I click on a customer name from Table A,  I want php to pull out
> > the data of that particular customer  from Table B, and show it in a
> > formatted tabular manner. Please help me with this.
> >
> >
> Where to start. Well. What have you got at the moment?
>
> You will find it easier to get help if you offer what you've got at the
> moment.
>
> Are you using any framework or raw PHP?
>
> Regards,
>
> Richard.
>

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux