I am creating a script that reads some information from the database then returns a numerical variable to be written to the database. It's not working and I can't figure out why(Yes, i tried the manual and the PHP/MySQL help post 🙂 ).
<?php
$amnt=0;
//read table for genres and post count
$query = "SELECT * FROM CONgenres";
$result = mysql_query($query) or die("Query failed");
//read information in table cells
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
//read table for names, links and descriptions
$query2 = "SELECT * FROM CONlinks";
$result2 = mysql_query($query2) or die("Query failed");
while ($line2 = mysql_fetch_array($result2, MYSQL_ASSOC)) {
if($line2['genre'] == $line['type']) {
$amnt = $amnt + 1;
}
}
$string = "INSERT INTO CONgenres (type, amount) VALUES($line['type'], '$amnt')";
$query = mysql_query($string) or die(mysql_error());
}
?>
Error I get when running the script.
Parse error: parse error, expecting T_STRING' orT_VARIABLE' or `T_NUM_STRING' in /home/chad1/public_html/cron/updatelinks.php on line 19