SQL Issues in PHP
Inquire
$sql = "SELECT * from ' Rv_duifu ' where 1=1 $search the ORDER by id desc LIMIT $pageNum, $numPerPage";
$db->query ($sql);
$list = $db->fetchall ();
Echo $sql;
Format output data
foreach ($list as $key = = $val) {
if ($key%2==0) {
$list [$key][rowcss]= "listodd";
}else{
$list [$key][rowcss]= "Listeven";
}
$sql _lc= "select * from ' Rv_licai ' where id= '". $list [$key][licaiid]. "' Limit 1 ';
$db->query ($sql _lc);
$row _lc= $db->fetchrow ();
$list [$key][name_txt]= $row _lc[' name '];
$list [$key][qixian_txt]= $row _lc[' Qixian '];
$list [$key][bdate_txt]= $row _lc[' bdate '];
$list [$key][ldate_txt]= $row _lc[' ldate '];
$list [$key][jine_txt]= $row _lc[' jine '];
}
Templates
$SMT = new Smarty (); smarty_cfg ($SMT);
$smt->assign (' list ', $list);
$smt->assign (' Numperpage ', $_post[numperpage]); Show number of bars
$smt->assign (' Pagenum ', $_post[pagenum]); Current page
$smt->assign (' Total ', $total);
$smt->assign (' title ', ' list ');
$smt->display (' duifu_list.htm ');
There are 2 SQL, I want to use SQL Server to stitch the two SQL into an SQL statement, return a result set?
------Solution--------------------
Your database design supports even table queries, and the JOIN keyword should solve the problem.
------Solution--------------------
It's OK to use join to query the table. Do not understand, to check the relevant information, this is the basic knowledge of SQL.
------Solution--------------------
Determines that the primary table data is based on the primary table data join