works in ocalhost but not in my website

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

works in ocalhost but not in my website

Post 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?
User avatar
tr0gd0rr
Forum Contributor
Posts: 305
Joined: Thu May 11, 2006 8:58 pm
Location: Utah, USA

Re: works in ocalhost but not in my website

Post 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?
bigwatercar
Forum Newbie
Posts: 2
Joined: Wed Nov 12, 2008 12:59 am

Re: works in ocalhost but not in my website

Post by bigwatercar »

Code: Select all

 
$query1="select Aluno,sum(N_horas) as totas from registo_horas group by Aluno"
try it
mariolopes
Forum Contributor
Posts: 102
Joined: Sun May 22, 2005 7:08 am

Re: works in ocalhost but not in my website

Post by mariolopes »

Bigwayercar
It works thank you
Post Reply