Can't get PHP to produce Alert() box

Links for php scripts

Moderators: egami, macek, gesf

Post Reply
php-forum Active User
php-forum Active User
Posts: 30
Joined: Sun Aug 04, 2019 4:10 pm

Wed Nov 25, 2020 6:57 pm

I have following code:

Code: Select all

$msg=dbCheck($database); // check if db exists

if(substr($msg, 0,2)!="OK") {
echo "<script type='text/javascript'>alert(".$msg.")</script>";[/b]

It will not produce the alert() box.

Found this on the internet as an example in several places but can't make it work.

Help to get it working appreciated.

php-forum Active User
php-forum Active User
Posts: 41
Joined: Thu Mar 26, 2020 2:33 pm

Thu Dec 17, 2020 1:26 am

What does dbCheck() exactly return?
User avatar
php-forum GURU
php-forum GURU
Posts: 418
Joined: Sat Mar 23, 2013 8:24 am
Location: Livonia, MI

Thu Dec 17, 2020 8:32 pm

More importantly how is checking if a database exists have anything to do with this script or better yet what is the purpose of it? I mean isn't more important to check to see if the message exists?
Life is a fig newton of your imagination!
Post Reply