Advertisement
yaramohamed1

Search

May 12th, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.04 KB | None | 0 0
  1. <?php
  2. require_once 'query.php';
  3. date_default_timezone_set('Africa/Cairo');
  4. $searchKey=$_POST["searchItem"];
  5. $result= array();
  6. $sql = mysql_query("SELECT * FROM Jobbya where category like '$searchKey'");
  7. if($sql === FALSE)
  8.     {
  9.     die(mysql_error());
  10.     }
  11. while ($row = mysql_fetch_array($sql))
  12.  
  13. {
  14. $jobId=$row["jobId"];
  15. $jobName=$row["jobName"];
  16. $description=$row["description"];
  17. $category=$row["category"];
  18. $sql1 = mysql_query("SELECT imageUrl FROM pictures where jobId='$jobId'");
  19. $image="";
  20. $counter=0;
  21. while ($row = mysql_fetch_array($sql1))
  22. {
  23. $image=row["imageUrl"];
  24. $counter+=1;
  25. if(counter==1)
  26. break;
  27. }
  28. $sql2 = mysql_query("SELECT videoUrl FROM videos where jobId='$jobId'");
  29. $video="";
  30. $counter=0;
  31. while ($row = mysql_fetch_array($sql2))
  32. {
  33. $video=row["videoUrl"];
  34. $counter+=1;
  35. if(counter==1)
  36. break;
  37. }
  38. $result1[] = array
  39. (
  40.   'jobId' => $jobid,
  41.   'jobName'=> $jobName,
  42.   'description'=>$description,
  43.   'category'=>$category,
  44.   'image'=>$image,
  45.   'video'=>$video
  46. );
  47.  
  48.     array_push($result,$result1);
  49. }
  50.  
  51. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement