0

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

invoice.php

                <?php
                //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>
3
Contributors
9
Replies
34
Views
3 Years
Discussion Span
Last Post by Adrian_5
0

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.

0

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

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

0

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

invoice.php

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

http://localhost/web/administrator/admin/invoice_edit.php?group_id=

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

0

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.

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

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

invoice.php

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

Can't get it right.

0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.