Why do I need to write a complete php code separately? Seeing the code, I don't understand why I want to write a complete php code separately? What if I write together?
Include ("Conn/conn. php ");
$ Query = mysql_query ("select book. barcode, book. id as bookid, book. bookname, bt. typename, pb. pubname, bc. name from tb_bookinfo book join tb_booktype bt on book. typeid = bt. id join tb_publishing pb on book. ISBN = pb. ISBN join tb_bookcase bc on book. bookcase = bc. id ");
$ Result = mysql_fetch_array ($ query );
If ($ result = false ){
?>
} Else {
?>
Reply to discussion (solution)
The Black part is html code, not php code.
You can say that html is embedded in php, or php is embedded in html.
The advantage of this writing method is that you can use visual html tools (such as DW) to observe and modify the html part.
In combination, the html part should be placed in the string. Because a single double quotation mark exists at the same time, escaping reduces visibility.
If custom delimiters are used, the code will be less elegant due to the rule.
You can also put it in a separate file and include it in. However, leaving the visual space will affect the continuity of thinking.
First, php is in service? ? While html is in ?? ?. Php? Better than html? Line.
Because? Medium? Not the php generation ?, So we need to score ??? Php ???
If you need to combine? A whole segment is php, medium? You need to use php echo ??.
For example
'; Echo''; Echo'No book information!'; Echo''; Echo''; Echo'
'; Echo'
'; Echo'
'; Echo' add the Library Information | '; Echo'
'; Echo'
';} Else {}?>
Html + php mixed encoding mode
The template smarty can be used to separate php and html for easy maintenance.
I use SQL server2005. how can I change the query function (in red) to the sqlsrv function?