Error Messages
written by: admin
Date Written: 9/15/08
Last Updated: 6/19/13
Parse error: syntax error, unexpected T_VARIABLE in /home/content/a/n/i/animeviews/html/selectentry3.php on line 31
Is there a semicolon where there should not be?
Parse error: syntax error, unexpected T_LOGICAL_OR in...
$result = mysql_query($query); or die ("Couldnt execute query.");
should be
$result = mysql_query($query) or die ("Couldnt execute query.");
mysql_fetch_array(): supplied argument is not a valid MySQL result resource
Are the tables and columns that you are trying to access spelled correctly? do they exist? Remember that the tables and columns in the database are case sensitive. In my case I was resetting the query. take a look at the following flawed code and look carefully at lines 4, 5, and 9.
<?php
include 'include/db.php';
$query = "SELECT * FROM news2";
$result = mysql_query($query) or die ("Couldn't execute query.");
while ($row = mysql_fetch_array($result,MYSQL_ASSOC)){
$marriage=$row["energy"];$marriage=addslashes($marriage);
$date=$row["date"];
$db="INSERT INTO news (marriage,date) VALUES ('$marriage','$date')";
$result = mysql_query($db) or die (mysql_error());
}
echo "all done";
?>
It should be
<?php
include 'include/db.php';
$query = "SELECT * FROM news2";
$result1 = mysql_query($query) or die ("Couldn't execute query.");
while ($row = mysql_fetch_array($result1,MYSQL_ASSOC)){
$marriage=$row["energy"];$marriage=addslashes($marriage);
$date=$row["date"];
$db="INSERT INTO news (marriage,date) VALUES ('$marriage','$date')";
$result = mysql_query($db) or die (mysql_error());
}
echo "all done";
?>
unexpected $end
missing closing bracket,
}?
TAGS: php