Column 'group_id' in where clause is ambiguous. I wonder why?


                //LOAD GROUP

                $result2 = mysql_query("SELECT group_name FROM `group` 
                INNER JOIN invoice
                ON `group`.group_id = `invoice`.group_id
                WHERE group_id = '".$_GET['group_id']."' ORDER BY group_date") or die(mysql_error());

                $result = mysql_query("SELECT * FROM `invoice` WHERE group_id = '".$_GET['group_id']."' ORDER BY group_date ASC") or die(mysql_error());


                <?php $data2 = mysql_fetch_array($result2) ?>

                Group Name: <?php $data2['group_name']; ?><br><br>

Recommended Answers

Both tables have a group_id. Specify any one of them.

Jump to Post

All 9 Replies

What 'group_id' are you talking about in the where clause (at line 7)? The one in 'group' table or the one in 'invoice' table? Put the name of the table just before group_id. For example: group.group_id or invoice.group_id.

What 'group_id' are you talking about in the where clause

It doesn't matter in this case, because it is the join column.

Thanks, I get that part works. Now, I have another part that I need to deal with: (still in the same page)


<button type="button" onClick="parent.location='invoice_edit.php?group_id='"<?php echo $_GET['group_id'];?>"'">Add Invoice</button><br><br>


I wonder why the group_id remains empty (the group_id in invoice.php - url).

lol. I have been trying to fix the quotes in different way and still haven't find the right one.

I usually get it right but not for this one.

<button type="button" onClick="parent.location='invoice_edit.php?group_id=<?php echo $_GET['group_id'];?>"'\"">Add Invoice</button><br><br>

Thanks. I get that part works.

Another similar problem:

Parse error: syntax error, unexpected '?' in C:\xampp\htdocs\SquprimeRevise\administrator\admin\invoice.php on line 114


echo '<td><a href="invoice_edit.php?group_id='<?php echo $_GET['group_id'];?>'">'.$data['group_date'].'</td>';

Can't get it right.

Well... you have an echo inside an echo.. and a lot more problems (maybe an enter between ? and >)... That is a sign of either lack of attention or of basic php knowledge.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.