Here is the full error Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING on line 13
Line 13 States:
$search = mysql_query("SELECT * FROM searchengine WHERE pageurl = '$_POST['url']'");
The code is for a search engine to check if the url exists and if it dosen't add it to the data base
The whole code is
<?php
$mysql_host = "host";
$mysql_database = "database";
$mysql_user = "user";
$mysql_password = "pass";
mysql_connect($mysql_host, $mysql_user, $mysql_password) or die(mysql_error());
mysql_select_db($mysql_database) or die("ERROR");
$pagedata = htmlspecialchars(file_get_contents($_POST['url']));
$pagedata = str_replace("'","",$pagedata);
$search = mysql_query("SELECT * FROM searchengine WHERE pageurl = $_POST['url']"); // Here we select the rows with the id of 1
while($row = mysql_fetch_array($search)){ // We loop through the data
if($_POST['url'] == $row['pageurl']){ // Check if the id exists in the table
echo " IT DOES!!!"; // yes it does
}
else
{
echo " The url doesnt exist adding it"; //else
mysql_query("INSERT INTO searchengine VALUES ('','$_POST[url]','$pagedata')");
echo "URL Added.<br><a href='./addurl.php'>Continue...</a>";
}
}
?>
Thanks!
Chase