what is the problem?
i have this message when insert?

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 '4'', `data_no` = ''1'', `note_date` = 1293628283, ' at line 4

and this is form

<form id="form1" name="form1" method="post" action="">
      <label for="textarea">notetext</label>
      <p>
        <textarea name="notetext" id="notetext"></textarea>
      </p>
      <p>
        <label for="Submit">add</label>
        <input type="submit" name="add" value="add" id="add" />
</p>
    </form> 
	<?php
	if(isset($_POST['add']))
{
    $note_contact=$_GET['uni'];
	$note_text=mysql_real_escape_string($_POST['notetext']);
	$data_no=$_GET['id'];
	
	$sql_note = "
    INSERT INTO `notes` SET
	      
		 `note_text` = '$note_text',
		 `note_contact` = '$note_contact',
         `data_no` = '$data_no',
         `note_date` = " . time() . ",
         `note_status` = 1
";  
		if (!mysql_query($sql_note,$contacts))
  {
  die('Error: ' . mysql_error());
  }
echo "1 record added";
	}
	?>

Recommended Answers

All 4 Replies

Member Avatar for diafol
`note_contact` = '$note_contact',

seems to be the problem. Does this field exists in your DB? I can't even see where the value ($note_contact) is passed.

$note_contact=$_GET['uni'];

i have it from path
and it's field

details.php?id='2'&uni='3'
i have path like this
when remove quote it work good
details.php?id=2&uni=3
??

Member Avatar for diafol

Yep, don't use quotes in a querystring (url).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.