PHP无需连接即可获取数据 [英] PHP fetch data without joins
本文介绍了PHP无需连接即可获取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可以从2个不同的表中获取数据而不加入吗?
例如:我有2个表table1和table2,两者都有名字字段。现在我想要获取两个表的完整记录。
i使用以下查询但不起作用
is that possible to fetch data from 2 different tables without join ??
for ex: i have 2 tables table1 and table2 and both have name field. now i want to fetch complete record of both table.
i use following query but its not work
$fetch = mysql_query("select * from table1,table2");
while ($row = mysql_fetch_array($fetch))
{
echo $row['name'].table1;
echo $row['name'].table2;
}
但不起作用:( ...你可以帮助我。
but its not work :(... can u plz help me.
推荐答案
fetch = mysql_query( select * from table1,table2);
while (
fetch = mysql_query("select * from table1,table2"); while (
row = mysql_fetch_array(
row = mysql_fetch_array(
fetch))
{
echo
这篇关于PHP无需连接即可获取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文