Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <input name="rollno" type="text" placeholder="Roll Number" required>
- <input name="submit_view_details" type="submit" value="Proceed">
- if(isset($_POST['submit_view_details']))
- {
- $rollno = (int) $_POST['rollno'];
- $query = "select * from table1, table2 where table1.{$rollno}=table2.{$rollno}";
- $result=mysqli_query($connection,$query);
- }
- SELECT * FROM table1, table2 WHERE table1.rollno = table2.rollno
- AND table1.rollno = {$rollno};
- SELECT * FROM table1 NATURAL JOIN table2
- WHERE rollno = {$rollno};
- $query = "SELECT tbl1.*, tbl2.*
- FROM tbl1
- INNER JOIN tbl2 ON tbl1.id = tbl2.id
- WHERE tbl1.column = value ";
- foreach ($pieces_2 AS $value) {
- $pieces_3[] ="(CONCAT_WS('|',$presql2) like '%$value%')"; //concat all columns from one table
- }
- $serch_jyouken = implode(" and ",$pieces_3); // for multiple keywords
- $result1 = mysql_query("select p.p_no from pfr_data p where (" .$serch_jyouken .")");
- $res1 = array();
- while($r1 = mysql_fetch_array($result1){
- $res1[] = $r1['p_no'] ; //fetch primary key from table and store it into array
- }
- foreach ($pieces_2 AS $value) {
- $pieces_4[] ="(CONCAT_WS('|',$presql3) like '%$value%')"; // same as above
- }
- $serch_jyouken1 = implode(" and ",$pieces_4);
- $result2 = mysql_query("select p2.p_no from pfr_mod_inform p2 where (" .$serch_jyouken1 .")" );
- $res2 = array();
- while($r2 = mysql_fetch_array($result2)){
- $res2[] = $r2['p_no'];
- }
- $res_mrg = array_merge($res1 , $res2); //merge array
- $result = implode("','",$res_mrg ); // array to sring
- $sql5 = $presql ." from pfr_data p where p.p_no in ('$result') order by p.section_p,p.status,p.no";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement