Jump to content

PHP Error


supermerc

Recommended Posts

Hey, I have this code:

 

<?php
require("config.php");
require("functions.php");
session_start();
if (isset($_POST['addhit'])) {


$name = mysql_escape_string($_POST['owname']);
$reason = mysql_escape_string($_POST['reason']);


	$sql = "INSERT INTO hitlist(outwarname, reason, by) VALUES ('{$name}', '{$reason}', '{$_SESSION[s_username]}')";

// Execute Query

$qry = mysql_query($sql) or die("MySQL Error: <br /> {$sql} <br />". mysql_error());
header("Location: http://zimbob.outwar.com/hitlist.php?hitname='.$name.'&hitreason='.$reason'");
}
?>

 

and im getting this error

 

MySQL Error:

INSERT INTO hitlist(outwarname, reason, by) VALUES ('test', 'test', 'ServeD')

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 'by) VALUES ('test', 'test', 'ServeD')' at line 1

 

Does anyone know whats wrong?

Link to comment
https://forums.phpfreaks.com/topic/66012-php-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.