squiblo Posted July 30, 2009 Share Posted July 30, 2009 i cannot complete echoing $imagelocation without getting an error i have tried everything, i would also like the image to be 100px be 100px <font face="Arial"> <?php //get data $button = $_GET['submit']; $search = $_GET['search']; if (!$button) header("location:unititled.php"); else { if (strlen($search)<3) header("location:unititled.php"); else { echo "You searched for <b>$search</b><hr size='1'>"; //connect to our database mysql_connect("localhost","",""); mysql_select_db(""); //explode our search term $search_exploded = explode(" ",$search); foreach($search_exploded as $search_each) { //construct query $x++; if ($x==1) $construct .= "username LIKE '%$search_each%'"; else $construct .= " OR username LIKE '%$search_each%'"; } //echo out construct $construct = "SELECT * FROM members WHERE $construct"; $run = mysql_query($construct); $foundnum = mysql_num_rows($run); if ($foundnum==0) echo "No results found."; else { echo "$foundnum result(s) found!<p>"; while ($runrows = mysql_fetch_assoc($run)) { //get data $state = ucwords($runrows['state']); $url = $runrows['url']; $username = ucwords($runrows['username']); $imagelocation = $runrows['imagelocation']; echo " <b>$username</b><br> $state<br> <a href='$url'>View Profile</a><br><br> "; echo "<hr width='300' align='left'>"; } } } } ?> </font> Link to comment https://forums.phpfreaks.com/topic/168095-solved-view-image/ Share on other sites More sharing options...
priti Posted July 30, 2009 Share Posted July 30, 2009 what is the error you are receiving and please point where in you are trying to echo $imagelocation in code? Link to comment https://forums.phpfreaks.com/topic/168095-solved-view-image/#findComment-886581 Share on other sites More sharing options...
squiblo Posted July 30, 2009 Author Share Posted July 30, 2009 i do not get an error in the code because i have taken the errors out, i am trying to echo $imagelocation here... //get data $state = ucwords($runrows['state']); $url = $runrows['url']; $username = ucwords($runrows['username']); $imagelocation = $runrows['imagelocation']; echo " <b>$username</b><br> $state<br> <a href='$url'>View Profile</a><br><br> // <------------echo $imagelocation here "; Link to comment https://forums.phpfreaks.com/topic/168095-solved-view-image/#findComment-886585 Share on other sites More sharing options...
Philip Posted July 30, 2009 Share Posted July 30, 2009 Well, right off the bad, you have something outputting (<font face="Arial">) to the browser before your header function. Link to comment https://forums.phpfreaks.com/topic/168095-solved-view-image/#findComment-886586 Share on other sites More sharing options...
squiblo Posted July 30, 2009 Author Share Posted July 30, 2009 ok i have just got rid of the font tags, how can i echo $imagelocation properly? Link to comment https://forums.phpfreaks.com/topic/168095-solved-view-image/#findComment-886590 Share on other sites More sharing options...
priti Posted July 30, 2009 Share Posted July 30, 2009 what is stored in database in imagelocation? can you post example? Link to comment https://forums.phpfreaks.com/topic/168095-solved-view-image/#findComment-886592 Share on other sites More sharing options...
squiblo Posted July 30, 2009 Author Share Posted July 30, 2009 in imagelocation, there are image paths, like "./profilepictures/nameofpicture.format" Link to comment https://forums.phpfreaks.com/topic/168095-solved-view-image/#findComment-886594 Share on other sites More sharing options...
priti Posted July 30, 2009 Share Posted July 30, 2009 make sure > query is correctly generated > query is returning correct output echo " <b>$username</b><br> $state<br> <a href='$url'>View Profile</a><br><br> // <------------echo $imagelocation here "; in echo you are echoing image location ????? echo "$username-$state-$imagelocation" what does above line prints. Please make sure that your query returning correct data. Link to comment https://forums.phpfreaks.com/topic/168095-solved-view-image/#findComment-886598 Share on other sites More sharing options...
squiblo Posted July 30, 2009 Author Share Posted July 30, 2009 i tried this but resulted in another error... //get data $state = ucwords($runrows['state']); $url = $runrows['url']; $username = ucwords($runrows['username']); $imagelocation = ['imagelocation']; echo " <b>$username</b><br> $state<br> <a href='$url'>View Profile</a><br><br> <img src =$imagelocation width='100' height='100' border='0'> "; echo "<hr width='300' align='left'>"; Link to comment https://forums.phpfreaks.com/topic/168095-solved-view-image/#findComment-886599 Share on other sites More sharing options...
priti Posted July 30, 2009 Share Posted July 30, 2009 <img src ="$imagelocation" width='100' height='100' border='0'> you are missing with " " around $imagelocation what is the error!!! Link to comment https://forums.phpfreaks.com/topic/168095-solved-view-image/#findComment-886600 Share on other sites More sharing options...
squiblo Posted July 30, 2009 Author Share Posted July 30, 2009 sorry i do not know the error, i just get a blank page how do i find out? Link to comment https://forums.phpfreaks.com/topic/168095-solved-view-image/#findComment-886602 Share on other sites More sharing options...
priti Posted July 30, 2009 Share Posted July 30, 2009 before displaying image do header("Content-type:image/jpeg"); please take care of image format. and see if it displays Link to comment https://forums.phpfreaks.com/topic/168095-solved-view-image/#findComment-886603 Share on other sites More sharing options...
squiblo Posted July 30, 2009 Author Share Posted July 30, 2009 like this? //get data $state = ucwords($runrows['state']); $url = $runrows['url']; $username = ucwords($runrows['username']); $imagelocation = ['imagelocation']; echo " <b>$username</b><br> $state<br> <a href='$url'>View Profile</a><br><br> header("Content-type:image/jpeg"); <img src =$imagelocation width='100' height='100' border='0'> "; echo "<hr width='300' align='left'>"; i still get an error Link to comment https://forums.phpfreaks.com/topic/168095-solved-view-image/#findComment-886604 Share on other sites More sharing options...
priti Posted July 30, 2009 Share Posted July 30, 2009 try this echo "<b>$username</b><br> $state<br> <a href='$url'>View Profile</a><br><br>"; header("Content-type:image/jpeg"); <img src ="$imagelocation" width='100' height='100' border='0'/> Do let me know error if any error pops up Link to comment https://forums.phpfreaks.com/topic/168095-solved-view-image/#findComment-886605 Share on other sites More sharing options...
squiblo Posted July 30, 2009 Author Share Posted July 30, 2009 i get an error with this... echo " <b>$username</b><br> $state<br> <a href='$url'>View Profile</a><br><br> "; header("Content-type:image/jpeg"); <img src ="$imagelocation" width='100' height='100' border='0'/> how can i find out what line the error is on? Link to comment https://forums.phpfreaks.com/topic/168095-solved-view-image/#findComment-886607 Share on other sites More sharing options...
RichardRotterdam Posted July 30, 2009 Share Posted July 30, 2009 i do not get an error in the code because i have taken the errors out What do you mean with taken the errors out? Did you turn off error reporting or did you fix the errors you received? i tried this but resulted in another error... sorry i do not know the error, i just get a blank page how do i find out? Here you say you get an error but you don't know the error. How do you know it's an error to begin with then? Do you concider a blank screen as an error Link to comment https://forums.phpfreaks.com/topic/168095-solved-view-image/#findComment-886611 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.