Whats the error

Reply

Join Date: Jul 2009
Posts: 1
Reputation: dilan_n is an unknown quantity at this point 
Solved Threads: 0
dilan_n dilan_n is offline Offline
Newbie Poster

Whats the error

 
0
  #1
Jul 4th, 2009
  1. <?php
  2. $con=mysql_connect("localhost","root","");
  3. if(!$con)
  4. {
  5. die('Could not connect:'.mysql_error());
  6. }
  7. mysql_select_db(customer1,$con)
  8. $sql1="INSERT INTO details(companyname,companyadd,comstate,telephone,fax,email,fname,lname,nic,mobile,username,password);VALUES('$_POST[coname]','$_POST[coadd]','$_POST[cost]','$_POST[tel]','$_POST[fax]','$_POST[mail]','$_POST[fname]','$_POST[lname]','$_POST[nic]','$_POST[mob]','$_POST[user]','$_POST[password]')";
  9. if(!mysql_query($sql1,$con))
  10. {
  11. die('Error:'.mysql_error());
  12. }
  13. echo"1 record added";
  14. mysql_close($con)
  15. ?>
Last edited by peter_budo; Jul 6th, 2009 at 6:54 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 149
Reputation: sarithak is an unknown quantity at this point 
Solved Threads: 6
sarithak sarithak is offline Offline
Junior Poster

Re: Whats the error

 
0
  #2
Jul 4th, 2009
Hi..
check this two lines

mysql_select_db($customer1,$con)  

and

$sql1="INSERT INTO details(companyname,companyadd,comstate,telephone,fax,email,fname,lname,nic,mobile,username,password) VALUES('$_POST[coname]','$_POST[coadd]','$_POST[cost]','$_POST[tel]','$_POST[fax]','$_POST[mail]','$_POST[fname]','$_POST[lname]','$_POST[nic]','$_POST[mob]','$_POST[user]','$_POST[password]')";

Originally Posted by dilan_n View Post
<?php
$con=mysql_connect("localhost","root","");
if(!$con)
{
die('Could not connect:'.mysql_error());
}
mysql_select_db(customer1,$con)
$sql1="INSERT INTO details(companyname,companyadd,comstate,telephone,fax,email,fname,lname,nic,mobile,username,password);VALUES('$_POST[coname]','$_POST[coadd]','$_POST[cost]','$_POST[tel]','$_POST[fax]','$_POST[mail]','$_POST[fname]','$_POST[lname]','$_POST[nic]','$_POST[mob]','$_POST[user]','$_POST[password]')";
if(!mysql_query($sql1,$con))
{
die('Error:'.mysql_error());
}
echo"1 record added";
mysql_close($con)
?>
My best wishes ... from my soul ... for everyone!
Keep Smiling....Never Depress
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 171
Reputation: praveen_dusari is an unknown quantity at this point 
Solved Threads: 21
praveen_dusari's Avatar
praveen_dusari praveen_dusari is offline Offline
Junior Poster

Re: Whats the error

 
0
  #3
Jul 4th, 2009
check out this code
  1. <?php
  2. $con=mysql_connect("localhost","root","");
  3. if(!$con)
  4. {
  5. die('Could not connect:'.mysql_error());
  6. }
  7. mysql_select_db(customer1,$con)
  8. $sql1="INSERT INTO details(companyname,companyadd,comstate,telephone,fax,email,fname,lname,nic,mobile,username,password)
  9. VALUES('".$_POST['conam'e]."','".$_POST['coadd']."','".$_POST['cost']"','".$_POST['tel']."','".$_POST['fax']."','".$_POST['mail']."','".$_POST['fname']."','."$_POST['lname']."','".$_POST['nic']."','".$_POST['mob']."','".$_POST['user']."','".$_POST['password']."')";
  10. if(!mysql_query($sql1,$con))
  11. {
  12. die('Error:'.mysql_error());
  13. }
  14. echo"1 record added";
  15. mysql_close($con)
  16. ?>
Failure is success if we learn from it
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 11
Reputation: Yayo_SK is an unknown quantity at this point 
Solved Threads: 1
Yayo_SK Yayo_SK is offline Offline
Newbie Poster

Re: Whats the error

 
0
  #4
Jul 4th, 2009
Hi..

As in C or Perl, PHP requires instructions to be terminated with a semicolon at the end of each statement.

http://sk.php.net/manual/en/language...separation.php

and check this two lines

mysql_select_db($customer1,$con) ;

and

mysql_close($con);

I hope it's gonna be OK.
Last edited by peter_budo; Jul 6th, 2009 at 6:54 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC