Обратите внимание: попытка получить свойство 'num_rows' не-объекта в C:\xampp\htdocs\cecri karikudi\reportdatewise.php на линии 83
1 <?php 2 @ob_start(); 3 session_start(); 4 ?> 5 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 6 <html xmlns="http://www.w3.org/1999/xhtml"> 7 <head> 8 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 9 <meta name="viewport" content="width=device-width, initial-scale=1"> 10 <title>cecri karaikudi</title> 11 <?php 12 include('css.php'); 13 ?> 14 </head> 15 16 <body> 17 <div class="row" align="center"><a href="index.php"><img src="img/header.png" class="img img-responsive" alt="" align="center" /></div><div class="clear_fix"></div><div class="row header_bot"><div class="col-sm-8"></div><div class="col-sm-4 pull-right" align="right"> 18 <?php if(isset($_SESSION['username'])){ ?> 19 <span class="header_bot_span"><a href="logout.php">Logout</a></span> 20 <?php } else { ?> 21 <span class="header_bot_span"><a href="admin.php">Admin</a></span> 22 <span class="header_bot_span"><a href="student_login.php">Student</a></span> 23 <?php } ?> 24 </div> 25 </div> 26 27 <!-- Start Content --> 28 <div class="clearfix"></div> 29 <div class="row strip"> 30 <a href="index.php"><span class="strip_font">Home</span></a> / <a class="active" href=""><span class="strip_font" style="color:#C00;">Date wise Report</span></a> 31 </div> 32 <div class="clearfix"></div> 33 34 35 <div class="col-md-12"> 36 <div class="col-md-3 left_side_menu"> 37 <?php 38 include('db.php'); 39 include('admin_menu.php'); 40 if(isset($_SESSION['username'])){ 41 if(isset($_POST['submit'])){ 42 $class = $_POST['class']; 43 $date = $_POST['date']; 44 } 45 ?> 46 </div> 47 <div class="col-md-9 col-sm-9 col-xs-12 content_border" style="margin-top:10px; padding:10px;"> 48 <div class="row"> 49 <div class="col-md-6 col-sm-6 col-xs-12"> 50 <table class="table table-bordered table-responsive"> 51 <form name="" method="post" action="" enctype="multipart/form-data" > 52 <?php 53 $query = $db->query("select * from class") or die(mysqli_error()); 54 ?> 55 <tr> 56 <th>Select class </th> 57 <td> 58 <select name="class" class="form-control my_form"> 59 <?php 60 while($row = mysqli_fetch_assoc($query)){ ?> 61 <option value="<?php echo $row['class_name']; ?>"><?php echo $row['class_name']; ?></option> 62 <?php } ?> 63 </select> 64 </td> 65 </tr> 66 <tr> 67 <th>Date</th> 68 <td><input type="date" name="date" placeholder="mm/dd/yyyy" class="form-control my_form" required /></td> 69 </tr> 70 <tr> 71 72 <td colspan=2><center> <input type="submit" value="submit" class="my_btn" name="h" /></center></td> 73 </tr></form> 74 </table> 75 </div><div class="col-md-6 ol-sm-6 col-xs-12"></div> 76 </div> 77 <h3 style="font-weight:bold; text-transform:uppercase; padding-bottom:5px;"> Monthly Attendance Report </h3> 78 <?php 79 if(isset($_POST['h'])) 80 { 81 $con = mysqli_connect('localhost','root','',"cecri karaikudi"); 82 $result = mysqli_query($con, "SELECT `id`, `roll_no`, `class`, `date`, `subject_name_and_subject_code`, `subject_handle_by`, `batch`, `semester`, `period1`, `present` FROM `daily_atten` WHERE 1"); 83 if($result->num_rows>0) 84 {?> 85 <table class="table table-bordered"> 86 <tr> 87 <th>Reg</th> 88 <th>Class</th> 89 <th>Date</th> 90 <th>Subject Name & Code</th> 91 <th>SubjectHandleBy</th> 92 <th>Batch</th> 93 <th>Semester</th> 94 <th>Period1</th> 95 <th>Present</th> 96 </tr> 97 <?php 98 99 $i=0; 100 while($row=mysqli_fetch_array($result)) 101 { 102 ?> 103 <tr> 104 <td><?php echo $row["roll_no"];?></td> 105 <td><?php echo $row["class"];?></td> 106 <td><?php echo $row["date"];?></td> 107 <td><?php echo $row["subject_name_and_subject_code"];?></td> 108 <td><?php echo $row["subject_handle_by"];?></td> 109 <td><?php echo $row["batch"];?></td> 110 <td><?php echo $row["semester"];?></td> 111 <td><?php echo $row["period1"];?></td> 112 <td><?php echo $row["present"];?></td> 113 114 </tr> 115 <?php 116 $i++; 117 } 118 } 119 120 } 121 ?> 122 </table> 123 </div> 124 </div> 125 126 127 128 129 130 <!-- End Content --> 131 132 <?php 133 include('footer.php'); 134 } else{ 135 header('location:index.php?suc=suc'); 136 } 137 ?> 138 </body> 139 </html>
Что я уже пробовал:
db.php
<?php error_reporting(); $db = new mysqli('localhost', 'root', '', 'cecri karaikudi'); if($db->connect_errno){ die('Sorry Database not connected !!!'); } ?>
Richard MacCutchan
Пожалуйста, предоставьте более подробную информацию, а не просто постоянно сбрасывайте свой код и ожидайте, что другие люди найдут ваши проблемы. Какая линия 83, вы проверили, где именно num_rows
должен ли он быть создан, чтобы увидеть, действительно ли он создается правильно?