从PHP / MySQL中的2个表获取信息的问题 [英] problem with getting info from 2 tables in PHP / MySQL
问题描述
我有两张桌子。一,我手动插入数据进行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]等....
}
sql = mysql_query(" SELECT * FROM logintable,datatable WHERE
logintable.school = datatable.school");
while(
< blockquote> row = mysql_fetch_array(
sql)){
print("
I''ve got 2 tables. One, I manually insert data into for HTTP
authentication. It has 3 fields: username, password, school. Once the
user enters the corrrect u and p, the school name shows up hard coded
into 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 all
the info from this second table to print out but am having problems. So
far, I''ve got something like:
$sql = mysql_query("SELECT * FROM logintable, datatable WHERE
logintable.school = datatable.school");
while($row = mysql_fetch_array($sql)){
print("$row[school], $row[field1], etc....
}
sql = mysql_query("SELECT * FROM logintable, datatable WHERE
logintable.school = datatable.school");
while(
row = mysql_fetch_array(
sql)){
print("
这篇关于从PHP / MySQL中的2个表获取信息的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!