hcodebr / ecommerce

78 stars 69 forks source link

[ERROR] Slim #1

Open Srubens opened 6 years ago

Srubens commented 6 years ago

Olá tudo bem! Estou estudando o curso de vocês na Udemy. Estou com um problema na parte de usuários especificamente na parte do editar o usuário já inserido. Ele me mostra um erro. Peço que por favor olhem. obg!

https://github.com/Srubens/hcode-ecommerce

joaohcrangel commented 6 years ago

Oi Filipe, tudo bem? Esse erro ocorre pois você não carregou os dados do usuário na rota No seu arquivo index.php, deixe a rota "/admin/users/:iduser" desta maneira:

$app->get('/admin/users/:iduser', function($iduser){
  User::verifyLogin();
  $user = new User();
  $user->get((int)$iduser);
  $page = new PageAdmin();
  $page ->setTpl("users-update", array(
    "user"=>$user->getValues()
  ));
});

Teste e nos diga se funcionou Ficamos no aguardo Bons estudos Anthony Rafael Ribeiro - SUPORTE

Srubens commented 6 years ago

Ok consegui obrigado!

lucsbasto commented 6 years ago

Olá, estou fazendo o curso de vocês e estou com o seguinte erro:"Fatal error: Uncaught Error: Class 'Hcode\DB\Sql' not found in D:\e-commerce\index.php:11 Stack trace: #0 [internal function]: {closure}() #1 D:\e-commerce\vendor\slim\slim\Slim\Router.php(200): call_user_func_array(Object(Closure), Array) #2 D:\e-commerce\vendor\slim\slim\Slim\Slim.php(1210): Slim\Router->dispatch(Object(Slim\Route)) #3 D:\e-commerce\vendor\slim\slim\Slim\Middleware\Flash.php(86): Slim\Slim->call() #4 D:\e-commerce\vendor\slim\slim\Slim\Middleware\MethodOverride.php(94): Slim\Middleware\Flash->call() #5 D:\e-commerce\vendor\slim\slim\Slim\Middleware\PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call() #6 D:\e-commerce\vendor\slim\slim\Slim\Slim.php(1159): Slim\Middleware\PrettyExceptions->call() #7 D:\e-commerce\index.php(18): Slim\Slim->run() #8 {main} thrown in D:\e-commerce\index.php on line 11", isso acontece quando não definimos o Hcode\ no psr-4, já defini e continua assim. ps: Já rodei o comando composer dump-autoload

orafaribeiro commented 6 years ago

Olá tudo bem? Esse erro ainda continua? Nós vimos que alterou um pouco seu namespace para Classes

lucsbasto commented 6 years ago

Olá, já resolvi aqui, obrigado.

josemalcher commented 6 years ago

Eu tou com esse erro...

Fatal error: Uncaught Error: Class 'Hcode\DB\Sql' not found in C:\Users\josemalcher\Documents\01-SERVs\xampp_php7.2.1\htdocs\workspace-Udemy-Curso-Completo-de-php-7\24-Projeto-E-Commerce-Admin\index.php:11 Stack trace: #0 [internal function]: {closure}() #1 C:\Users\josemalcher\Documents\01-SERVs\xampp_php7.2.1\htdocs\workspace-Udemy-Curso-Completo-de-php-7\24-Projeto-E-Commerce-Admin\vendor\slim\slim\Slim\Router.php(200): call_user_func_array(Object(Closure), Array) #2 C:\Users\josemalcher\Documents\01-SERVs\xampp_php7.2.1\htdocs\workspace-Udemy-Curso-Completo-de-php-7\24-Projeto-E-Commerce-Admin\vendor\slim\slim\Slim\Slim.php(1210): Slim\Router->dispatch(Object(Slim\Route)) #3 C:\Users\josemalcher\Documents\01-SERVs\xampp_php7.2.1\htdocs\workspace-Udemy-Curso-Completo-de-php-7\24-Projeto-E-Commerce-Admin\vendor\slim\slim\Slim\Middleware\Flash.php(86): Slim\Slim->call() #4 C:\Users\josemalcher\Documents\01-SERVs\xampp_php7.2.1\htdocs\workspace-Udemy-Curso-Completo-de-php-7\24-Projeto-E-Commerce-Admin\vendor\slim\slim\Sli in C:\Users\josemalcher\Documents\01-SERVs\xampp_php7.2.1\htdocs\workspace-Udemy-Curso-Completo-de-php-7\24-Projeto-E-Commerce-Admin\index.php on line 11

Se alguém consegue ver o problema por ai?

