Php queries database tables
Student question query
Enter your student ID!"; Echo"
"; Exit;} $ query =" select * from $ student_table where xuehao = '$ xuehao' "; mysql_query (" set names 'gb2312 '"); $ result = mysql_query ($ query); $ row = mysql_fetch_array ($ result); if ($ row = 0) {echo"You have not registered, or your input is incorrect. please enter it again!
"; Echo"
"; Exit ;}$ query =" select id as sm from $ student_table where xuehao = '$ xuehao' "; mysql_query (" set names 'gb2312 '"); $ result = mysql_query ($ query); $ row = mysql_fetch_array ($ result); if ($ row [sm] = 0) {echo"You have not selected a topic. Please select a topic!
"; Echo"
"; Exit ;}?>
| Student ID |
Student Name |
Topic Name |
Instructor |
Title |
";} Else {echo"
";} Echo"
| ". $ Row ['xuehao']." |
". $ Row ['name']." |
". $ Row ['subobject']." |
". $ Row ['teacher']." |
". $ Row ['zhicheng']." |
"; $ N ++ ;}?>
When I enter the student ID to query, the running result is a bunch of messy things...
Note: my table name is teacher and student.
Reply to discussion (solution)
You can see the screenshot
You can see the screenshot
You can see the screenshot
Wow, the moderator personally replied. I'm excited.
You have not enabled the segment tag.
Change
You have not enabled the segment tag.
Change
You have not enabled the segment tag.
Change
You have executed all the code before line 91, so you cannot open it all.
Here is another one. you didn't change it
You have executed all the code before line 91, so you cannot open it all.
Here is another one. you didn't change it Student question query Enter your student ID!
"; Echo" "; Exit;} $ query =" select * from $ student_table where xuehao = '$ xuehao' "; mysql_query (" set names GB2312 "); $ result = mysql_query ($ query); $ row = mysql_fetch_array ($ result); if ($ row = 0) {echo"
You have not registered, or your input is incorrect. please enter it again!
"; Echo" "; Exit ;}$ query =" select id as sm from $ student_table where xuehao = '$ xuehao' "; mysql_query (" set names 'gb2312 '"); $ result = mysql_query ($ query); $ row = mysql_fetch_array ($ result); if ($ row [sm] = 0) {echo"
You have not selected a topic. Please select a topic!
"; Echo" "; Exit ;}?>
|
Student ID
|
Student Name |
Topic Name |
Instructor |
Title |
";} Else {echo"
";} Echo"
|
". $ Row ['xuehao']." |
". $ Row ['name']." |
". $ Row ['subobject']." |
". $ Row ['teacher']." |
". $ Row ['zhicheng']." |
"; $ N ++ ;}?>
If ($ search)
{
This if is not closed, that is, the number} is missing.
If ($ search)
{
If this is not closed, it means the number} is missing. let's take a look.
If ($ search)
{
If this is not closed, that is, if the number} is missing, is it added after 48 rows? This will happen after I add it.
Is it after 48 rows?
I don't know your logic. you should be clear about it yourself.
$ Search and $ xuehao what do you define?
Is it after 48 rows?
I don't know your logic. you should be clear about it yourself.
$ Search and $ xuehao what do you define? It's not clear, because the code teacher gave me some modifications ......
A semicolon is missing.
}
Include "foot. php";?>
A semicolon is missing.
}
Include "foot. php";?> There is a semicolon.
...... The landlord looked too dizzy with this error. I suggest you check eclipse or something. There are a lot of lost things.
...... The landlord looked too dizzy with this error. I suggest you check eclipse or something. There are a lot of lost things. my last line is a syntax error. what does unexpected 'eof 'mean?
A semicolon is missing.
}
Include "foot. php";?> There is a semicolon.
The code you posted above does not contain
...... The landlord looked too dizzy with this error. I suggest you check eclipse or something. There are a lot of lost things. my last line is a syntax error. what does unexpected 'eof 'mean?
You have missing a bracket. check the code carefully.