有疑问:
SELECT *
FROM table1 t1
LEFT JOIN table2 t2
ON t2.id_table1 = t1.id
LIMIT 1
得到了结果:
id => 1
field1 => val1
filed2 => val2
field3 => val3
是否可以知道哪个字段属于哪个表?
答案 0 :(得分:3)
这就是您所需要的:mysql_fetch_field()
答案 1 :(得分:2)
$export =mysql_query("SELECT fieldnames FROM table1 t1 LEFT JOIN table2 t2 ON
t2.id_table1 = t1.id LIMIT 1");
$no_rows= mysql_num_rows ( $export );
for ( $i = 0; $i < $fields-1; $i++ )
{
$fields=mysql_field_name( $export , $i ) . ",";
}
echo $fields;
请试试这个......