php - Cannot able to access class function in different file -
index.php
<?php include 'foo.php'; ?> <div id="middle_containe_cr" style="background-color:#f0f0ff"> <form method="post" action="actionpage.php" enctype="multipart/form-data"> <table cellspacing="30px" style="padding-left:25%"> <tr> <td colspan="2" align="center" style="font:caption" > hi <form method="post" action="actionpage.php" enctype="multipart/form-data"> <table cellspacing="30px" style="padding-left:25%"> <tr> <td colspan="2" align="center" style="font:caption" > hi <?php $blobj=new foo(); $userdetails=$blobj->samplefunction($userid); echo $userdetails->name; ?> </td> </tr> <tr> <td width="299">userid</td> <td width="302"><?php echo $userid; ?></td> </tr>
foo.php
include 'bar.php'; class foo { public function samplefunction($userid) { $username=null; $dalobj=new bar(); $username=$dalobj->samplefunction($userid); return $username; } }
bar.php
include ('dataconnection.php'); class bar { public function samplefunction($userid) { $name=''; $db=dataconnection::dbconnect(); $stmt=$db->prepare("call usp_useraccountbasicdetails(?)"); $stmt->bind_param('s',$userid); if (!$stmt->execute()) { echo "execute failed: (" . $stmt->errno . ") " . $stmt->error; } else { $result = $stmt->get_result(); $resultset = $result->fetch_array(mysqli_num); $name=$resultset[1]; $result->free_result(); } return $name; } }
hi i'm facing issue in above code while i'm hosting code in remote server. when execute localhost above code execute without issues. if upload remote server code not execute after function calling statement. print 'hi' (in html td content), in concatenate php content name db through 2 classes. none code below function calling statement execute.
please me !! thanks!!
Comments
Post a Comment