本文介绍了从PHP / MySQL中的2个表获取信息的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我有两张桌子。一,我手动插入数据进行HTTP 身份验证。它有3个字段:用户名,密码,学校。一旦 用户输入了正确的u和p,学校名称就会显示硬编码的 到一个提交到另一个表中的表单中。所以,两个表中总共有一个 ''school''字段。现在,我想从第二张表中抽取所有 的信息打印出来但是遇到了问题。所以 远,我有类似的东西: $ sql = mysql_query(" SELECT * FROM logintable,datatable WHERE logintable.school = datatable.school"); while($ row = mysql_fetch_array($ sql)){ print(" $ row [school],$ row [field1]等.... } 解决方案 row = mysql_fetch_array( I''ve got 2 tables. One, I manually insert data into for HTTPauthentication. It has 3 fields: username, password, school. Once theuser enters the corrrect u and p, the school name shows up hard codedinto a form that gets submitted into another table. So, there is a''school'' field in both tables that always match. Now, I want to draw allthe info from this second table to print out but am having problems. Sofar, I''ve got something like:$sql = mysql_query("SELECT * FROM logintable, datatable WHERElogintable.school = datatable.school");while($row = mysql_fetch_array($sql)){print("$row[school], $row[field1], etc....} 解决方案 这篇关于从PHP / MySQL中的2个表获取信息的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-11 14:01