Jump to content

error in your SQL syntax


jsquarepants

Recommended Posts

This is very simple, I just want to log the post data. My other code does not seem to have this problem. I know I am missing something obvious.

 

$sql = "INSERT INTO blog_entries

                (title, content, category, teaser, entry_time)

          VALUES ('$title', '$content', '$category', '$teaser', now())";

 

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 '')' at line 2

 

<?php

include("includes/dbconnect.php");

 

$DebugText = "Record Post Data: ";

foreach($_POST as $k => $v) {

    $DebugText =+ "'" . $k . "' = " . $v;

}

$DebugText = mysql_real_escape_string($DebugText);

 

$sql = "INSERT INTO debug_log (DebugText) VALUES ('$DebugText')";

 

if (!mysql_query($sql))

  {

  die('Error: ' . mysql_error());

  }

 

?>

 

<html>

<head><title>Login</title></head>

<body>

<form action="login_debug.php" method="post">

<table width="300" border="0" cellspacing="0" cellpadding="2">

<tr><td>User Name:</td><td><input type="text" name="UserName" /></td></tr>

<tr><td>Password:</td><td><input type="password" name="PassWord" /></td></tr>

<tr><td colspan="2"><center><input type="submit" value="Login" /></center></td></

tr>

</table>

</form>

</body>

</html>

Link to comment
https://forums.phpfreaks.com/topic/215671-error-in-your-sql-syntax/
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.