Column 'id_f' in the place where the sentence is ambiguous

I have a connection request using 3 tables, but I get this problem. The column 'id_f' is where the sentence is ambiguous

$id_f=$_GET['id_f'];

$query="SELECT *, s.name AS van, st.name AS naar, p.titl, p.vname
FROM p1_users, f_confirm AS v 
INNER JOIN s_steden AS s ON v.van = s.id
INNER JOIN s_steden AS st ON v.naar = st.id
INNER JOIN p1_users AS p ON v.id_f = p.id_f
AND DATE_FORMAT(date,'%Y-%c-%d')WHERE id_f='$id_f'";
$result=mysql_query($query)or die('Wrong query : ' . mysql_error());
$row=mysql_fetch_assoc($result);

can anyone help?

+3
source share
4 answers

This means that two or more tables contain a column called id_f (in your case, p1_users and f_confirm). You need to indicate for which table it is associated, something like this:

AND DATE_FORMAT(date,'%Y-%c-%d')WHERE p.id_f='$id_f'";
+3
source

You need to use v.id_feither p.id_fin the where clause because the two tables have a column of that name, so you need to fix the problem.

, , inner join.

, natural join, .

+1

- , ( ).

.

  • table_name (table1.field_x, table2.field_x)
  • (alias1.x, alias2.x).

INNER JOIN "v.id_f = p.id_f", WHERE .

+1

WHERE, DATE_FORMAT id_f = '$ id_f', (id_f) . , , .

0

Source: https://habr.com/ru/post/1786143/


All Articles