HTML 在 MySQL 中串联
HTML In Concatenation in MySQL
SELECT
EB.first_name AS FNAME,
EB.emp_id AS EID,
CONCAT(EB.first_name,' ',EB.mid_name,' ',EB.last_name) AS FULLNAME,
EB.id AS ID,
ESAL.dept_id AS DEPT_ID,
DATE_FORMAT(EB.dob,'%D %b %y') AS DOB,
EB.email_per AS EPER,
EB.mobile_per AS MOBPER,
EB.father_name AS FATHER,
EB.mother_name AS MOTHER,
EB.sex AS SEX,
EB.email_office AS EOF,
EB.mobile_office AS MOBO,
EB.blood_group AS BG,
CONCAT(EB.id_type,' : ',EB.id_no) AS ID,
CONCAT(EB.present_addr,'<br>',EB.present_city_id,'<br>',EB.present_state_id) AS PRA
FROM mtc_employee_master EB
LEFT JOIN mtc_employee_education_master EE ON EE.emp_tbl_id = EB.id
LEFT JOIN mtc_employee_experience_master EEXP ON EEXP.emp_tbl_id = EB.id
LEFT JOIN mtc_employee_salary_master ESAL ON ESAL.emp_tbl_id = EB.id WHERE EB.id=".$data['id']."
我正在尝试将 HTML 内容嵌入到 MySQL 的连接中。这可能吗??请帮忙..
是的,这是可能的,即使它不是最好的解决方案...
SELECT CONCAT('<p>', now(), '</p>') as html;
+----------------------------+
| html |
+----------------------------+
| <p>2015-04-27 13:12:33</p> |
+----------------------------+
并且您已经在:
CONCAT(EB.present_addr,'<br>',EB.present_city_id,'<br>',EB.present_state_id,)
但你应该删除逗号:
CONCAT(EB.present_addr,'<br>',EB.present_city_id,'<br>',EB.present_state_id)
SELECT
EB.first_name AS FNAME,
EB.emp_id AS EID,
CONCAT(EB.first_name,' ',EB.mid_name,' ',EB.last_name) AS FULLNAME,
EB.id AS ID,
ESAL.dept_id AS DEPT_ID,
DATE_FORMAT(EB.dob,'%D %b %y') AS DOB,
EB.email_per AS EPER,
EB.mobile_per AS MOBPER,
EB.father_name AS FATHER,
EB.mother_name AS MOTHER,
EB.sex AS SEX,
EB.email_office AS EOF,
EB.mobile_office AS MOBO,
EB.blood_group AS BG,
CONCAT(EB.id_type,' : ',EB.id_no) AS ID,
CONCAT(EB.present_addr,'<br>',EB.present_city_id,'<br>',EB.present_state_id) AS PRA
FROM mtc_employee_master EB
LEFT JOIN mtc_employee_education_master EE ON EE.emp_tbl_id = EB.id
LEFT JOIN mtc_employee_experience_master EEXP ON EEXP.emp_tbl_id = EB.id
LEFT JOIN mtc_employee_salary_master ESAL ON ESAL.emp_tbl_id = EB.id WHERE EB.id=".$data['id']."
我正在尝试将 HTML 内容嵌入到 MySQL 的连接中。这可能吗??请帮忙..
是的,这是可能的,即使它不是最好的解决方案...
SELECT CONCAT('<p>', now(), '</p>') as html;
+----------------------------+
| html |
+----------------------------+
| <p>2015-04-27 13:12:33</p> |
+----------------------------+
并且您已经在:
CONCAT(EB.present_addr,'<br>',EB.present_city_id,'<br>',EB.present_state_id,)
但你应该删除逗号:
CONCAT(EB.present_addr,'<br>',EB.present_city_id,'<br>',EB.present_state_id)