0

Like on title... how to display row data from inner join table if name of the row are the same?? but data is diffrent?

$sql = "SELECT fv.name,fvcount.name,fvcount.datew,fvcount.u_uid 
        FROM fv 
        INNER JOIN fvcount ON fv.u_uid = fvcount.u_uid ";
$result = mysqli_query($conn, $sql);
while($row = mysqli_fetch_assoc($result)) {
   echo $row['u_uid'];
 }

Result will be printed, but on both table 1 of the rows name is like: name

So if i put

$row['name'];

i will have output of inner join table

How to get output from main table and inner joint table? I can't change name of the row...

Any clue?

1
  • 1
    fvcount.name AS name1, fv.name AS name2 then use name1 and name2. Commented Jan 9, 2019 at 20:28

1 Answer 1

4

The typical solution is to use column aliases. You can do something like:

SELECT fv.name AS fv_name, fvcount.name as fvcount_name, ...

And then use:

$row['fv_name']

Or:

$row['fvcount_name']
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.