Resolvido... Tem que adicionar no arquivo SQL Hcode\DB

<?php 

namespace Hcode\DB;

class Sql {

    const HOSTNAME = "localhost";
SadanRS commented 5 years ago

estou com o mesmo problema

musicoaudaz commented 5 years ago

Boa tarde! sou iniciante aqui, estou fazendo o curso da udemy com vocês, e estou precisando de ajuda com erro erro.

Slim Application Error The application could not run because of the following error:

Details Code: 1045 Message: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) File: C:\ecommerce\vendor\hcodebr\php-classes\src\DB\Sql.php Line: 20

23joshua commented 4 years ago

Boa noite estou a ter este erro.

Slim Application Error The application could not run because of the following error:

Details Code: 2 Message: Use of undefined constant data - assumed 'data' (this will throw an Error in a future version of PHP) File: C:\xampp\htdocs\ecommerce\index.php Line: 10 Trace

0 C:\xampp\htdocs\ecommerce\index.php(10): Slim\Slim::handleErrors(2, 'Use of undefine...', 'C:\xampp\htdocs...', 10, Array)

1 [internal function]: {closure}()

2 C:\xampp\htdocs\ecommerce\vendor\slim\slim\Slim\Router.php(200): call_user_func_array(Object(Closure), Array)

3 C:\xampp\htdocs\ecommerce\vendor\slim\slim\Slim\Slim.php(1210): Slim\Router->dispatch(Object(Slim\Route))

4 C:\xampp\htdocs\ecommerce\vendor\slim\slim\Slim\Middleware\Flash.php(86): Slim\Slim->call()

5 C:\xampp\htdocs\ecommerce\vendor\slim\slim\Slim\Middleware\MethodOverride.php(94): Slim\Middleware\Flash->call()

6 C:\xampp\htdocs\ecommerce\vendor\slim\slim\Slim\Middleware\PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call()

7 C:\xampp\htdocs\ecommerce\vendor\slim\slim\Slim\Slim.php(1159): Slim\Middleware\PrettyExceptions->call()

8 C:\xampp\htdocs\ecommerce\index.php(13): Slim\Slim->run()

9 {main}

jondias7 commented 4 years ago

Slim Application Error The application could not run because of the following error:

Details Code: 2 Message: Invalid argument supplied for foreach() File: /home2/megapixx/euqueroqueimarporti.com.br/vendor/hcodebr/php-classes/src/Model.php Line: 33

vamaral2020 commented 4 years ago

Ola pessoa!

Estou com esse erro na configuração de alteração de usuario. Ja conferi todo o código e até tentei um código postado pelo professor João, mas o problema continua o mesmo, indicando um possivel erro na classe Page.

Fatal error: Uncaught Error: Call to undefined method Rain\Tpl::assing() in C:\ecommerce\vendor\hcodebr\php-classes\src\Page.php:40 Stack trace: #0 C:\ecommerce\vendor\hcodebr\php-classes\src\Page.php(47): Hcode\Page->setData(Array) #1 C:\ecommerce\index.php(75): Hcode\Page->setTpl('users', Array) #2 [internal function]: {closure}() #3 C:\ecommerce\vendor\slim\slim\Slim\Router.php(200): call_user_func_array(Object(Closure), Array) #4 C:\ecommerce\vendor\slim\slim\Slim\Slim.php(1210): Slim\Router->dispatch(Object(Slim\Route)) #5 C:\ecommerce\vendor\slim\slim\Slim\Middleware\Flash.php(86): Slim\Slim->call() #6 C:\ecommerce\vendor\slim\slim\Slim\Middleware\MethodOverride.php(94): Slim\Middleware\Flash->call() #7 C:\ecommerce\vendor\slim\slim\Slim\Middleware\PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call() #8 C:\ecommerce\vendor\slim\slim\Slim\Slim.php(1159): Slim\Middleware\PrettyExceptions->call() #9 C:\ecommerce\index.php(140): Slim\Slim->run() #10 {main} thrown in C:\ecommerce\vendor\hcodebr\php-classes\src\Page.php on line 40

Segue o código de rota: $app->get("/admin/users", function (){

User::verifylogin();

$users = User::ListAll();

$page = new PageAdmin();

$page->setTpl("users", array(
    "users"=>$users

));

});

$app->get("/admin/users", function (){

User::verifylogin();

$page = new PageAdmin();

$page->setTpl("users");

});

$app->get("/admin/users/create", function (){

    User::verifylogin();

    $page = new PageAdmin();

    $page->setTpl("users-create");

});

