mysql - Display particular details of a person while clicking on name using php my sql -
this question has answer here:
hi iam trying display particular details of data while clicking on title name .here code. getting errors if use condition , $id=$_get['blog_title'] in blog.php
notice: undefined index: title in c:\xampp\htdocs\accounting\blogs.php on line 6
warning: mysql_fetch_array() expects parameter 1 resource, boolean given in c:\xampp\htdocs\accounting\images.php on line 7
images.php
<table> <tbody> <?php include "blogs.php" ; while($row = mysql_fetch_array($result)) {?> <tr> <td><img src="admin/upload/<?php echo $row['image'];?>" height="100" width="100"/></td> <td><a href="blogimages.php?title=<?php echo $row['blog_title'];?>"><?php echo $row['blog_title']; ?></a></td> </tr> <?php }?> </tbody> </table> blog.php
<?php $connection = mysql_connect("localhost", "root", "") or die(mysql_error()); $db = mysql_select_db("accountant", $connection); $id=$_get['title']; $res = "select * blogs blog_title=$id"; $result=mysql_query($res); ?>
on single page can in following manner:-
blog.php:-
<?php error_reporting(e_all); ini_set('display_errors',1); $connection = mysqli_connect("localhost", "root", "","accountant"); $new_array = array(); if(isset($_get['title'])){ if($connection){ $res = "select image,blog_title blogs blog_title='".$_get['title']."'"; $result=mysqli_query($connection,$res); $i = 0; if(mysqli_num_row($result)>0){ while($row = mysqli_fetch_assoc($result)){ $new_array[$i]['image'] = $row['image']; $new_array[$i]['blog_title'] = $row['blog_title']; $i++; } }else{ echo "no record exist"; } }else{ echo mysqli_error(); } }else{ echo "title not selected"; } ?> <table> <tbody> <?php if(count($new_array) >=1){?> <?php foreach($new_array $new_arr){?> <tr> <td><img src="admin/upload/<?php echo $new_arr['image'];?>" height="100" width="100"/></td> <td><a href="blogimages.php?title=<?php echo $new_arr['blog_title'];?>"><?php echo $new_arr['blog_title']; ?></a></td> </tr> <?php }?> </tbody> </table> <?php}?>
Comments
Post a Comment