且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从PHP / MySQL中的2个表获取信息的问题

更新时间:2023-02-26 09:41:52

sql = mysql_query(" SELECT * FROM logintable,datatable WHERE

logintable.school = datatable.school");

while(


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("