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
https://forums.phpfreaks.com/topic/136287-solved-help-with-php-mysql/
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.

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.