Parse Error/T_String?

SpaceshipSpaceship
Watch

True_Snake

In-House Graphic DesignerVIP Member
Impact
67
Hi guys :) .

First, I'd like to let you know that I'm pretty new to PHP, so I don't really have an understanding of the language as of yet. I'm still learning :) .

Anyway, I was wondering if you could help me with the following:

I have a database with nearly 1 million businesses from the province of Ontario. Now I've uploaded this database to this site which hosts large databases.

Now the site I'm currently testing my stuff on is:
http://www.ovechkin.info/ontario/

You'll see a search thing on the page. When I enter nothing at all and press search, it takes me to the results page. That's fine.

But when I enter something into it, it says:

Code:
Parse error: syntax error, unexpected T_STRING in /home/snake/public_html/ontario/db.php on line 3

Now I for the life of me can't figure out what on earth that means :D .

I have 3 files for this thing:

(1)index.php (whose code I copied to the aforementioned link so that it can be in my template)

(2)db.php Below is it's contents
Code:
<?php
$db = mysql_connect("free-mysql.BizHostNet.com:3306", "1167951294", "MYPASSWORD"
mysql_select_db("1167951294", $this->conn)
?>

(3) results.php
Code:
<?php

$MATCHES_OVERRIDE = -1;    //set to -1 to disable override








function ReturnMatches($q, $city, $name, $matches, $first)
{

    global $MATCHES_OVERRIDE;

    if ($q) {
        if (!$first) {
            $first = 0;
        }
        if (!$matches) {
            //default
            $matches = 30;
        if (!$ads) {
            $ads = 0;
        }
        }

if ($MATCHES_OVERRIDE > 0) {
            $matches = $MATCHES_OVERRIDE;
        }

    
    include 'db.php';
   
$db = @mysql_connect($DATABASE_SERVER, $DATABASE_USER, $DATABASE_PASSWORD)
            or die("<br><b>Error connecting to database or server too busy: Try again later.</b>");// . mysql_error());
        mysql_select_db($DATABASE_NAME, $db);


        $query =  "SELECT List.* ";
        $query .= ",MATCH(keywords1, keywords2, city, name) AGAINST (' . $q . ' IN BOOLEAN MODE) AS Relevance  ";
        $query .= "FROM List ";
        $query .= "WHERE MATCH(keywords1, keywords2, city, name) AGAINST (' . $q . ' IN BOOLEAN MODE) HAVING Relevance > 0.03  ";

  $query .= "ORDER BY Relevance DESC ";
  $query .= "LIMIT " . $first . "," . $matches;








$result = mysql_query($query, $db)

            or die("<br><b>Error executing query: " . mysql_error() . "</b>\n");

        $row = mysql_fetch_array($result);

mysql_close($db);


echo "<html>	\n"; 
echo "<head>	\n"; 
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n"; 	
echo "<title>$q</title>	\n"; 
?>

<script language="JavaScript">
function blockError(){return true;}
window.onerror = blockError;
</script>




</head>
<body link="#000000" vlink="#808080" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" text="#30305A" bgcolor="#FFFFFF">


<?PHP


    



echo "<table width=\"100%\" background=\"background.gif\" cellspacing=\"0\" style=\"border-top:1px groove #C0C0C0; border-bottom-style:groove\"><tr><td width=\"33%\">\n";
echo " <font face='Verdana' color='#000040' size='1'>   <b>$q</b>\n";

echo " 	 <font color=\"#000000\" face=\"Verdana\" size=\"1\">Listings " . ($first+1) . "  to " . ($first+$matches) . "	\n"; 
echo "      </td>\n";


echo "<td width=\"64%\"><p align=\"right\"><b>\n";

	if ($first == 0) {
		echo "";
	} else {
		echo "<a style=\"text-decoration: none\" href=\"q.php?q=" . $q . "&matches=" . $matches . "&first=" . ($first-$matches) . "\" ><font face=\"Verdana\" size=\"1\" color='#000040'>Prev</a>  | ";
	}
	echo "   ";
	if ($no_results == 1) {
		echo "Next";
	} else {
	echo "<a style=\"text-decoration: none\" href=\"q.php?q=" . $q . "&matches=" . $matches . "&first=" . ($first+$matches) .  "\" ><font face=\"Verdana\" size=\"1\" color='#000040'>Next</a></font>  \n";
	}
echo "</td></tr></table></b>  \n";






      if ($first == 0) {
            echo "";
        } else {
            echo "";
        }


        if ($no_results == 1) {



echo "No More Results";




        } else {


    }



  $no_results = 0;
        if ($row) {
            do {








echo "<font face='verdana' size='2'>\n";
printf("<img src=\"clip.gif\"> <a href=\"businesspage.php?telephone=%s&geo=%s %s %s %s\" ><b>%s</b></a></font><br>  \n", $row["telephone"], $row["address"], $row["city"], $row["state"], $row["zip"], $row["name"]);
printf(" <font face='verdana' size='2'>    %s    \n", $row["address"]);
printf("  %s, %s %s</font><br>\n", $row["city"], $row["state"], $row["zip"]);
printf(" <font face='verdana' size='2'>    Tel: %s     Fax: %s</font><br>\n", $row["telephone"], $row["fax"]);
printf(" <font face='verdana' size='1'>    <b>Category:</b> %s // %s<br></font> \n", $row["keywords1"], $row["keywords2"]); 












            } while ($row = mysql_fetch_array($result));
        } else {
            $no_results = 1;
            echo "\n";
            if ($first == 0) {



            } else {
                echo "No more results found.<br>\n";

 
            }
        }

}
}

    ReturnMatches($q, $city, $name, $matches, $first);



     if ($first == 0) {
            echo "";
        } else {
            echo "";
        }


        if ($no_results == 1) {

 

echo "No More Results";



        } else {



    }




?>




</blockquote>
<p align="center">
<font face="Verdana" size="2">Copyright </font>
<font face="Times New Roman" size="2">(c)</font> <font face="Verdana" size="2">All Rights Reserved - YOUR BUSINESS NAME</font><br> 


</body></html>

What am I doing wrong?

Thanks and take care :)

