Mysql insert only sometimes
Posted: Mon Jun 29, 2009 12:20 pm
I have this form that calls this php script (below) and it only works sometimes. If I try to send the form again it works and if I try again it fails and again it fails. It is very hit or miss. Could someone please tell me why it does this. Thanks
Code: Select all
<?php
$name = "name";
$invoice = "invoice";
$type = "type";
$source = "ccnum";
$fp = fopen("******************","r");
$pub_key = fread($fp,8192);
fclose($fp);
openssl_get_publickey($pub_key);
openssl_public_encrypt($source,$crypttext,$pub_key);
mysql_connect ("***********", "***************", "***************") or die ('Error: ' . mysql_error());
mysql_select_db ("test_cards");
$query="INSERT INTO cardinfo (name, type, ccnum, invoice)VALUES ('$_POST[name]','$_POST[type]','".$crypttext."','$_POST[invoice]')" or die(mysql_error());
mysql_query($query) or die('Unable to insert credit card data');
?>