Jump to content

zairyaab

New Members
  • Posts

    6
  • Joined

  • Last visited

zairyaab's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi sKunKbad Thanks for your reply. I have added the following code to get the exceptions. try{ //CODE PROCESSING HERE }catch(Exception $e){ echo "Error: " . $e->getMessage(); exit; } Thanks,
  2. Hi Guys, Can someone please help me. I have following PHP code that works fine. The only issue I am facing is, if there is a payment thats not sucessfull I just get a blank screen, and do not receive error on the screen. However the error is dispalyed in execption, I just can catch it. CODE: <?PHP require './lib/Stripe.php'; $ccnum=$_GET['ccNum']; $ccmon=$_GET['ccExpMo']; $ccyr=$_GET['ccExpYr']; $amount=$_GET['amt']; $jobid=$_GET['JobId']; $multiply=100; $amountcents=$amount*$multiply; $cvc=172; $description='something'; if(isset($_POST)) { Stripe::setApiKey("stripe_key_here"); $payment = Stripe_Charge::create(array( 'amount' => $amountcents, 'currency' => 'gbp', 'card' => array( 'number'=> $ccnum, 'exp_month' => $ccmon, 'exp_year'=> $ccyr, 'name'=> 'some name', 'cvc'=> $cvc), 'description' => $description)); } print_r($payment); ?> Following is the error (or any other error) which I cant seem to catch as an execption. error: message: "Your card has insufficient funds." type: "card_error" code: "card_declined" charge: ch_12asdasweAAFdgooXDUd2tvKJgW Thanks a lot again for any advise. Regards,
  3. thanks blacknight mssql_free_result($result); seemed to have solved the problem.
  4. Hi Everyone, I have this php page that runs couple of MS SQL stored procedures to fetch me values from SQL Server, however I have run into a problem where not more then 2 stored procedures are executed at same time. For instance below mentioned code only fetches me values for 1st and 2nd SP's. If I need values from the 3rd stored procedure then I would have to comment either one of the first two stored procedure. Can someone please tell me what is that I am doing wrong. I am relatively new to PHP, so please be gentle. Any help would be highly appreciated. Thanks. <?php if($conn = mssql_connect('host', 'user', 'pass')) echo 'Connected to SQLEXPRESS<BR>'; if(mssql_select_db("database",$conn)) echo 'Selected DB: SomeDatabase<BR>'; $variable1=something; $sql_statement = mssql_init("stored_procedure1 '$variable1'", $conn); $result=mssql_execute($sql_statement); $x=0; while ($row = mssql_fetch_assoc($result)) { $column2[$x]= $row['column2']; $column1= $row['column1']; $x++; } echo "Value 1: $column1 </br>"; echo "Value 2: $column2[0] </br>"; echo "Value 3: $column2[1] </br>"; echo "Value 4: $column2[2] </br>"; echo "Value 5: $column2[3] </br>"; echo "Value 6: $column2[4] </br>"; echo "Value 7: $column2[5] </br>"; mssql_free_statement($sql_statement); $sql_statement = mssql_init("stored_procedure2 '$variable1'", $conn); $result=mssql_execute($sql_statement); $x=0; while ($row = mssql_fetch_assoc($result)) { $someval1[$x]= $row['somecolumn1']; $someval2[$x]= $row['somecolumn2']; $someval3= $row['somecolumn3']; $someval4= $row['somecolumn4']; $someval5= $row['somecolumn5']; $someval6= $row['somecolumn6']; $x++; } echo "Something1: $someval1[0]</br>"; echo "Something2: $someval3 </br>"; echo "Something3: $someval2[0] </br>"; echo "Something4: $someval4 </br>"; echo "Something5: $someval6 </br>"; echo "Something6: $someval5 </br>"; mssql_free_statement($sql_statement); $sql_statement = mssql_init("stored_procedure3 '$variable1'", $conn); $result=mssql_execute($sql_statement); $x=0; while ($row = mssql_fetch_assoc($result)) { $somevaluecheck= $row['somecolumncheck']; $x++; } echo "SomethingCheck: $somevaluecheck </br>"; mssql_free_statement($sql_statement); ?>
  5. Thanks a lot @Ch0cu3r you saviour! That code is exactlly what I was lookin for! You genius, saved me!
  6. Hi, I am fairly new to PHP, I am tryin to put a code together that would see my incoming CLI as 44 and remove the 44 from it and add a 0 to it. I have managed to do this so far, now I am stuck, as any number thats not matching the length (10 digits ) or is not starting with 44 is also not forwarded to my database for query. $input = ($cid); if(preg_match('/^(44|0)(\d{10})$/',$input,$matches)){ $phone = '0'.$matches[2]; }else die("Invalid Phone Number") ; What I would like is that any number starting with 441234567890 to become 01234567890, but should not involve 10 digits criteria. Any help would be appreciated.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.