- 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:
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
(3) results.php
What am I doing wrong?
Thanks and take care
True_Snake
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







