Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8365463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:39:43+00:00 2026-06-09T12:39:43+00:00

I am working on my first ever .php application! All I am doing is

  • 0

I am working on my first ever .php application! All I am doing is posting some data to a database: simple stuff.

Right now, everything works fine, I can send my data to the DB no problems. However, I want to return an error message to my Objective-c application. I have the try and catch statements to make sure I connect to the DB, and if there is an error I would like to communicate that back to my application.

Here is some of what I have so far:

        $dsn='mysql:dbname=******;host=******;';
        $user='******';
        $pass='******';

        try {

        /* obtain a database connection handle */
        $pdo = new PDO($dsn, $user, $pass);

        } 
        catch (PDOException $exception) {
            echo("Failed to connect to the  database. Error: " . $exception->getMessage());
        }

Also, is it possible to set a limit for how long the PDO will attempt to connect to the database?

Right now when I purposely put in something invalid, it tries to connect for a long time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:39:44+00:00Added an answer on June 9, 2026 at 12:39 pm

    If you’re trying to do what I think you are, it doesn’t work like that.

    If you want to pass the error message to an Objective-C application, you will need to pipe, write contents to a file, or write the error to STDERR and capture it from the Objective-C application.

    What exactly are you trying to accomplish? Calling a PHP script from an Objective-C script?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm coding my first ever PHP contact form. I've been working on it all
I am working on a wpf application using PRISM. This is my first ever
I'm working on my first ever cocoa/Objective-C application, so please bear with me if
I'm working on my first ever AIR application with flashbuilder - just so you
I am new to wpf and i am working on first application i have
For some weird reason, the codes below are first working, then website is redirecting
Am working with my first storyboard application and am having a problem. When I
I working on my first ASP.net MVC project and and i got some problems
I've been working with C# and .NET for quite some time now, but am
I am working on my first ever android app, and I'm creating basic exercise/calorie

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.