If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > record doesn't insert

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-23-10, 08:30
don_log don_log is offline
Registered User
 
Join Date: Jun 2008
Location: pakistan
Posts: 109
record doesn't insert

PHP Code:
<form name="form1" method="post" action="insert.php">
  <p>
    Title
      <input name="tie" type="text" id="tie">
</p>
  <p>
    Stuff
      <textarea name="stu" id="stu"></textarea>
    <input type="submit" name="Submit" value="Submit">
  </p>
</form>

<?php
include('vars.php');
include(
'connect.php');
$a=$_POST['tie'];
$b=$_POST['stu'];
$sql ="INSERT INTO `desktop_urdumag`.`urdumag` (`id`, `head`, `stuff`) VALUES (1 or NULL, '$a','$b');";
$query=mysql_query($sql);
if(!
$query){
echo 
"query not executed<br>".mysql_error();
}
else
{
echo 
"query executed";
}
?>
it doesn't insert values how to add that please suggest me
Reply With Quote
  #2 (permalink)  
Old 02-23-10, 10:36
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,084
Quote:
Originally Posted by don_log View Post
INSERT INTO `desktop_urdumag`.`urdumag` (`id`, `head`, `stuff`) VALUES (1 or NULL, '$a','$b')
did you test this query outside of php first?

i'm not sure whether 1 or NULL is gonna work...
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On