html - PHP mysqli_fetch_array() error -


i getting mysqli_fetch_array() error when trying execute sql statement in 1 of php forms. doing searching database users email , returning result. can execute sql statement through dbforge , works, not run when initiated via web application..

code:

<?php  // start session session_start();  // include required functions file require_once('includes/functions.inc.php'); require_once('includes/config.inc.php');  if (isset($_post['email'])){ $email   =   $_post['email']; } else $email =""; var_dump($email); // connect database  $mysqli = @new mysqli(db_hostname, db_username, db_password, db_database); if (mysqli_connect_errno()) {     echo "failed connect mysql: " . mysqli_connect_error(); } $result = mysqli_query($mysqli, "select    checkin.user,    sum(checkin.points) point_total,    satellite_members.f_name,    satellite_members.l_name,    satellite_members.email     checkin     inner join satellite_members     on satellite_members.email = checkin.user   checkin.user = $email");   ?> 

html elements here:

    <form action="" method="post">                     <div class="form-group">                         <label for="email address">email address</label>                         <input type="email" class="form-control" id="email" name="email" style="width:60%; display:inline;" required>                     </div>                     <button type="submit" class="btn btn-default">submit</button>                 </form>                     <div class="table-responsive" style="width:100%; ">                    <table class="table table-condensed table-bordered" >                        <tr class="bg-cotu">                            <th style="width:45%;" class="text-center">member name</th>                            <th style="width:20%;" class="text-center">point total</th>                        </tr>   <?php while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['f_name']." ".$row['l_name'] . "</td>"; echo "<td>" . $row['point_total'] . "</td>"; echo "</tr>"; } ?>  </table>                 </div> 

try this:

$result = mysqli_query($mysqli, "select    checkin.user,    sum(checkin.points) point_total,    satellite_members.f_name,    satellite_members.l_name,    satellite_members.email     checkin     inner join satellite_members     on satellite_members.email = checkin.user   checkin.user = '$email'") or die(mysqli_error()); 

and needs be

 while($row = mysqli_fetch_array($result)) 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -