Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. <input name="rollno" type="text" placeholder="Roll Number" required>
  2. <input name="submit_view_details" type="submit" value="Proceed">
  3.  
  4. if(isset($_POST['submit_view_details']))
  5. {
  6. $rollno = (int) $_POST['rollno'];
  7. $query = "select * from table1, table2 where table1.{$rollno}=table2.{$rollno}";
  8. $result=mysqli_query($connection,$query);
  9. }
  10.  
  11. SELECT * FROM table1, table2 WHERE table1.rollno = table2.rollno
  12. AND table1.rollno = {$rollno};
  13.  
  14. SELECT * FROM table1 NATURAL JOIN table2
  15. WHERE rollno = {$rollno};
  16.  
  17. $query = "SELECT tbl1.*, tbl2.*
  18. FROM tbl1
  19. INNER JOIN tbl2 ON tbl1.id = tbl2.id
  20. WHERE tbl1.column = value ";
  21.  
  22. foreach ($pieces_2 AS $value) {
  23. $pieces_3[] ="(CONCAT_WS('|',$presql2) like '%$value%')"; //concat all columns from one table
  24. }
  25. $serch_jyouken = implode(" and ",$pieces_3); // for multiple keywords
  26. $result1 = mysql_query("select p.p_no from pfr_data p where (" .$serch_jyouken .")");
  27. $res1 = array();
  28. while($r1 = mysql_fetch_array($result1){
  29. $res1[] = $r1['p_no'] ; //fetch primary key from table and store it into array
  30. }
  31. foreach ($pieces_2 AS $value) {
  32. $pieces_4[] ="(CONCAT_WS('|',$presql3) like '%$value%')"; // same as above
  33. }
  34. $serch_jyouken1 = implode(" and ",$pieces_4);
  35. $result2 = mysql_query("select p2.p_no from pfr_mod_inform p2 where (" .$serch_jyouken1 .")" );
  36. $res2 = array();
  37. while($r2 = mysql_fetch_array($result2)){
  38. $res2[] = $r2['p_no'];
  39. }
  40. $res_mrg = array_merge($res1 , $res2); //merge array
  41. $result = implode("','",$res_mrg ); // array to sring
  42. $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