Jump to content

[SOLVED] SQL Syntax: Am I Missing Something?


refiking

Recommended Posts

Here is the message I received when I ran my script:

 

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 '@yahoo.com,0000)' at line 2

 

Here is line 2:

include 'login.php';

 

My login script works fine when I use it to submit the form data, but when I click submit, it tells me about a SQL syntax error near line 2, but the data it is referring to is only at lines 84 & 85:

 

$s1 = "INSERT INTO Borrowers(bor_id,username,password,bfn,bln,tel,email,ssn)
VALUES ($borid,$user,$pass,$bfn,$bln,$tel,$email,$ssn)";

 

Am I Missing Something?

Link to comment
Share on other sites

CORRECT WAY WITH ERROR DEBUG MODE

<?php
$s1 = "INSERT INTO Borrowers(bor_id,username,password,bfn,bln,tel,email,ssn)
VALUES('$borid','$user','$pass','$bfn','$bln','$tel','$email','$ssn')";
$sq1_result=mysql_query($s1)or die(mysql_error());
?>

 

you also need to post every varable

 

example with database protection

 

$user=mysql_real_escape_string($_POST['user']);

Link to comment
Share on other sites

zanus i no it all about reading, php6 will really kill a lot off current used functions example eregi is not turned on anymore preg_regex is default, there going to be no more {} braces [] only also there going to be a lot more class functions lol, not sure but i even think the new mysql functions will be default not the old ones i use, big changes lots off god dam readaing

Link to comment
Share on other sites

redarrow, what the str_reverse('kcuf') are you talking about? Curly braces are not going to be removed from PHP 6.

 

The only thing that will change with curly braces in PHP 6 is that it will be deprecated to use them for single character access. E.g.

<?php
$string = 'test';
echo $string{2} // "s" - deprecated in PHP 6
echo $string[2] // "s" - not deprecated in PHP 6
?>

 

Also, ereg will not be removed but moved to PECL and there is no function called preg_regex().

 

dont use curly braces that makes the database force the insert that bad programming method

That doesn't make any sense.

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.