$app->get("/admin/users/:iduser/delete", function ($iduser){

User::verifylogin();

});

$app->get('/admin/users/:iduser', function($iduser){
      User::verifyLogin();
      $user = new User();
      $user->get((int)$iduser);
      $page = new PageAdmin();
      $page ->setTpl("users-update", array(
        "user"=>$user->getValues()
      ));

});

$app->post("/admin/users/create", function (){

    User::verifylogin();

});

$app->post("/admin/users/:iduser", function ($iduser){

    User::verifylogin();

});

$app->run();

?>

luacarol commented 3 years ago

Como resolver esse erro?

Slim Application Error The application could not run because of the following error:

Details Message: Template header not found! File: C:\xampp\htdocs\ecommerce\vendor\rain\raintpl\library\Rain\Tpl.php Line: 191 Trace

0 C:\xampp\htdocs\ecommerce\vendor\rain\raintpl\library\Rain\Tpl.php(79): Rain\Tpl->checkTemplate('header')

1 C:\xampp\htdocs\ecommerce\vendor\hcodebr\php-classes\src\Page.php(35): Rain\Tpl->draw('header', false)

2 C:\xampp\htdocs\ecommerce\index.php(14): Hcode\Page->__construct()

3 [internal function]: {closure}()

4 C:\xampp\htdocs\ecommerce\vendor\slim\slim\Slim\Router.php(200): call_user_func_array(Object(Closure), Array)

5 C:\xampp\htdocs\ecommerce\vendor\slim\slim\Slim\Slim.php(1210): Slim\Router->dispatch(Object(Slim\Route))

6 C:\xampp\htdocs\ecommerce\vendor\slim\slim\Slim\Middleware\Flash.php(86): Slim\Slim->call()

7 C:\xampp\htdocs\ecommerce\vendor\slim\slim\Slim\Middleware\MethodOverride.php(94): Slim\Middleware\Flash->call()

8 C:\xampp\htdocs\ecommerce\vendor\slim\slim\Slim\Middleware\PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call()

9 C:\xampp\htdocs\ecommerce\vendor\slim\slim\Slim\Slim.php(1159): Slim\Middleware\PrettyExceptions->call()

10 C:\xampp\htdocs\ecommerce\index.php(20): Slim\Slim->run()

11 {main}

marianaxvr commented 3 years ago

Tô com um erro parecido. Como resolvê-lo?

Slim Application Error The application could not run because of the following error:

Details Code: 8 Message: Undefined variable: results File: C:\xampp\htdocs\ecommerce\index.php Line: 14 Trace

0 C:\xampp\htdocs\ecommerce\index.php(14): Slim\Slim::handleErrors(8, 'Undefined varia...', 'C:\xampp\htdocs...', 14, Array)

1 [internal function]: {closure}()

2 C:\xampp\htdocs\ecommerce\vendor\slim\slim\Slim\Router.php(200): call_user_func_array(Object(Closure), Array)

3 C:\xampp\htdocs\ecommerce\vendor\slim\slim\Slim\Slim.php(1210): Slim\Router->dispatch(Object(Slim\Route))

4 C:\xampp\htdocs\ecommerce\vendor\slim\slim\Slim\Middleware\Flash.php(86): Slim\Slim->call()

5 C:\xampp\htdocs\ecommerce\vendor\slim\slim\Slim\Middleware\MethodOverride.php(94): Slim\Middleware\Flash->call()

6 C:\xampp\htdocs\ecommerce\vendor\slim\slim\Slim\Middleware\PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call()

7 C:\xampp\htdocs\ecommerce\vendor\slim\slim\Slim\Slim.php(1159): Slim\Middleware\PrettyExceptions->call()

8 C:\xampp\htdocs\ecommerce\index.php(18): Slim\Slim->run()

9 {main}

pedro-miguel-nelembe2000 commented 3 years ago

Olá pessoal, estou com este problema

Slim Application Error The application could not run because of the following error:

Details Code: 2 Message: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: parameter was not defined File: C:\xampp\htdocs\Bremix_Ecommerce\vendor\Bremix\php-classes\src\DB\Sql.php Line: 61 Trace

0 [internal function]: Slim\Slim::handleErrors(2, 'PDOStatement::e...', 'C:\xampp\htdocs...', 61, Array)

1 C:\xampp\htdocs\Bremix_Ecommerce\vendor\Bremix\php-classes\src\DB\Sql.php(61): PDOStatement->execute()

2 C:\xampp\htdocs\Bremix_Ecommerce\vendor\Bremix\php-classes\src\Model\Products.php(30): Bremix\DB\Sql->select('CALL crudProdut...', Array)

