php - Page code stops executing after UNION sql query -


i'm still beginner in writing php code. couple of hours i'm trying write script takes results 2 database tables , displays results (in while loop)+ pagination. problem can not fix if there no result - script stops page executing , looks cut in half.

this query:

$query = "select phid photographers phcity=$row_cities[cityid] union select pservowner phservices pservowner = $row_prephotographer[phid] , pservservice=$row_service[serviceid] limit $redove, $broinastranica";              $query_params = array();              try {                 $stmt = $db->prepare($query);                 $result = $stmt->execute($query_params);             }             catch(pdoexception $ex) {                 die(fusllpageerror("error","system error 103."));             }              $row_photographers = $stmt->fetch();              if(!empty($row_photographers['phid'])) { { ... } while($row_photographers = $stmt->fetch()); else {  echo "<h1>there no results</h1>  <p class=\"text-center\">please check again after few days.</p>"; } 

can please give , tell wrong? thank in advance.

check phid first select , pservowner second select statements of same datatype.

try use parentheses each select statement. (select id1 table1) union (select id2 table2)


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -