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

  • SEARCH
  • Home
  • 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 8962077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:02:56+00:00 2026-06-15T16:02:56+00:00

Currently I have used JavaScript to display an alert to notify that the execution

  • 0

Currently I have used JavaScript to display an alert to notify that the execution was successful, merely for testing purposes. How can I do that in PHP object-oriented style?

I’ve tried:

public $msg='May the force be with you.';
$this->msg = new msg();

…but result was a white blank page. JavaScript piece I tried works well though. Below is the complete code:

<?php
class database {
    public $mysql;
        private $db_host='localhost';
        private $db_username='admin';
        private $db_password='password';
        private $db_name='db';

    function __construct() {
        $this->mysql = new mysqli($this->db_host, $this->db_username, $this->db_password, $this->db_name) or die (mysql_error() ); {
            echo 
            "<script type='text/javascript'>
            alert ('The Force will be with you, always.');
            </script>";
        }
    }
    function __destruct() {
        $this->mysql->close();
    }
}
?>
  • 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-15T16:02:57+00:00Added an answer on June 15, 2026 at 4:02 pm
    1. PHP is server-side, which means it runs on a machine different from the user.

    2. Javascript is client-side, which means it runs on the user’s machine.

    3. The server should have no control over anything on the user’s machine.

    Therefore, an alert box from PHP is not possible. 🙂

    You’ve got to stick with Javascript, which only runs client-side. That, or echo plaintext out onto the document itself.

    FYI, this relationship brings up other fun questions, like, “how can Javascript talk to the server” (answer:ajax) and “can a script talk to another computer” (answer: yes, but it’s not supposed to).

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

Sidebar

Related Questions

I currently have a type that I inject into my controllers that's used for
I have this running software that is currently being used by about 400 people.
All, I have a method that is currently used to invoke DLLs of return
Currently have a drop down menu that is activated on a hover (from display:none
I have a website that uses javascript to randomly display a list of quotes.
I currently have 4 textboxes which will be used to store an ip address.
I currently have about 650,000 items in memcached (430MB memory used) and the number
I currently have Google Maps integrated into my webpage. It is being used to
-Hello, looking for some help. We currently have a winform app used to do
I have a page where there is currently more than one form. I used

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.