Page 1 of 1

link to another page

Posted: Sat Nov 11, 2006 8:55 am
by franknu
ok, i have more info in my database i was just wondering when people click on the name of the business that match the criteria i want to take them to another page, if they want to know more about that business, for now i have a parser error i can't find the poblem and the second i am not that sure if i am doing the right thing

Code: Select all

<?php

$host = "localhost";
$username = "localhost";
$password = "abc123";
$database = "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);
mysql_select_db($database);

if(isset($_GET['Categories']))
  {
    $Categories = addslashes($_GET['Categories']);
    }
    else

    {
    echo("No Categories found.");
   
}


  $query = "SELECT * FROM `business_info` WHERE `Categories` LIKE '%".$Categories."%'";
  $result = mysql_query($query) or die (mysql_error());
  $num_result = mysql_num_rows($result);


if($num_result <= 0)
  {
    echo("No Results found.");
    exit;
}

  echo "<p>Number of business found: ".$num_result."</p>";
while($row = mysql_fetch_array($result))
     {
echo "<table>";
echo "<tr>";

echo "<td>";

echo ("<img src=\'{$Picture1}\' width=\'203\' height=\'152\'>"); 

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

echo "<hr>" ;

echo "<a href=" <?=$row ["includefiles/bizwebpage2.php"]?>"> <?= $row['BusinessName']?> </a> ";
    <? 
	 echo"</strong>";
	 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 "</p>";
	 echo "</td>";
	 echo "<td>";
	


echo "script here";


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

?>
display
Parse error: parse error in c:\program files\easyphp1-8\home\townsfinder\business_display.php on line 165

line 165

Code: Select all

echo "<a href=" <?=$row ["includefiles/bizwebpage2.php"]?>"> <?= $row['BusinessName']?> </a> ";

Posted: Sat Nov 11, 2006 8:56 am
by RobertGonzalez
There's a gap between $row and the opening index bracket [.

Posted: Sat Nov 11, 2006 9:06 am
by franknu
well, i made some changes to make it look good and i am still getting the same error message


here are the new changes:

Code: Select all

<?php

$host = "localhost";
$username = "localhost";
$password = "abc123";
$database = "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);
mysql_select_db($database);

if(isset($_GET['Categories']))
  {
    $Categories = addslashes($_GET['Categories']);
    }
    else

    {
    echo("No Categories found.");
   
}


  $query = "SELECT * FROM `business_info` WHERE `Categories` LIKE '%".$Categories."%'";
  $result = mysql_query($query) or die (mysql_error());
  $num_result = mysql_num_rows($result);


if($num_result <= 0)
  {
    echo("No Results found.");
    exit;
}

  echo "<p>Number of business found: ".$num_result."</p>";
while($row = mysql_fetch_array($result))
     {
echo "<table>";
echo "<tr>";

echo "<td>";

echo ("<img src=\'{$Picture1}\' width=\'203\' height=\'152\'>"); 

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

echo "<hr>" ;
echo "<a href=\" $row ['includefiles/bizwebpage2.php']\"> $row['BusinessName']</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 "</p>";
	 echo "</td>";
	 echo "<td>";
	


echo "script here";


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

?>
that is my error message

Parse error: parse error in c:\program files\easyphp1-8\home\townsfinder\business_display.php on line 165

and here is line 164 and 165

Code: Select all

echo "<hr>" ;
echo "<a href=\" $row ['includefiles/bizwebpage2.php']\"> $row['BusinessName']</a>";

Posted: Sat Nov 11, 2006 9:10 am
by RobertGonzalez
There is still a gap in your array var.

Code: Select all

echo "<a href=\" $row ['includefiles/bizwebpage2.php']\"> $row['BusinessName']</a>"; 
---------------------^
Try this

Code: Select all

echo '<a href="' . $row['includefiles/bizwebpage2.php'] . '">' . $row['BusinessName'] . '</a>';

Posted: Sat Nov 11, 2006 10:22 am
by franknu
ok, i made the changes the problem that i have now is that it is not showing the picture or the frame and it is telling me this

Notice: Undefined index: includefiles/bizwebpage2.php in c:\program files\easyphp1-8\home\townsfinder\business_display.php on line 95

it was also doing it for Picture1, i defined it at the top but i dont know how to define and a file

here is my code

Code: Select all

<?php

$host = "localhost";
$username = "localhost";
$password = "abc123";
$database = "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("No Categories found.");
   
}


  $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"login";
  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 bgcolor='F080C0'>";
  echo"<p>Number of business found: ".$num_result."</p>";
  echo"</td>";
  echo"</tr>";
  
while($row = mysql_fetch_array($result))
     {


echo "<tr>";
//picture colums
echo "<td>";
echo "<img src=\'{$Picture1}\' width=\'203\' height=\'152\'>"; 


//business colums

echo '<a href="' . $row['includefiles/bizwebpage2.php'] . '">' . $row['BusinessName'] . '</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 "</p>";
	 echo"<hr>";
	 echo "</td>";
//include banner colums	 
	 echo "<td>";
	include("includefiles/side_business_banner.php"); 
	 echo "</td>";
	 echo "</tr>";
	 
	 echo "</table>";	 
}

?>

Posted: Sat Nov 11, 2006 11:16 am
by RobertGonzalez
Undefined index means that the array index you are referencing has not been initialized yet. Like this...

Code: Select all

<?php
$array = array(
    'color' => 'blue',
    'size' => 'large'
);

// Now you have an array with two members
// Try calling a non-existent member and see what happens
echo $array['maker'];
?>