Page 1 of 1

Alert in JavaScript

Posted: Sat Feb 06, 2010 1:01 pm
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?\");');
}
 

Re: Alert in JavaScript

Posted: Sat Feb 06, 2010 1:45 pm
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.