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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.