數據庫表company_info保存的值作爲數據庫
-----------------------------
| companyname | companytype |
-----------------------------
| Company One | Blah |
-----------------------------
| Company Two | Blah2 |
-----------------------------
數據庫表invoice_template
-----------------------------
| Header | bgcolor |
-----------------------------
| $company | Red |
-----------------------------
| $company | Biege |
-----------------------------
PHP文件common_include.php變量名
$company = ... //FROM db table company_info field companyname
PHP文件invoice.php invoice.php的
include('common_include.php');
$header = ... //FROM db table invoice_template field header
echo "Header is ". $header;
echo "<br/>Company is ". $company; //$company is defined in common_include.php
輸出,當公司登陸是eg.Company一個
Header is $company
Company is Company One
問:我如何獲得$公司輸出顯示爲公司之一?即如何將MySQL DB的輸出視爲變量?
什麼是行'$ header = FROM db ...',因爲這應該是無效的PHP ... – DisgruntledGoat 2010-09-21 09:38:39
@DisgruntledGoat。 $ header = FROM db ..不是有效的PHP,它只是意味着我從數據庫中提取數據。 – abel 2010-09-21 10:52:54