Inklink Posted January 30, 2007 Share Posted January 30, 2007 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:[url=http://www.ovechkin.info/ontario/]http://www.ovechkin.info/ontario/[/url]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[/code]Now I for the life of me can't figure out what on earth that means :D .I have 3 files for this thing:[b](1)[/b]index.php (whose code I copied to the aforementioned link so that it can be in my template)[b](2)[/b]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)?>[/code][b](3)[/b] results.php[code]<?php$MATCHES_OVERRIDE = -1; //set to -1 to disable overridefunction 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>[/code]What am I doing wrong?Thanks and take care :)Inklink Quote Link to comment https://forums.phpfreaks.com/topic/36349-another-parset_string-error/ Share on other sites More sharing options...
wildteen88 Posted January 30, 2007 Share Posted January 30, 2007 The problem is with db.php:[code=db.php]<?php$db = mysql_connect("free-mysql.BizHostNet.com:3306", "1167951294", "MYPASSWORD"mysql_select_db("1167951294", $this->conn)?>[/code]Your code has a few majour issues. Which are you havn't closed the mysql_connect function and the secound you are not ending your lines with semi-colons. This is how you code should be:[code]<?php$db = mysql_connect("free-mysql.BizHostNet.com:3306", "1167951294", "MYPASSWORD");mysql_select_db("1167951294", $this->conn);?>[/code]Also this is not an installation issue either. Moving to PHP Hep forum. Quote Link to comment https://forums.phpfreaks.com/topic/36349-another-parset_string-error/#findComment-172951 Share on other sites More sharing options...
Inklink Posted January 30, 2007 Author Share Posted January 30, 2007 Hey, thanks for helping me out :) .And sorry for putting it in the wrong forum.I've updated the file, and now I get:[quote]Fatal error: Using $this when not in object context in /home/snake/public_html/ontario/db.php on line 3[/quote]Your help is greatly appreciated.Thanks,Inklink Quote Link to comment https://forums.phpfreaks.com/topic/36349-another-parset_string-error/#findComment-172961 Share on other sites More sharing options...
wildteen88 Posted January 31, 2007 Share Posted January 31, 2007 Chnage:[code=php:0]mysql_select_db("1167951294", $this->conn);[/code]to this:[code=php:0]mysql_select_db("1167951294", $conn);[/code]you should only use $this-> when in a class. Quote Link to comment https://forums.phpfreaks.com/topic/36349-another-parset_string-error/#findComment-173929 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.