Unknown column 'b.id2' in 'where clause'

-1

You're giving this error:

  

Unknown column 'b.id2' in 'where clause'

Packages.php

include ("config.php");
$tabla2 = mysql_query("SELECT * FROM  tb_buyref b, tb_refset r  WHERE r.id=".$id." AND b.id2=".$id)  or die(mysql_error()); // selecciono todos los registros de la tabla usuarios, ordenado por nombre
while($registro2 = mysql_fetch_assoc($tabla2)){

Could someone help me?

    
asked by anonymous 02.05.2014 / 15:33

2 answers

1
  

Unknown column 'b.id2' in 'where clause'

The error says that there is no column "id2" in table "tb_buyref", "b" in your query is just an alias for the table.

Checked the table structure?

    
02.05.2014 / 15:40
0

try to change the name of the column as added below, you probably got confused when putting the name and put id2, but it depends on the nomenclature you put, if not right insert here the structure of your database

$tabla2 = mysql_query("SELECT * FROM  tb_buyref b, tb_refset r  WHERE r.id=".$id." AND b.id=".$id)  or die(mysql_error());
    
02.05.2014 / 19:43