Page 1 of 1

works in ocalhost but not in my website

Posted: Tue Mar 09, 2010 1:47 pm
by mariolopes
Please look at the following code. It works localy but not in my website.

Code: Select all

 
<?php
$mysql_id = mysql_connect('localhost', 'xxx', 'xxx');
mysql_select_db('mariolopes',$mysql_id);
    
    $query1="select Aluno,sum(N_horas) as totas from registo_horas";
    $result1=mysql_query($query1);
    
    while ($row1=mysql_fetch_array($result1)){
        echo $row1[totas];
    }
?>
 
It works with

Code: Select all

 
$query1="select sum(N_horas) as totas from registo_horas";
 
But i need the Aluno record
Any ideas?

Re: works in ocalhost but not in my website

Posted: Tue Mar 09, 2010 2:21 pm
by tr0gd0rr
What is the MySQL error? Are the table schemas the same? Is the Aluno truly capitalized in the table schema? Are the MySQL versions the same?

Re: works in ocalhost but not in my website

Posted: Tue Mar 09, 2010 8:35 pm
by bigwatercar

Code: Select all

 
$query1="select Aluno,sum(N_horas) as totas from registo_horas group by Aluno"
try it

Re: works in ocalhost but not in my website

Posted: Wed Mar 10, 2010 4:15 am
by mariolopes
Bigwayercar
It works thank you