Page 1 of 1

displaying Pictrure

Posted: Mon Nov 13, 2006 10:51 am
by franknu
ok I want to display a picture from my database i difines the variable but now it doesnt even show the frame for the picture , i also want to create a link or more info to another page.

my error message is Notice: Undefined index: includefiles/bizwebpage2.php in c:\program files\easyphp1-8\home\townsfinder\business_display.php on line 79
i tried difining it at the top but

Code: Select all

((( Online 79 I have echo '<a href="'. $row['includefiles/bizwebpage2.php'].'">' . $row['BusinessName'] . '</a>'; //link to an)))


Can anyone please tell me how to do this i dont know what to do anymore

here is my full code:

Code: Select all

<?php

$host = "localhost";
$username = "localhost";
$password = "abc123";
$database = "contacts";

$Categories = addslashes ($_POST['Categories']);
$make = addslashes ($_POST['make']);
$type = addslashes ($_POST['type']);

if(!$Categories ||!$make||!$type){
  echo "You have not enter all fields";
  exit;
  }
$db = mysql_connect($host, $username, $password) or die(mysql_error()); 
mysql_select_db($database) or die(mysql_error()); 


$bizwebpage2 = (isset($_FILES['bizwebpage2']) ? $_FILES['bizwebpage2']:'');
$Picture1 =  (isset($_FILES['Picture1']) ? $_FILES['Picture1']:'');


if(isset($_GET['Categories'])){
    $Categories = addslashes($_GET['Categories']);
    }
    else {
    echo("No Categories found."); 
}
 $query = "SELECT * FROM `business_info` WHERE `Categories` LIKE '%".$Categories."%'";
 $result = mysql_query($query) or die (mysql_error());
 $num_result = mysql_num_rows($result);
   echo "<table>";
if($num_result <= 0){
    echo("No Results found.");
    exit;
}
//include login row
  echo "<tr>";
  echo "<td>"; 
echo"login";
  echo "</td>";
  echo "</tr>";
  //inlude topsearch
  echo "<tr>";
  echo "<td>"; 
include("includefiles/topsearch.php"); 
  echo "</td>";
  echo "</tr>";
  
  //business found row
  echo"<tr>";
  echo"<td div align='right' bgcolor='DFDFDF'>";
  echo"<p>Number of business found: ".$num_result."</p>";
  echo"</td>";
  echo"</tr>";
  
while($row = mysql_fetch_array($result)){
echo "<tr>";
//picture colums
echo "<td>";
echo"<table>";
echo"<tr>";
echo"<td>";

echo "<img src='$Picture1' width=\'203\' height=\'152\'>"; // picture display
//business colums
echo"</td>";
echo"<td>";
echo '<a href="'. $row['includefiles/bizwebpage2.php'].'">' . $row['BusinessName'] . '</a>'; //link to another page
echo "<br>";
echo ($row["Slogan"]);
     echo "</strong><br>Address: ";
     echo (stripslashes($row["Business_Address"]));
     echo "<br>State: ";
     echo (stripslashes($row["make"]));
     echo "<br>City: ";
     echo (stripslashes($row["type"]));
     echo "<br>Tel: ";
     echo (stripslashes($row["Tel"]));
     echo "</p>";
	 echo"<hr>";
	 echo "</td>";
//include banner colums	 
	echo "<td>";
	include("includefiles/side_business_banner.php"); 
	 echo "</td>";
	 echo "</tr>";
	 echo "</table>";
	 echo "</td>";
	 echo "</tr>";
	 
	 echo "</table>";	 
}

?>

Posted: Mon Nov 13, 2006 1:13 pm
by aaronhall
Undefined index notice means that the array key has not been set. Do you have a column named "includefiles/bizwebpage2.php" in your mysql table?

Posted: Mon Nov 13, 2006 1:20 pm
by franknu
i dont have a colum name bizwebpage2.php in my database

Posted: Mon Nov 13, 2006 1:24 pm
by Luke

Code: Select all

echo '<a href="'. $row['includefiles/bizwebpage2.php'].'">' . $row['BusinessName'] . '</a>'; //link to another page
should probably be something more like:

Code: Select all

echo '<a href="includefiles/bizwebpage2.php">' . $row['BusinessName'] . '</a>'; //link to another page

Posted: Mon Nov 13, 2006 1:33 pm
by franknu
it works thank u, but what about the image..
how can i get the imag to display

Posted: Mon Nov 13, 2006 2:58 pm
by nickvd
Where is the image stored? in the database, or on disk, with the filename in the database?

Posted: Mon Nov 13, 2006 8:12 pm
by evilchris2003
to get the image to display you have to reference it in some way

either with a image stored within the database or a column in the databast that stores the image location as a pointer to the physical location on a disk