joex Posted October 5, 2012 Share Posted October 5, 2012 Hi guys, I'm having issues that I don't know how to solve. Read about 5 topics but nothing worked... This is my code, it was working on another website, but on the new one, it isn't... Any help would be greatly appreciated! Thanks a lot for reading. PS: Sorry if I posted anything wrong! <?php /**/ class BancoDados{ var $dbh;//objeto conexao var $ultimo_sql;//ultimo sql executado var $ultimo_erro;//ultimo erro ocorrido var $obj_retorno;//objeto com valores retornados do bd var $linhas;//linhas retornadas na ultima pesquisa var $ultimo_id;//ultimo id retornado por um insert function BancoDados(){ } function _BancoDados(){ unset ($this); } function conecta(){ if(!$this->dbh=mysql_connect("localhost", "massim6_adm", "xxx")){ //if(!$this->dbh=mysql_connect("localhost", "root", "")){ $this->ultimo_erro='Erro na conexão com o banco de dados:' . mysql_error(); return false; } mysql_select_db ("massim6_loja"); //mysql_select_db ("massim6"); return true; } function desconecta(){ mysql_close($this->dbh); } function iniciaTransacao(){ $begin = 'begin;'; mysql_query($begin,$this->dbh); } function confirmaTransacao(){ $commit = 'commit;'; mysql_query($commit,$this->dbh); } function abortaTransacao(){ $rollback = 'rollback;'; mysql_query($rollback,$this->dbh); } function getLinhas(){ $this->linhas = mysql_numrows($this->obj_retorno); return $this->linhas; } function getUltimoId(){ $this->ultimo_id = mysql_insert_id($this->dbh); return $this->ultimo_id; } function executaSql($sql){ if (!$this->conecta()){ return false; } $this->ultimo_sql=$sql; $this->obj_retorno=mysql_query($sql,$this->dbh); if ($this->obj_retorno==false){ $this->ultimo_erro = mysql_error($this->dbh); $this->desconecta(); return false; } else return true; } // Funções de modificação de dadas // formato banco function formataDataBc($data){ $str = split("/",$data); $dia = $str[0]; $mes = $str[1]; $ano = $str[2]; $data = $ano.'-'.$mes.'-'.$dia; return $data; } // Formato Brasileiro function formataDataBr($data){ $str = split("-",$data); $ano = $str[0]; $mes = $str[1]; $dia = $str[2]; $data = $dia.'/'.$mes.'/'.$ano; return $data; } }//BancoDados ?> Quote Link to comment Share on other sites More sharing options...
Jessica Posted October 5, 2012 Share Posted October 5, 2012 See the link in my signature Quote Link to comment Share on other sites More sharing options...
joex Posted October 6, 2012 Author Share Posted October 6, 2012 Thanks Jessica, I've added the line you mentioned, now I have the error reason, should be easier to fix on my own. Quote Link to comment Share on other sites More sharing options...
joex Posted October 7, 2012 Author Share Posted October 7, 2012 I'm sorry for double posting, but still I can't get any fix... I've asked a couple friends and no one was able to fix it ): Quote Link to comment Share on other sites More sharing options...
Jessica Posted October 7, 2012 Share Posted October 7, 2012 Post your updated code. Quote Link to comment Share on other sites More sharing options...
joex Posted October 7, 2012 Author Share Posted October 7, 2012 Fixed it right now! It was missing information on the sql database. Thanks again for the patience Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.