By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,747 Members | 2,039 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,747 IT Pros & Developers. It's quick & easy.

add record in database

idsanjeev
100+
P: 241
Hi
my problems is to add new records in oracle database i don't know what have to use at mysql_select_db("intradb", $con);
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $con = odbc_connect("oracle","starter","starter");
  3. if (!$con)
  4.   {
  5.   die('Could not connect: ' . odbc_error());
  6.   }mysql_select_db("intradb", $con);$sql="INSERT INTO qtrapply (empworkno,qtrno,reason,applname,dept,vehi,faciltype,workdet,appldt,cat)
  7. VALUES
  8. ('$_POST[empworkno]','$_POST[qtrno]','$_POST[reason]','$_POST[applname]','$_POST[dept]','$_POST[vehi]','$_POST[faciltype]','$_POST[workdet]','$_POST[appldt]','$_POST[cat]')";if (!mysql_query($sql,$con))
  9.   {
  10.   die('Error: ' . odbc_error());
  11.   }
  12. echo "1 record added";odbc_close($con)
  13. ?>
  14. </body>
  15. </html>
  16.  
Feb 7 '08 #1
Share this Question
Share on Google+
1 Reply


P: 29
Hi
my problems is to add new records in oracle database i don't know what have to use at mysql_select_db("intradb", $con);
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $con = odbc_connect("oracle","starter","starter");
  3. if (!$con)
  4.   {
  5.   die('Could not connect: ' . odbc_error());
  6.   }mysql_select_db("intradb", $con);$sql="INSERT INTO qtrapply (empworkno,qtrno,reason,applname,dept,vehi,faciltype,workdet,appldt,cat)
  7. VALUES
  8. ('$_POST[empworkno]','$_POST[qtrno]','$_POST[reason]','$_POST[applname]','$_POST[dept]','$_POST[vehi]','$_POST[faciltype]','$_POST[workdet]','$_POST[appldt]','$_POST[cat]')";if (!mysql_query($sql,$con))
  9.   {
  10.   die('Error: ' . odbc_error());
  11.   }
  12. echo "1 record added";odbc_close($con)
  13. ?>
  14. </body>
  15. </html>
  16.  

Hi,

If you want to connect to oracle then you have to use functions meant for oracle.
There is OCI8 library for this, which you have to enabled before using.

Check this link for more information. There are some examples given for connecting to oracle. That might be helpful to you.

http://in2.php.net/manual/en/ref.oci8.php
Feb 7 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.