Jump to content

Recommended Posts

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

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

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

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

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

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

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  :confused:

 

Link to comment
https://forums.phpfreaks.com/topic/168095-solved-view-image/#findComment-886611
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.