Jump to content

Recommended Posts

i cannot find where im going wrong, or if im doing it the right way, the aim is for the image to be "height:500px" if the search was less the 3 characters long and "height:1200px" if the search was more than 3 characters long.

 

<?php


//get data
$button = $_GET['submit'];
$search = $_GET['search'];
echo '<div id="wb_Shape2" style="position:absolute;top:200px;left:54px;width:793px;z-index:10;';
if (!$button)
header("location:advsearch.php");
else
{
if (strlen($search)<3)
	echo "Your search must be at least 3 characters long.";
{
echo 'height:500px;';
}
else
{
	echo 'height:1200px';
}
<img src="/Images/body_img.jpg" id="Shape2" align="top" alt="" title="" border="0" width="793"></div>';
?>

Link to comment
https://forums.phpfreaks.com/topic/169331-solved-resizing-image/
Share on other sites

Hi

 

I assume you are trying to add the heigth to the style of the div, in which case you need to close the syle and the div (ie, ad a " > to it).

 

Also as you are doing an echo of the div the header("location:advsearch.php"); won't work as you cannot have output any before it.

 

All the best

 

Keith

i was following the idea of this working code

<?php
echo '<div id="wb_Shape2" style="position:absolute;left:54px;width:793px;height:412px;z-index:10;';
if(isset($_SESSION['myusername']))
{
   echo 'top:200px;';
}
else
{
   echo 'top:170px;';
}
echo '" align="center">
<img src="/Images/body_img.jpg" id="Shape2" align="top" alt="" title="" border="0" width="793" height="412"></div>';
?>

new code, still not working

<?php
echo '<div id="wb_Shape2" style="position:absolute;top:200px;left:54px;width:793px;z-index:10;';

//get data
$button = $_GET['submit'];
$search = $_GET['search'];

if (!$button)
header("location:advsearch.php");
else
{

if (strlen($search)<3)
	echo "Your search must be at least 3 characters long.";
{
echo 'height:500px;';
}
else
{
echo 'height:1200px';
}
}
echo '" align="center">
<img src="/Images/body_img.jpg" id="Shape2" align="top" alt="" title="" border="0" width="793"></div>';

This is how you should of done it

 

<?php

if (!isset(_GET['button'])
{
   header("location:advsearch.php");
   exit;
}

$error_msg = '';
$search = $_GET['search'];

if(strlen($search) < 3)
{
    $error_msg = "Your search must be at least 3 characters long.";
    $div_height = 'height:500px;';
}
else
{
     $div_height = 'height:1200px';
}
?>

<div id="wb_Shape2" style="position:absolute;top:200px;left:54px;width:793px;z-index:10;<?php echo $div_height: ?>" align="center">
  <?php echo $error_msg; ?>
  <img src="/Images/body_img.jpg" id="Shape2" align="top" alt="" title="" border="0" width="793">
</div>

im sure that works but i think ive entered it in to the rest of the code incorrectly

<?php

if (!isset(_GET['button'])
{
   header("location:advsearch.php");
   exit;
}

$error_msg = '';
$search = $_GET['search'];

if(strlen($search) < 3)
{
    $error_msg = "Your search must be at least 3 characters long.";
    $div_height = 'height:500px;';
}
else
{
     $div_height = 'height:1200px';
}


<div id="wb_Shape2" style="position:absolute;top:200px;left:54px;width:793px;z-index:10;<?php echo $div_height: ?>" align="center">
  <?php echo $error_msg; ?>
  <img src="/Images/body_img.jpg" id="Shape2" align="top" alt="" title="" border="0" width="793">
</div>

	//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 "You searched for <b>$search</b>. No results found.";
	else
	{
	   echo "You searched for <b>$search</b><br>$foundnum result(s) found!<p><hr size='1' width='387'color='#E6E6E6'>";
	   
	   while ($runrows = mysql_fetch_assoc($run))
	   {
	 //get data
                $state = ucwords($runrows['state']);
                $url = $runrows['url'];
                $username = ucwords($runrows['username']);
                $imagelocation = $runrows['imagelocation'];
                if ($imagelocation == "") {
                $imagelocation = "./profileimages/noprofilepic.jpg";
} 


	echo "
                <img src ='$imagelocation' width='100' height='105' border='0' align='left' style='padding-right:10px'><br>
	<b>$username</b><br>
	$state<br>
	<a href='$url'>View Profile</a><br><br><br>
	<hr size='1' width='387' align='left' color='#E6E6E6'>
      		   
      		
      		
        	
  		";

  		
             }


           }   



        }	



}	



?>

Hi

 

I agree with wildteeen88.

 

Your page appears to be trying to put out a line saying:-

 

<div id="wb_Shape2" style="position:absolute;top:200px;left:54px;width:793px;z-index:10;Your search must be at least 3 characters long.height:500px;" align="center"><img src="/Images/body_img.jpg" id="Shape2" align="top" alt="" title="" border="0" width="793"></div>

 

However the if (strlen($search)<3) is only going to control the echo, and the else will not be related to it (will probably cause an error).

 

Your latest example you gave you hace output html without breaking out of php, and then broken out after the echo, but then not back to php for the database connection

 

Quick reformat and clean up gives:-

 

<?php

if (!isset(_GET['button'])
{
header("location:advsearch.php");
exit;
}

$error_msg = '';
$search = $_GET['search'];

if(strlen($search) < 3)
{
$error_msg = "Your search must be at least 3 characters long.";
$div_height = 'height:500px;';
}
else
{
$div_height = 'height:1200px';
}
?>

<div id="wb_Shape2" style="position:absolute;top:200px;left:54px;width:793px;z-index:10;<?php echo $div_height: ?>" align="center">
<?php echo $error_msg; ?>
<img src="/Images/body_img.jpg" id="Shape2" align="top" alt="" title="" border="0" width="793">
</div>
<?php
//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 "You searched for <b>$search</b>. No results found.";
else
{
echo "You searched for <b>$search</b><br>$foundnum result(s) found!<p><hr size='1' width='387'color='#E6E6E6'>";

while ($runrows = mysql_fetch_assoc($run))
{
	//get data
	$state = ucwords($runrows['state']);
	$url = $runrows['url'];
	$username = ucwords($runrows['username']);
	$imagelocation = $runrows['imagelocation'];
	if ($imagelocation == "") 
	{
		$imagelocation = "./profileimages/noprofilepic.jpg";
	} 
	echo "
	<img src ='$imagelocation' width='100' height='105' border='0' align='left' style='padding-right:10px'><br>
	<b>$username</b><br>
	$state<br>
	<a href='$url'>View Profile</a><br><br><br>
	<hr size='1' width='387' align='left' color='#E6E6E6'>
	";
}
}   
?>

 

All the best

 

Keith

sorry for this guys i think ive done everything you have said but something still isn't right

 

<?php
session_start();
if(!isset($_SESSION['myusername'])){
header("location:notloggedin.php");
exit;
}
?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">


<html>
<head>
<meta name="googlebot" content="noindex">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Squiblo search results!</title>
<style type="text/css">
div#container
{
   width: 900px;
   position: relative;
   margin-top: 0px;
   margin-left: auto;
   margin-right: auto;
   text-align: left;
}
body
{
   text-align: center;
   margin: 0;
}






</style>

<style type="text/css">
form
{
position:absolute;
left:70px;
top:210px;
z-index:14;
}
</style>

</head>
<body bgcolor="#E6E6E6" text="#FFFFFF">

<div id="container">
<div id="wb_Shape1" style="position:absolute;left:55px;top:41px;width:792px;height:125px;z-index:2" align="center">
<img src="/Images/header_img.jpg" id="Shape1" align="top" alt="" title="" border="0" width="792" height="125"></div>
<div id="wb_Text1" style="position:absolute;left:60px;top:85px;width:325px;height:72px;z-index:3" align="left">
<font style="font-size:70px" color="#FFFFFF" face="impact"><a href="/index.php" style="text-decoration:none"> <font color="#FFFFFF">SQUIBLO</a></font></font></div>







<div id="menubar" style="position:absolute;left:54px;top:168px;width:793px;height:30px;z-index:13" align="center"> 
<?php
if(isset($_SESSION['myusername']))
echo '<img src="/Images/header_img.jpg" id="menubar" align="top" alt="" title="" border="0" width="793" height="30">';
?>
</div>






<?php
if($_SESSION['myusername']){
?>
<div id="wb_Text1" style="position:absolute;left:684px;top:55px;width:151px;height:14px;z-index:7" align="right">
<font style="font-size:13px" color="#FFFFFF" face="Arial">You are logged in as:</font><br>

<font style="font-size:15px" color="#FF0000" face="Arial">
<?php
echo ucwords(strtolower($_SESSION['myusername']));
?>
</font></div>

<div id="logout" style="position:absolute;left:775px;top:130px;width:64px;height:23px;z-index:12" align="center"><a href="/logout.php">
<?php      
echo '<img src="/Images/logout.png" id="logout" align="top" alt="logout" title="" border="0" width="64" height="23">';
?>
</a></div>

<div id="apps" style="position:absolute;left:754px;top:169px;z-index:14" align="center">
<?php
include 'accmenu.php';
?>
</div>

<div id="wb_Text3" style="position:absolute;left:60px;top:173px;width:100px;height:30px;z-index:14" align="left">
<font style="font-size:17px" color="#FFFFFF" face="Arial"><a href="/index.php" style="text-decoration:none"><font color="#FFFFFF">Profile</a></font></font></div>

<div id="wb_Text4" style="position:absolute;left:123px;top:173px;width:100px;height:30px;z-index:14" align="left">
<font style="font-size:17px" color="#FFFFFF" face="Arial"><a href="http://google.com" style="text-decoration:none"><font color="#FFFFFF">Friends</a></font></font></div>

<div id="wb_Text5" style="position:absolute;left:195px;top:173px;width:100px;height:30px;z-index:14" align="left">
<font style="font-size:17px" color="#FFFFFF" face="Arial"><a href="http://google.com" style="text-decoration:none"><font color="#FFFFFF">Photos</a></font></font></div>

<div id="wb_Text6" style="position:absolute;left:262px;top:173px;width:100px;height:30px;z-index:14" align="left">
<font style="font-size:17px" color="#FFFFFF" face="Arial"><a href="http://google.com" style="text-decoration:none"><font color="#FFFFFF">Mail</a></font></font></div>


<div id="wb_Text8" style="position:absolute;left:680px;top:173px;width:100px;height:30px;z-index:14" align="left">
<font style="font-size:17px" color="#FFFFFF" face="Arial"><a href="http://google.com" style="text-decoration:none"><font color="#FFFFFF">Settings</a></font></font></div>


<?php
}
else
{
?>
<form name="form1" method="post" action="checklogin.php">
   <input type="text" id="myusername" style="position:absolute;left:651px;top:59px;width:174px;font-family:Arial;font-size:13px;z-index:4" size="29" name="myusername" value="" title="username">
   <input type="password" id="mypassword" style="position:absolute;left:651px;top:86px;width:174px;font-family:Arial;font-size:13px;z-index:5" size="29" name="mypassword" value="" tabindex="password" title="password">
   <input type="checkbox" id="Checkbox1" name="Checkbox1" value="on" style="position:absolute;left:648px;top:113px;font-family:Arial;font-size:13px;z-index:6">
  <input type="submit" id="Button1" name="Login" value="Login" style="position:absolute;left:778px;top:117px;width:50px;height:43px;font-family:Arial;font-size:13px;z-index:8" title="Login">
</form>
   <div id="wb_Text7" style="position:absolute;left:584px;top:63px;width:47px;height:16px;z-index:22" align="left">
   <font style="font-size:13px" color="#FFFFFF" face="Arial">Username:</font></div>
   <div id="wb_Text8" style="position:absolute;left:586px;top:88px;width:65px;height:16px;z-index:23" align="left">
   <font style="font-size:13px" color="#FFFFFF" face="Arial">Password:</font></div>
   <div id="wb_Text2" style="position:absolute;left:669px;top:113px;width:111px;height:14px;z-index:7" align="left">
   <font style="font-size:11px" color="#FFFFFF" face="Arial">Remember Me</font></div>
   <div id="wb_Text3" style="position:absolute;left:651px;top:131px;width:122px;height:14px;z-index:9" align="left">
   <font style="font-size:11px" color="#FFFFFF" face="Arial">Forgot your password?</font></div>

<?php
}
?>


   <form action='http://www.squiblo.com/results.php?submit=Search' method='GET'>
      <font face='sans-serif' size='6'>

         <input type='text' size='20' name='search'>
<select name="Gender" size="1" id="Combobox1">
    		<option selected>All</option>
    		<option>People</option>
    		<option>Groups</option>
    		<option>Photos</option>
    		<option>Videos</option>
    		<option>Games</option>
	</select>
<font face='Arial' size='3'>and</font>
  <select name="Gender" size="1" id="Combobox1">
    		<option selected>Nothing</option>
    		<option>People</option>
    		<option>Groups</option>
    		<option>Photos</option>
    		<option>Videos</option>
    		<option>Games</option>
	</select>	
 <input type='submit' name='submit' value='Search'>
    
      <input type="hidden" name="submit" value="Search">
      </font>
   </form>

   



<div id="results 1st ad" style="position:absolute;top:350px;left:490px;z-index:14">
<script type="text/javascript"><!--
google_ad_client = "pub-1084151793964040";
/* 336x280 1st results */
google_ad_slot = "7001820362";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>


<div id="results" style="position:absolute;left:70px;top:260px;z-index:16">

<font face="arial">

<?php

if (!isset(_GET['button'])
{
header("location:advsearch.php");
exit;
}

$error_msg = '';
$search = $_GET['search'];

if(strlen($search) < 3)
{
$error_msg = "Your search must be at least 3 characters long.";
$div_height = 'height:500px;';
}
else
{
$div_height = 'height:1200px';
}
?>

<div id="wb_Shape2" style="position:absolute;top:200px;left:54px;width:793px;z-index:10;<?php echo $div_height: ?>" align="center">
<?php echo $error_msg; ?>
<img src="/Images/body_img.jpg" id="Shape2" align="top" alt="" title="" border="0" width="793">
</div>
<?php
//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 "You searched for <b>$search</b>. No results found.";
else
{
echo "You searched for <b>$search</b><br>$foundnum result(s) found!<p><hr size='1' width='387'color='#E6E6E6'>";

while ($runrows = mysql_fetch_assoc($run))
{
	//get data
	$state = ucwords($runrows['state']);
	$url = $runrows['url'];
	$username = ucwords($runrows['username']);
	$imagelocation = $runrows['imagelocation'];
	if ($imagelocation == "") 
	{
		$imagelocation = "./profileimages/noprofilepic.jpg";
	} 
	echo "
	<img src ='$imagelocation' width='100' height='105' border='0' align='left' style='padding-right:10px'><br>
	<b>$username</b><br>
	$state<br>
	<a href='$url'>View Profile</a><br><br><br>
	<hr size='1' width='387' align='left' color='#E6E6E6'>
	";
}
}   
?>

</font>
</div>





</div>
</body>
</html>




Oosp sorry I made a few mistakes.

 

This

if (!isset(_GET['button'])

 

should be

if (!isset(_GET['button']))

 

This

<div id="wb_Shape2" style="position:absolute;top:200px;left:54px;width:793px;z-index:10;<?php echo $div_height: ?>" align="center">

 

should be

<div id="wb_Shape2" style="position:absolute;top:200px;left:54px;width:793px;z-index:10;<?php echo $div_height; ?>" align="center">

 

 

Hi

 

Nothing obvious. What is the problem you are getting now.

 

Couple of minor things though. You presumeably mean $_GET['button'] rather than  _GET['button'].

 

Also this

 

if (!isset(_GET['button'])
{
header("location:advsearch.php");
exit;
}

 

will cause an error as you have already put out some data prior to the attempt to jump to another page.

 

All the best

 

Keith

ok now, the page does not have any errors, its as though the page doesnt know the php script is there and is not showing any results or the image on the page if the search is less that 3 or even more than 3.

 

<?php
session_start();
if(!isset($_SESSION['myusername'])){
header("location:notloggedin.php");
exit;
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">


<html>
<head>
<meta name="googlebot" content="noindex">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Squiblo search results!</title>
<style type="text/css">
div#container
{
   width: 900px;
   position: relative;
   margin-top: 0px;
   margin-left: auto;
   margin-right: auto;
   text-align: left;
}
body
{
   text-align: center;
   margin: 0;
}






</style>

<style type="text/css">
form
{
position:absolute;
left:70px;
top:210px;
z-index:14;
}
</style>

</head>
<body bgcolor="#E6E6E6" text="#FFFFFF">

<div id="container">
<div id="wb_Shape1" style="position:absolute;left:55px;top:41px;width:792px;height:125px;z-index:2" align="center">
<img src="/Images/header_img.jpg" id="Shape1" align="top" alt="" title="" border="0" width="792" height="125"></div>
<div id="wb_Text1" style="position:absolute;left:60px;top:85px;width:325px;height:72px;z-index:3" align="left">
<font style="font-size:70px" color="#FFFFFF" face="impact"><a href="/index.php" style="text-decoration:none"> <font color="#FFFFFF">SQUIBLO</a></font></font></div>







<div id="menubar" style="position:absolute;left:54px;top:168px;width:793px;height:30px;z-index:13" align="center"> 
<?php
if(isset($_SESSION['myusername']))
echo '<img src="/Images/header_img.jpg" id="menubar" align="top" alt="" title="" border="0" width="793" height="30">';
?>
</div>






<?php
if($_SESSION['myusername']){
?>
<div id="wb_Text1" style="position:absolute;left:684px;top:55px;width:151px;height:14px;z-index:7" align="right">
<font style="font-size:13px" color="#FFFFFF" face="Arial">You are logged in as:</font><br>

<font style="font-size:15px" color="#FF0000" face="Arial">
<?php
echo ucwords(strtolower($_SESSION['myusername']));
?>
</font></div>

<div id="logout" style="position:absolute;left:775px;top:130px;width:64px;height:23px;z-index:12" align="center"><a href="/logout.php">
<?php      
echo '<img src="/Images/logout.png" id="logout" align="top" alt="logout" title="" border="0" width="64" height="23">';
?>
</a></div>

<div id="apps" style="position:absolute;left:754px;top:169px;z-index:14" align="center">
<?php
include 'accmenu.php';
?>
</div>

<div id="wb_Text3" style="position:absolute;left:60px;top:173px;width:100px;height:30px;z-index:14" align="left">
<font style="font-size:17px" color="#FFFFFF" face="Arial"><a href="/index.php" style="text-decoration:none"><font color="#FFFFFF">Profile</a></font></font></div>

<div id="wb_Text4" style="position:absolute;left:123px;top:173px;width:100px;height:30px;z-index:14" align="left">
<font style="font-size:17px" color="#FFFFFF" face="Arial"><a href="http://google.com" style="text-decoration:none"><font color="#FFFFFF">Friends</a></font></font></div>

<div id="wb_Text5" style="position:absolute;left:195px;top:173px;width:100px;height:30px;z-index:14" align="left">
<font style="font-size:17px" color="#FFFFFF" face="Arial"><a href="http://google.com" style="text-decoration:none"><font color="#FFFFFF">Photos</a></font></font></div>

<div id="wb_Text6" style="position:absolute;left:262px;top:173px;width:100px;height:30px;z-index:14" align="left">
<font style="font-size:17px" color="#FFFFFF" face="Arial"><a href="http://google.com" style="text-decoration:none"><font color="#FFFFFF">Mail</a></font></font></div>


<div id="wb_Text8" style="position:absolute;left:680px;top:173px;width:100px;height:30px;z-index:14" align="left">
<font style="font-size:17px" color="#FFFFFF" face="Arial"><a href="http://google.com" style="text-decoration:none"><font color="#FFFFFF">Settings</a></font></font></div>


<?php
}
else
{
?>
<form name="form1" method="post" action="checklogin.php">
   <input type="text" id="myusername" style="position:absolute;left:651px;top:59px;width:174px;font-family:Arial;font-size:13px;z-index:4" size="29" name="myusername" value="" title="username">
   <input type="password" id="mypassword" style="position:absolute;left:651px;top:86px;width:174px;font-family:Arial;font-size:13px;z-index:5" size="29" name="mypassword" value="" tabindex="password" title="password">
   <input type="checkbox" id="Checkbox1" name="Checkbox1" value="on" style="position:absolute;left:648px;top:113px;font-family:Arial;font-size:13px;z-index:6">
  <input type="submit" id="Button1" name="Login" value="Login" style="position:absolute;left:778px;top:117px;width:50px;height:43px;font-family:Arial;font-size:13px;z-index:8" title="Login">
</form>
   <div id="wb_Text7" style="position:absolute;left:584px;top:63px;width:47px;height:16px;z-index:22" align="left">
   <font style="font-size:13px" color="#FFFFFF" face="Arial">Username:</font></div>
   <div id="wb_Text8" style="position:absolute;left:586px;top:88px;width:65px;height:16px;z-index:23" align="left">
   <font style="font-size:13px" color="#FFFFFF" face="Arial">Password:</font></div>
   <div id="wb_Text2" style="position:absolute;left:669px;top:113px;width:111px;height:14px;z-index:7" align="left">
   <font style="font-size:11px" color="#FFFFFF" face="Arial">Remember Me</font></div>
   <div id="wb_Text3" style="position:absolute;left:651px;top:131px;width:122px;height:14px;z-index:9" align="left">
   <font style="font-size:11px" color="#FFFFFF" face="Arial">Forgot your password?</font></div>

<?php
}
?>


   <form action='http://www.squiblo.com/results.php?submit=Search' method='GET'>
      <font face='sans-serif' size='6'>

         <input type='text' size='20' name='search'>
<select name="Gender" size="1" id="Combobox1">
    		<option selected>All</option>
    		<option>People</option>
    		<option>Groups</option>
    		<option>Photos</option>
    		<option>Videos</option>
    		<option>Games</option>
	</select>
<font face='Arial' size='3'>and</font>
  <select name="Gender" size="1" id="Combobox1">
    		<option selected>Nothing</option>
    		<option>People</option>
    		<option>Groups</option>
    		<option>Photos</option>
    		<option>Videos</option>
    		<option>Games</option>
	</select>	
 <input type='submit' name='submit' value='Search'>
    
      <input type="hidden" name="submit" value="Search">
      </font>
   </form>

   



<div id="results 1st ad" style="position:absolute;top:350px;left:490px;z-index:14">
<script type="text/javascript"><!--
google_ad_client = "pub-1084151793964040";
/* 336x280 1st results */
google_ad_slot = "7001820362";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>


<div id="results" style="position:absolute;left:70px;top:260px;z-index:16">

<font face="arial">

<?php

if (!isset($_GET['button']))
{
header("location:advsearch.php");
exit;
}

$error_msg = '';
$search = $_GET['search'];

if(strlen($search) < 3)
{
$error_msg = "Your search must be at least 3 characters long.";
$div_height = 'height:500px;';
}
else
{
$div_height = 'height:1200px';
}
?>

<div id="wb_Shape2" style="position:absolute;top:200px;left:54px;width:793px;z-index:10;<?php echo $div_height; ?>" align="center">
<?php echo $error_msg; ?>
<img src="/Images/body_img.jpg" id="Shape2" align="top" alt="" title="" border="0" width="793">
</div>
<?php
//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 "You searched for <b>$search</b>. No results found.";
else
{
echo "You searched for <b>$search</b><br>$foundnum result(s) found!<p><hr size='1' width='387'color='#E6E6E6'>";

while ($runrows = mysql_fetch_assoc($run))
{
	//get data
	$state = ucwords($runrows['state']);
	$url = $runrows['url'];
	$username = ucwords($runrows['username']);
	$imagelocation = $runrows['imagelocation'];
	if ($imagelocation == "") 
	{
		$imagelocation = "./profileimages/noprofilepic.jpg";
	} 
	echo "
	<img src ='$imagelocation' width='100' height='105' border='0' align='left' style='padding-right:10px'><br>
	<b>$username</b><br>
	$state<br>
	<a href='$url'>View Profile</a><br><br><br>
	<hr size='1' width='387' align='left' color='#E6E6E6'>
	";
}
}   
?>

</font>
</div>





</div>
</body>
</html>




ive just moved a few things around but this code is not showing on the page

 

<?php

if (!isset($_GET['button']))
{
header("location:advsearch.php");
exit;
}


$search = $_GET['search'];

if(strlen($search)<3)
{
echo "Your search must be at least 3 characters long.";
$div_height = 'height:500px;';
}
else
{
$div_height = 'height:1200px;';
}
?>

<div id="wb_Shape2" style="position:absolute;top:200px;left:54px;<?php echo $div_height; ?>width:793px;z-index:10;" align="center">
<img src="/Images/body_img.jpg" id="Shape2" align="top" alt="" title="" border="0" width="793">
</div>

<?php
//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 "You searched for <b>$search</b>. No results found.";
else
{
echo "You searched for <b>$search</b><br>$foundnum result(s) found!<p><hr size='1' width='387'color='#E6E6E6'>";

while ($runrows = mysql_fetch_assoc($run))
{
	//get data
	$state = ucwords($runrows['state']);
	$url = $runrows['url'];
	$username = ucwords($runrows['username']);
	$imagelocation = $runrows['imagelocation'];
	if ($imagelocation == "") 
	{
		$imagelocation = "./profileimages/noprofilepic.jpg";
	} 
	echo "
	<img src ='$imagelocation' width='100' height='105' border='0' align='left' style='padding-right:10px'><br>
	<b>$username</b><br>
	$state<br>
	<a href='$url'>View Profile</a><br><br><br>
	<hr size='1' width='387' align='left' color='#E6E6E6'>
	";
}
}   
?>

yes i mean the blue box,

would something like this work?

 

if(strlen($search)<3)
{
echo "Your search must be at least 3 characters long.";
$div_height = 'height:500px;';
             $img_height = 'height="500"'; 
}
else
{
$div_height = 'height:1200px;';
             $img_height = 'height="1200"'; 

}
?>

<div id="wb_Shape2" style="position:absolute;top:200px;left:54px;<?php echo $div_height; ?>width:793px;z-index:10;" align="center">
<img src="/Images/body_img.jpg" id="Shape2" align="top" alt="" title="" border="0" ;<?php echo $img_height; ?> width="793" >
</div>

<div id="results" style="position:absolute;left:70px;top:260px;z-index:16">

 

<font face="arial">

 

<?php

 

 

 

 

$search = $_GET['search'];

 

if(strlen($search)<3)

{

echo "Your search must be at least 3 characters long.";

$div_height = 'height:500px;';

$img_height = 'height="500"';

}

else

{

$div_height = 'height:1200px;';

$img_height = 'height="1200"';

}

?>

 

<div id="wb_Shape2" style="position:absolute;top:200px;left:54px;<?php echo $div_height; ?>width:793px;z-index:-1;" align="center">

<img src="/Images/body_img.jpg" id="Shape2" align="top" alt="" title="" border="0"<?php echo $img_height; ?> width="793">

</div>

 

<?php

//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 "You searched for <b>$search</b>. No results found.";

else

{

echo "You searched for <b>$search</b><br>$foundnum result(s) found!<p><hr size='1' width='387'color='#E6E6E6'>";

 

while ($runrows = mysql_fetch_assoc($run))

{

//get data

$state = ucwords($runrows['state']);

$url = $runrows['url'];

$username = ucwords($runrows['username']);

$imagelocation = $runrows['imagelocation'];

if ($imagelocation == "")

{

$imagelocation = "./profileimages/noprofilepic.jpg";

}

echo "

<img src ='$imagelocation' width='100' height='105' border='0' align='left' style='padding-right:10px'><br>

<b>$username</b><br>

$state<br>

<a href='$url'>View Profile</a><br><br><br>

<hr size='1' width='387' align='left' color='#E6E6E6'>

";

}

?>

 

</font>

</div>

http://www.squiblo.com/results.php

 

how can i positition the large blue box correctly?

<div id="results" style="position:absolute;left:70px;top:260px;z-index:16">

<font face="arial">

<?php




$search = $_GET['search'];

if(strlen($search)<3)
{
   echo "Your search must be at least 3 characters long.";
   $div_height = 'height:500px;';
   $img_height = 'height="500"';
}
else
{
   $div_height = 'height:1200px;';
   $img_height = 'height="1200"';
}
?>

<div id="wb_Shape2" style="position:absolute;top:200px;left:54px;<?php echo $div_height; ?>width:793px;z-index:-1;" align="center">
<img src="/Images/body_img.jpg" id="Shape2" align="top" alt="" title="" border="0"<?php echo $img_height; ?> width="793">
</div>

<?php
//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 "You searched for <b>$search</b>. No results found.";
else
{
   echo "You searched for <b>$search</b><br>$foundnum result(s) found!<p><hr size='1' width='387'color='#E6E6E6'>";

   while ($runrows = mysql_fetch_assoc($run))
   {
      //get data
      $state = ucwords($runrows['state']);
      $url = $runrows['url'];
      $username = ucwords($runrows['username']);
      $imagelocation = $runrows['imagelocation'];
      if ($imagelocation == "") 
      {
         $imagelocation = "./profileimages/noprofilepic.jpg";
      } 
      echo "
      <img src ='$imagelocation' width='100' height='105' border='0' align='left' style='padding-right:10px'><br>
      <b>$username</b><br>
      $state<br>
      <a href='$url'>View Profile</a><br><br><br>
      <hr size='1' width='387' align='left' color='#E6E6E6'>
      ";
   }
}   
?>

</font>
</div>

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.