Jump to content

[SOLVED] help with php / mysql


jnerotrix

Recommended Posts

I get this 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 'desc) VALUES ('TEST', 'TEST', 'TEST')' at line 1

 

TEST TEST TEST is the values i inputted into the form

 

Heres The Code

 

<?php 
include('header.php');

if (isset($_POST['action'])) {

include('info.php');

$host = "$host1";
$user = "$user1";
$pass = "$pass1";
$data = "$data1";

mysql_connect("$host", "$user", "$pass") or die(mysql_error());
mysql_select_db("$data") or die(mysql_error());


$name = mysql_real_escape_string($_POST['name']);
$email = mysql_real_escape_string($_POST['email']);
$desc = mysql_real_escape_string($_POST['desc']);


mysql_query("INSERT INTO requests (name, email, desc) 
VALUES ('$name', '$email', '$desc')") 
or die(mysql_error()); 



echo "<h1>Thank you For Submitting a Request</h1>";



} else {

 

Link to comment
Share on other sites

:|

 

Now i get this 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 ''desc') VALUES ('Test', 'Test', 'test')' at line 1

 

You are still using singlequotes ' not backticks `  There is a difference. ` is to the right of the 1 key, above the tab key and below the esc key.

 

The other is next to the ; key and the enter key.

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.