Alert in JavaScript

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mariolopes
Forum Contributor
Posts: 102
Joined: Sun May 22, 2005 7:08 am

Alert in JavaScript

Post by mariolopes »

Hi
How can I execute a Javascript code like the following:

Code: Select all

 
<?php
session_start();
include "../tabalunos/tabalunos.html";
//echo $_SESSION[username];
//apanha os dados de estágio do aluno
$mysql_id = mysql_connect('localhost', 'mariolopes', 'freixo');
mysql_select_db('mariolopes',$mysql_id);
$query="select * from estagios where Aluno='$_SESSION[username]'";
$result=mysql_query($query);
$resultados_total = mysql_num_rows($result);
if ($resultados_total==0){
    echo('return confirm(\"Quer Apagar Este Registo?\");');
}
 
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Alert in JavaScript

Post by Christopher »

Use Ajax to call that PHP script and get whatever value it produces. Then check the value in Javascript and do you alert.
(#10850)
Post Reply