Jump to content

displaying picture


franknu

Recommended Posts

ok I just have a problem displaying a picture, i only see the square of the picture but not picture. i have the path in my database the colum is called

Picture1

here is my  code

[code=php:0]

$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 "<a href=\"authorization/login.php\"> Login</a>";
  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"Number of business found:".$num_result." ";
  echo"</td>";
  echo"</tr>";




while($row = mysql_fetch_array($result)){
//picture
echo"<table>";

echo "<tr>";

echo "<td valign='top'>";

echo "<img src='$Picture1' width=150 height=125>"; ???


//business colums

echo"</td>";

echo "<td valign='top'>";

$bn = $row['BusinessName'];

echo "<a href=\"bizwebpage2.php?BusinessName=$bn\">$bn</a>";



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"<hr>";


echo "</td>";


//////second line


echo"<td valign='top'>";
require_once("includefiles/side_business_banner.php");
echo"</td>";
///end of line

echo "</tr>";
echo "</table>";

echo"</td>";
echo"</tr>";
echo"</table>";
}
[/code]

everything shows up fine except for the picture
Link to comment
https://forums.phpfreaks.com/topic/31241-displaying-picture/
Share on other sites

Ok i have a colum in the database call Picture1 where all the databata that is upload goes too,

so how do i set that up in my code because it should just display what is there with no problem

here is my full code:

[code=php:0]

$host = "localhost";
$username = "townsfin_localho";
$password = "abc123";
$database = "townsfin_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("");
}
$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 "<a href=\"authorization/login.php\"> Login</a>";
  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"Number of business found:".$num_result." ";
  echo"</td>";
  echo"</tr>";
 
 

 
while($row = mysql_fetch_array($result)){
//picture
echo"<table>";

echo "<tr>";

echo "<td valign='top'>";

echo "<img src='$Picture1' width=150 height=125>";


//business colums

echo"</td>";

echo "<td valign='top'>";

$bn = $row['BusinessName'];

echo "<a href=\"bizwebpage2.php?BusinessName=$bn\">$bn</a>";



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"<hr>";


echo "</td>";


//////second line


echo"<td valign='top'>";
require_once("includefiles/side_business_banner.php");
echo"</td>";
///end of line

echo "</tr>";
echo "</table>";

echo"</td>";
echo"</tr>";
echo"</table>";
}

[/code]

help
Link to comment
https://forums.phpfreaks.com/topic/31241-displaying-picture/#findComment-144549
Share on other sites




ok when i go to source code i get the link like this

<img src='/home/townsfin/public_html/business_images/r.gif' width=150 height=125>

but still it is not displaying pictures

This is my new code.
[code=php:0]

echo "<img src='" . $row['Picture1'] . "' width=150 height=125>";

[/code]

ok when i go to source code i get the link like this

<img src='/home/townsfin/public_html/business_images/r.gif' width=150 height=125>

but still it is not displaying pictures
Link to comment
https://forums.phpfreaks.com/topic/31241-displaying-picture/#findComment-144596
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.