True_Snake
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
No problem True_Snake, it's a more simplified version but it does the same thing. You can expand it later on with pagination and more advanced searching but this does he job :tu:

Glad it working for you ;)

Matt.
 
0
•••
One question, how do I make the results display in my template?

Thanks,
True_Snake
 
0
•••
True_Snake said:
One question, how do I make the results display in my template?

Thanks,
True_Snake

You can either edit results.php (add in your HTML) or you can include results.php (this would mean you would change the action of your form to the parent page).

I.e.

Add:
PHP:
<?php
include 'results.php';
?>

into index.php, and change:
Code:
<form style="margin: 0px" action="results.php" method=get>
to
Code:
<form style="margin: 0px" action="index.php" method=get>

On your current index.php

Also, you would remove this section from the code i gave you to avoid any unwanted messages when the form had not been submitted.

PHP:
else
{
    echo 'Nothing submitted';
}

Hope that helps a bit.
 
1
•••
0
•••
In firefox, press CTRL down and click on the welcome text, see the blue highlighted table area? That's the problem.

Try removing this:
Code:
<img name="template1sliced_r7_c5" src="Template1sliced/template1sliced_r7_c5.jpg" width="1" height="367" border="0" id="template1sliced_r7_c5" alt="" />

It's a tall image, for no reason lol. So it's stretching the TD to that height.

That entire header looks like a photoshop slicing job, may want to recode that ;)
 
0
•••
Just .... WOW. Thank you so much Matt :tu: !

Can't thank you guys enough. NP really does have the best members of all :tu: !

Thanks and take care bud!
True_Snake
 
0
•••
Dynadot — .com TransferDynadot — .com Transfer
Appraise.net

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy — Payment Flexibility
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back