Ir para conteúdo

Jeová Oliveira dos Santos

Members
  • Total de itens

    19
  • Registro em

  • Última visita

Tudo que Jeová Oliveira dos Santos postou

  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

    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.
  3. Jeová Oliveira dos Santos

    Erro no Apache Request e Rew

    Deu certo, obrigado.
  4. 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.
  5. 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); } }
  6. 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
×

Informação importante

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