Ir para conteúdo

Jeová Oliveira dos Santos

Members
  • Total de itens

    19
  • Registro em

  • Última visita

Reputação

0 Comum

1 Seguidor

Sobre Jeová Oliveira dos Santos

  1. Jeová Oliveira dos Santos

    Erro ao Acessar via PDO

    Não acha a função prepare class ClassCrud extends ClassConexao { #Atributos private $Crud; private $Contador; #Preparação das declarativas public function preparedStatements($Query, $Parametros){ $this->countParamentos($Parametros); $this->Crud=$this->connectaDB()->prepare($Query); echo $this->Contador; } #Contador de parâmentros private function countParamentos($Paramentors){ $this->Contador=count($Paramentors); } } ClassConexao <?php abstract class ClassConexao { #Realizar conexão com o banco de dados protected function conectaDB() { try { $conn = new PDO('mysql:host=localhost;dbname=crud;port=3308', "root", ""); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); //$id = 1; //$stmt = $conn->prepare('SELECT * FROM cadastro WHERE id = :id'); //$stmt->execute(array('id' => $id)); //$result = $stmt->fetchAll(); //if (count($result)) { // foreach ($result as $row) { // print_r($row); // } //} else { // echo "Nennhum resultado retornado."; //} } catch (PDOException $e) { echo 'ERROR: ' . $e->getMessage(); } } } Index <?php include ("Includes/Header.php"); ?> <div class="Content"> <?php include("Class/ClassConexao.php"); include("Class/ClassCrud.php"); $Crud=new ClassCrud(); $Crud->preparedStatements('desfilar',array(1,2,3,4,5)); ?> </div> <?php include ("Includes/Footer.php"); ?> Mais o erro acontece e não consigo resolver. Erro abaixo Fatal error: Uncaught Error: Call to a member function prepare() on null in C:\wamp64\www\Crud\Class\ClassCrud.php on line 14
  2. Jeová Oliveira dos Santos

    Erro no Apache Request e Rew

    Deu certo, obrigado.
  3. Jeová Oliveira dos Santos

    Erro no Apache Request e Rew

    Boa tarde, uso o Wampserv To com fazendo um sisteminha de login com esses códigos abaixo. .htaccess RewriteEngine On Options All -Indexes DirectoryIndex index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA, L] index.php <?php echo "Olá"; Config.php <?php #Caminhos absolutos $pastaInterna="projetologin.com/"; define('DIRPAGE',"http://{$_SERVER['HTTP_HOST']}/{$pastaInterna}"); (substr($_SERVER['DOCUMENT_ROOT'],-1)=='/') ? $barra="" : $barra="/"; define('DIRREQ',"{$_SERVER['DOCUMENT_ROOT']}{$barra}{$pastaInterna}"); #Atalhos define('DIRIMG',DIRPAGE.'img/'); define('DIRCSS',DIRPAGE.'lib/css/'); define('DIRJS',DIRPAGE.'lib/js/'); #Dados de DB define('HOST',"localhost"); define('DB',"sistema"); define('USER',"root"); define('PASS',""); Compuser gerado certinho { "name": "login/wef", "description": "Cadastro e login php", "authors": [ { "name": "Jeova em Foco", "email": "jeovacnp20012@gmail.com" } ], "require": {}, "autoload": { "psr-4": { "Classes\\": "../classes/", "Models\\": "../models/", "Traits\\": "../traits" } } } Mais não vai de forma alguma. Lista dos erros do apache The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at wampserver@wampserver.invalid to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log. Arquivo de log do apache [Wed Dec 04 15:37:56.202961 2019] [core:notice] [pid 5912:tid 756] AH00094: Command line: 'c:\\wamp64\\bin\\apache\\apache2.4.41\\bin\\httpd.exe -d C:/wamp64/bin/apache/apache2.4.41' [Wed Dec 04 15:37:56.205960 2019] [mpm_winnt:notice] [pid 5912:tid 756] AH00418: Parent: Created child process 15108 [Wed Dec 04 15:37:57.043478 2019] [mpm_winnt:notice] [pid 15108:tid 708] AH00354: Child: Starting 64 worker threads. [Wed Dec 04 15:37:59.941815 2019] [core:alert] [pid 15108:tid 1224] [client ::1:55274] C:/wamp64/www/projetologin.com/.htaccess: RewriteRule: bad flag delimiters [Wed Dec 04 15:38:01.600863 2019] [core:alert] [pid 15108:tid 1224] [client ::1:55275] C:/wamp64/www/projetologin.com/.htaccess: RewriteRule: bad flag delimiters [Wed Dec 04 15:38:02.306458 2019] [core:alert] [pid 15108:tid 1224] [client ::1:55277] C:/wamp64/www/projetologin.com/.htaccess: RewriteRule: bad flag delimiters [Wed Dec 04 15:38:03.738636 2019] [core:alert] [pid 15108:tid 1224] [client ::1:55279] C:/wamp64/www/projetologin.com/.htaccess: RewriteRule: bad flag delimiters [Wed Dec 04 15:39:00.689953 2019] [mpm_winnt:notice] [pid 5912:tid 756] AH00422: Parent: Received shutdown signal -- Shutting down the server. [Wed Dec 04 15:39:02.691802 2019] [mpm_winnt:notice] [pid 15108:tid 708] AH00364: Child: All worker threads have exited. [Wed Dec 04 15:39:02.720786 2019] [mpm_winnt:notice] [pid 5912:tid 756] AH00430: Parent: Child process 15108 exited successfully. [Wed Dec 04 15:39:05.010479 2019] [mpm_winnt:notice] [pid 15120:tid 880] AH00455: Apache/2.4.41 (Win64) PHP/7.3.12 configured -- resuming normal operations [Wed Dec 04 15:39:05.011487 2019] [mpm_winnt:notice] [pid 15120:tid 880] AH00456: Apache Lounge VS16 Server built: Aug 9 2019 16:46:32 [Wed Dec 04 15:39:05.011487 2019] [core:notice] [pid 15120:tid 880] AH00094: Command line: 'c:\\wamp64\\bin\\apache\\apache2.4.41\\bin\\httpd.exe -d C:/wamp64/bin/apache/apache2.4.41' [Wed Dec 04 15:39:05.015470 2019] [mpm_winnt:notice] [pid 15120:tid 880] AH00418: Parent: Created child process 11112 [Wed Dec 04 15:39:06.112840 2019] [mpm_winnt:notice] [pid 11112:tid 708] AH00354: Child: Starting 64 worker threads. [Wed Dec 04 15:39:15.352539 2019] [core:alert] [pid 11112:tid 1224] [client ::1:55291] C:/wamp64/www/projetologin.com/.htaccess: RewriteRule: bad flag delimiters [Wed Dec 04 15:39:16.524866 2019] [core:alert] [pid 11112:tid 1224] [client ::1:55292] C:/wamp64/www/projetologin.com/.htaccess: RewriteRule: bad flag delimiters [Wed Dec 04 15:39:17.228463 2019] [core:alert] [pid 11112:tid 1224] [client ::1:55293] C:/wamp64/www/projetologin.com/.htaccess: RewriteRule: bad flag delimiters [Wed Dec 04 15:39:18.519721 2019] [core:alert] [pid 11112:tid 1224] [client ::1:55294] C:/wamp64/www/projetologin.com/.htaccess: RewriteRule: bad flag delimiters [Wed Dec 04 15:42:11.197193 2019] [core:alert] [pid 11112:tid 1224] [client ::1:55324] C:/wamp64/www/projetologin.com/.htaccess: RewriteRule: bad flag delimiters [Wed Dec 04 15:42:12.211612 2019] [core:alert] [pid 11112:tid 1224] [client ::1:55326] C:/wamp64/www/projetologin.com/.htaccess: RewriteRule: bad flag delimiters [Wed Dec 04 15:42:13.004156 2019] [core:alert] [pid 11112:tid 1224] [client ::1:55328] C:/wamp64/www/projetologin.com/.htaccess: RewriteRule: bad flag delimiters [Wed Dec 04 15:43:06.518563 2019] [core:alert] [pid 11112:tid 1224] [client ::1:55336] C:/wamp64/www/projetologin.com/.htaccess: RewriteRule: bad flag delimiters O que fazer, ajudem-me.
  4. Jeová Oliveira dos Santos

    Erro no prepare();

    Acontece a mesma coisa. <?php class ClassCrud extends ClassConexao{ #Atributos private $Crud; private $Contador; #Preparação das declarativas public function preparedsStatements($Query, $Parametros){ $this->countParametros($Parametros); $stmt = $this->Crud=$this->conectaDB()->prepare($Query); $stmt->execute(); return $stmt->fetchAll(); } #Contador de paramentros private function countParametros($Paramentos){ $this->Contador=count($Paramentos); } }
  5. Jeová Oliveira dos Santos

    Erro no prepare();

    O erro é esse. Error: Call to a member function prepare() on string in C:\wamp64\www\crud\Class\ClassCrud.php on line 12
  6. Jeová Oliveira dos Santos

    Erro no prepare();

    Estou com erro ao chamar o meu prepare pra testar, segue abaixo o código das minhas classes PDO. Classe Crud <?php class ClassCrud extends ClassConexao{ #Atributos private $Crud; private $Contador; #Preparação das declarativas public function preparedsStatements($Query, $Parametros){ $this->countParametros($Parametros); $this->Crud=$this->conectaDB()->prepare($Query); echo $this->Contador; } #Contador de paramentros private function countParametros($Paramentos){ $this->Contador=count($Paramentos); } } Class Conexão <?php abstract class ClassConexao { protected function conectaDB(){ try{ $Con=new PDO("mysql:host=localhost;dbname=cru","root",""); return $Con; }catch (PDOException $Erro){ return $Erro->getMessage(); } } } Meu Index pra teste. <?php include ("Includes/Header.php")?> <div class="Content"> <?php include_once("Class/ClassConexao.php"); include_once("Class/ClassCrud.php"); $Crud=new ClassCrud(); // $Crud->preparedsStatements('teste', array(1,2,3,4)); var_dump($Crud->preparedsStatements("teste", array(1,2,3,4))); ?> </div> <?php include ("Includes/Footer.php")?> O que está errado? Me ajudem quem puder.
  7. Jeová Oliveira dos Santos

    Projeto de financeiamento em php

    Preciso de ajuda. Tenho uma tabela de vencimentos de um vetor Ex. Tenho um variável que armazena a minha quantidade de parcelas $qtdeparcela informada pelo usuário em um form html. Tenho uma outra que vem com o dia de vencimento $diavenc=12 e outra com o mês de vencimento $mesvenc=9, preciso por no vetor assim vetor[0]=parcela 1 = o $mesvenc (que seria igual a 9 por exemplo) + 1 - ou seja seria 12/10 vetor[1]=parcela2 = 12/11 vetor[2]=parcela 3 = 12/12 vetor[3]=parcela 4 = 12/01 E assim por diante até findar as posições do vetor, mais não estou sabendo por dentro do vetor as posições infomada na variável $qtdeparcela. Se eu tenho $qtdeparcela = 5 o vetor deveria ficar com 5 posições. O código abaixo é como foi feito e não acerto. index.html <!DOCTYPE html> <html> <head> <title>Empréstimo Pessoal - TrustBank Investimentos</title> <meta charset="utf-8"/> <style> </style> </head> <body> <img src="img/bank.pnj.psd" /> <p>Procurando por um parceiro de confiança? O TrustBank Investimentos é a solução.</p> <form name="calculo" method="get" action="financiamento.php"> Nome do Cliente <input type="text" name="nome" required /><br> CPF <input type="number" name="CPF" required/><br> Dia do Vencimento para pagamento do Financiamento <input type="number" name="diavenc" min="1" max="28" required /><br> Mês do Vencimento para pagamento do Financiamento <input type="number" name="mesvenc" min="1" max="12" required/><br> Valor do Empréstimo solicitado pelo Cliente <input type="number" name="vlremprestimo" min="0,01" max="999999,99" required /><br> Quantidade de Prestações para o financiamento <input type="number" name="qtdeparcela" min="1" max="60" required/><br> Taxa de Juros <input type="number" name="taxa" required /><br> <input type="submit" value="Calcular" /> <input type="reset" value="Limpar" /> </form> </body> </html> financiamento.php <?php $nome=$_GET["nome"]; $cpf=$_GET["CPF"]; $diavenc=$_GET["diavenc"]; $mesvenc=$_GET["mesvenc"]; $vlremprestimo=$_GET["vlremprestimo"]; $qtdeparcela=$_GET["qtdeparcela"]; $taxa=$_GET["taxa"]; $taxa=$taxa/100; $coeficiente=$taxa/(1-(1+$taxa)**-$qtdeparcela); $vlrprestacao=$vlremprestimo*$coeficiente; $vlrfinal=$vlrprestacao*$qtdeparcela; $juros=$vlrfinal-$vlremprestimo; echo"<p> Resumo da Operação do Cliente </p>"; echo "<p> Nome: ".$nome."</p>"; echo "<p> CPF: ".$cpf."</p>"; echo "<p> Valor do Empréstimo: R$ ".number_format($vlremprestimo,2,',','.')."</p>"; echo "<p> Taxa do Empréstimo: ".$taxa."% </p>"; echo "<p> Valor do Juros: R$ ".number_format($juros,2,',','.')."</p>"; $vetor = array(); ?> <table border="1"> <tr> <th>Vencimento</th> <th>Nº de prestações</th> <th>Prestação</th> <th>Acumulado</th> </tr> <?php for ($i=0; $i < $qtdeparcela; $i++) {?> <tr> <td><?php echo $diavenc."/".$arr[]=$i; ?></td> <?php ?> <td></td> <?php ?> <td></td> <?php ?> <td></td> <?php }?> </tr> </table>
×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.