When i run this query images are displaying from php correctly.
<?php
mysql_connect("localhost", "root", "");
mysql_select_db("dawat");
$submit=$_GET['str'] ;
$sql = mysql_query("SELECT * FROM searchengine WHERE pagecontent LIKE '%$_GET%' ");
while($row=mysql_fetch_array($sql)) {
echo "<img src=image.php?pagecontent=".$row['pagecontent']." />";
}
?>
And code of image.php:
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
$conn = mysql_connect("localhost","root","");
if(!$conn)
{
echo mysql_error();
}
$db = mysql_select_db("dawat",$conn);
if(!$db)
{
echo mysql_error();
}
$pagecontent = $_GET['pagecontent'];
$q = "SELECT pageurl FROM searchengine where pagecontent='$pagecontent'";
$sql = mysql_query("$q",$conn);
if($sql)
{
$row = mysql_fetch_array($sql);
echo $row['pageurl'];
}
else
{
echo mysql_error();
}
?>
And when i run same code of above just few changes in search script:
<?php
mysql_connect("localhost", "root", "");
mysql_select_db("dawat");
$submit=$_GET['str'] ;
$sql = mysql_query("SELECT pageurl, BIT_COUNT(pagecontent^'$submit')
FROM searchengine WHERE pagecontent < 20 ORDER BY pagecontent ASC;
") or die(mysql_error());
while($row=mysql_fetch_array($sql)) {
echo "<img src=image.php?pagecontent=".$row['pagecontent']." />";
}
?>
It is showing errors that undefined index:pagecontent and also not showing images.Please help and thanks in advance.