3 C:\xampp\htdocs\Bremix_Ecommerce\admin-products.php(43): Bremix\Model\Products->save()

4 [internal function]: {closure}()

5 C:\xampp\htdocs\Bremix_Ecommerce\vendor\slim\slim\Slim\Router.php(200): call_user_func_array(Object(Closure), Array)

6 C:\xampp\htdocs\Bremix_Ecommerce\vendor\slim\slim\Slim\Slim.php(1210): Slim\Router->dispatch(Object(Slim\Route))

7 C:\xampp\htdocs\Bremix_Ecommerce\vendor\slim\slim\Slim\Middleware\Flash.php(86): Slim\Slim->call()

8 C:\xampp\htdocs\Bremix_Ecommerce\vendor\slim\slim\Slim\Middleware\MethodOverride.php(94): Slim\Middleware\Flash->call()

9 C:\xampp\htdocs\Bremix_Ecommerce\vendor\slim\slim\Slim\Middleware\PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call()

10 C:\xampp\htdocs\Bremix_Ecommerce\vendor\slim\slim\Slim\Slim.php(1159): Slim\Middleware\PrettyExceptions->call()

11 C:\xampp\htdocs\Bremix_Ecommerce\index.php(32): Slim\Slim->run()

12 {main}

Alguém me ajude, por favor!

ronaldolsilva commented 3 years ago

==>>> https://github.com/ronaldolsilva/ecommerce

Ainda com problema abaixo, nenhuma solução encontrada, preciso de ajuda para continuar o curso. Obrigado.

Fatal error: Uncaught Error: Class 'Hcode\DB\slq' not found in C:\ecommerce\index.php:11 Stack trace: #0 [internal function]: {closure}() #1 C:\ecommerce\vendor\slim\slim\Slim\Router.php(200): call_user_func_array(Object(Closure), Array) #2 C:\ecommerce\vendor\slim\slim\Slim\Slim.php(1210): Slim\Router->dispatch(Object(Slim\Route)) #3 C:\ecommerce\vendor\slim\slim\Slim\Middleware\Flash.php(86): Slim\Slim->call() #4 C:\ecommerce\vendor\slim\slim\Slim\Middleware\MethodOverride.php(94): Slim\Middleware\Flash->call() #5 C:\ecommerce\vendor\slim\slim\Slim\Middleware\PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call() #6 C:\ecommerce\vendor\slim\slim\Slim\Slim.php(1159): Slim\Middleware\PrettyExceptions->call() #7 C:\ecommerce\index.php(18): Slim\Slim->run() #8 {main} thrown in C:\ecommerce\index.php on line 11

LukasCCB commented 2 years ago

Como resolver este problema ?

image

filpo67 commented 1 year ago

o meu erro é o seguinte: Slim Application Error The application could not run because of the following error:

DETAILS Code: 8 Message: Undefined index: deszipcode File: C:\ecommerce\views-cache\cart.c5b813be90a10a19f97859c318d75589.rtpl.php Line: 84 TRACE

0 C:\ecommerce\views-cache\cart.c5b813be90a10a19f97859c318d75589.rtpl.php(84): Slim\Slim::handleErrors(8, 'Undefined index...', 'C:\ecommerce\vi...', 84, Array)

1 C:\ecommerce\vendor\rain\raintpl\library\Rain\Tpl.php(79): require('C:\ecommerce\vi...')

2 C:\ecommerce\vendor\hcodebr\php-classes\src\Page.php(51): Rain\Tpl->draw('cart', false)

3 C:\ecommerce\site.php(77): Hcode\Page->setTpl('cart', Array)

4 [internal function]: {closure}()

5 C:\ecommerce\vendor\slim\slim\Slim\Router.php(200): call_user_func_array(Object(Closure), Array)

6 C:\ecommerce\vendor\slim\slim\Slim\Slim.php(1210): Slim\Router->dispatch(Object(Slim\Route))

7 C:\ecommerce\vendor\slim\slim\Slim\Middleware\Flash.php(86): Slim\Slim->call()

8 C:\ecommerce\vendor\slim\slim\Slim\Middleware\MethodOverride.php(94): Slim\Middleware\Flash->call()

9 C:\ecommerce\vendor\slim\slim\Slim\Middleware\PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call()

10 C:\ecommerce\vendor\slim\slim\Slim\Slim.php(1159): Slim\Middleware\PrettyExceptions->call()

11 C:\ecommerce\index.php(20): Slim\Slim->run()

12 {main}