Hi, Im having troubles with the following script: Where could be the problem? is in line 1?Error:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'word' at line 1
PHP Code:
<?php
if(!isset($query) || empty($query))
{$query = "select * from MatchData";}
$query=stripslashes($query);
mysql_connect("mysql","admin","admin") or
die("No Se pudo conectar a la base de datos");
mysql_select_db ("Data") or
die("No Se pudo seleccionar la base de datos");
$result = mysql_query($query) or
die( mysql_error() );
$number_cols = mysql_num_fields($result);
echo "<b>query: $query</b>";
echo "<table border = 1>\n";
echo "<tr align=center>\n";
for ($i=0; $i<$number_cols; $i++)
{
echo "<th>" . mysql_field_name($result, $i). "</th>\n";
}
echo "</tr>\n";
while ($row = mysql_fetch_row($result))
{
echo "<tr align=left>\n";
for ($i=0; $i<$number_cols; $i++)
{
echo "<td>";
if (!isset($row[$i]))
{echo "NULL";}
else
{echo $row[$i];}
echo "</td>\n";
}
echo "</tr>\n";
}
echo "</table>";
?>
<form action="<?php echo $PHP_SELF?>" method="get">
<input type="text" name="query" size="50"><br>
<input type="submit">
</form>