php function inside of jquery mobile creates "error loading page" in server? -


i have created function inside of jquery mobile code. working fine locally. in server have hosted not working properly. please here sample code

<!doctype html>  <html>     <head>     <title>site title</title>      <meta charset="utf-8">     <meta name="viewport" content="width=device-width, initial-scale=1">       <link rel="shortcut icon" href="images/scbd.ico">        <link rel="stylesheet"  href="css/themes/default/jquery.mobile-1.1.0.css" />       <link rel="stylesheet" href="docs/_assets/css/jqm-docs.css"/>     <script src="js/jquery.mobile-1.1.0.js"></script>     <script src="js/jquery.js"></script>     <script src="docs/_assets/js/jqm-docs.js"></script>       </head>        <body>          <div data-role="page" class="type-index">              <div data-role="header" data-theme="f">                     <h1 id="jqm-logo"><img src="images/logo.png"></h1>                     <a href="index.php" data-icon="home" data-iconpos="notext" data-direction="reverse">home</a>               </div><!-- /header -->             <div id="header_rightpart">                 <a name="header"><h2>sfdshsjdhfjdsh</h2></a>                                 </div>             <?php                            here have written function                             ?> 

but there nothing wrong function working fine in local machine. cant understand why not working in server. getting error "error loading page". because of using multipel php tag?? mean have used <?php ?> twice in page. please me find out solution

i have got solution. declared variable $names=[]; did not work on server. reason behind error. think because of php version. sever php version 5.2.17 , local 5.4.7 worked fine on local machine. wrong server php version.

function f_do ($rootname)  { $query = "select course_name onlinecourses root_name = '$rootname'"; $result = mysql_query($query); $num = mysql_num_rows($result);  //$names=[]; caused error //$row=[]; caused error if($num > 0) {      while($row =mysql_fetch_array($result))     {         $names[] = $row['course_name'];     }   } return $names;  } 

commented part shows variable.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -