franknu Posted December 19, 2006 Share Posted December 19, 2006 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 Picture1here 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)){//pictureecho"<table>";echo "<tr>";echo "<td valign='top'>";echo "<img src='$Picture1' width=150 height=125>"; ???//business columsecho"</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 More sharing options...
taith Posted December 19, 2006 Share Posted December 19, 2006 what gets outputted to your sourcecode? Link to comment https://forums.phpfreaks.com/topic/31241-displaying-picture/#findComment-144505 Share on other sites More sharing options...
franknu Posted December 19, 2006 Author Share Posted December 19, 2006 just the picture frame gets output Link to comment https://forums.phpfreaks.com/topic/31241-displaying-picture/#findComment-144530 Share on other sites More sharing options...
taith Posted December 19, 2006 Share Posted December 19, 2006 ya... but if you view your sourceyour [code]<img src="">[/code]does $picture1 have value? Link to comment https://forums.phpfreaks.com/topic/31241-displaying-picture/#findComment-144533 Share on other sites More sharing options...
franknu Posted December 19, 2006 Author Share Posted December 19, 2006 echo "<img src='$Picture1' width=150 height=125>"; this is the source where the picture should get display Link to comment https://forums.phpfreaks.com/topic/31241-displaying-picture/#findComment-144536 Share on other sites More sharing options...
taith Posted December 19, 2006 Share Posted December 19, 2006 nonono... look at the page, right click, view source. find that line... that'll tell you why its not showing... Link to comment https://forums.phpfreaks.com/topic/31241-displaying-picture/#findComment-144538 Share on other sites More sharing options...
franknu Posted December 19, 2006 Author Share Posted December 19, 2006 ok, sorry this is what showing on the source code<img src='' width=150 height=125> Link to comment https://forums.phpfreaks.com/topic/31241-displaying-picture/#findComment-144540 Share on other sites More sharing options...
designationlocutus Posted December 19, 2006 Share Posted December 19, 2006 From what I can see, you haven't assigned $Picture1 with your picture record from the database. Link to comment https://forums.phpfreaks.com/topic/31241-displaying-picture/#findComment-144542 Share on other sites More sharing options...
taith Posted December 19, 2006 Share Posted December 19, 2006 well... theres your problem... $picture1 has no value... you have to set it somewhere... Link to comment https://forums.phpfreaks.com/topic/31241-displaying-picture/#findComment-144543 Share on other sites More sharing options...
franknu Posted December 19, 2006 Author Share Posted December 19, 2006 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)){//pictureecho"<table>";echo "<tr>";echo "<td valign='top'>";echo "<img src='$Picture1' width=150 height=125>"; //business columsecho"</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 More sharing options...
designationlocutus Posted December 19, 2006 Share Posted December 19, 2006 Ah I see. I think you have to move the uploaded file into a directory before it can be displayed on your page. Link to comment https://forums.phpfreaks.com/topic/31241-displaying-picture/#findComment-144552 Share on other sites More sharing options...
franknu Posted December 19, 2006 Author Share Posted December 19, 2006 it is already into a directory Link to comment https://forums.phpfreaks.com/topic/31241-displaying-picture/#findComment-144590 Share on other sites More sharing options...
franknu Posted December 19, 2006 Author Share Posted December 19, 2006 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 picturesThis 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 More sharing options...
simcoweb Posted December 19, 2006 Share Posted December 19, 2006 This is the code for displaying your results. Where's the code for uploading the picture? Link to comment https://forums.phpfreaks.com/topic/31241-displaying-picture/#findComment-144597 Share on other sites More sharing options...
JP128 Posted December 19, 2006 Share Posted December 19, 2006 Where is it getting /home/townsfin/public_html/ from? That is your problem, you are reading the entire route to the picture locally. You need to just have Picture1 business_images/r.gif.... Link to comment https://forums.phpfreaks.com/topic/31241-displaying-picture/#findComment-144630 Share on other sites More sharing options...
franknu Posted December 19, 2006 Author Share Posted December 19, 2006 that is coming from the database the whole path.i think that i should get only business_images/name.gifhelp please Link to comment https://forums.phpfreaks.com/topic/31241-displaying-picture/#findComment-144636 Share on other sites More sharing options...
JP128 Posted December 19, 2006 Share Posted December 19, 2006 then say $Picture1 = $sql[\'Picture1\'];but replace whatever $sql is... Link to comment https://forums.phpfreaks.com/topic/31241-displaying-picture/#findComment-144639 Share on other sites More sharing options...
JP128 Posted December 19, 2006 Share Posted December 19, 2006 But now, I need to go to lunch because i am at school, and I dont have another period with access to a comp...and i dont know why the \\\'s are being put in... sorry about that. Link to comment https://forums.phpfreaks.com/topic/31241-displaying-picture/#findComment-144640 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.