Search the Community
Showing results for tags 'pdo'.
-
Sveiki, Pirms laika ienāca prātā uzrakstīt savu DB administrēšanas instrumentu - https://github.com/sitilge/curdle. Demo lapa šeit: http://curdle.sitilge.id.lv/ . Labprāt dzirdētu Jūsu idejas / priekšlikumus / kritiku ! Cenšos turēt issues (github) sadaļu atjauninātu, ja kādam ir vēlme, droši forkojiet un strādājam kopā :) M
-
Labdien, lietoju symfony. Uz sava locālā Apache viss darbojas, bez nekādas vainas, bet uzliekot kodu uz hostinga izmet " Fatal error: Class 'PDO' not found in public_html/main/vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php on line 155" Esmu atradis ka varētu to izlabot http://stackoverflow.com/questions/7126227/pdo-and-pdo-mysql-loaded-but-class-not-found?rq=1 uzstādot pareizu extension_dir, bet man diemžel nav piekļuves php.ini failam. Lūdzu dodiet idejas, kā izlabot.
-
Sveiki, ejošs kods: index.php //---------connect part----------------- try { $hostname = "localhost"; $dbname = "resursi"; $username = "root"; $pw = "root"; $pdo = new PDO ("mysql:host=$hostname;dbname=$dbname","$username","$pw"); } catch (PDOException $e) { echo "Failed to get DB handle: " . $e->getMessage() . "\n"; exit; } //-----------Fetching part----------- $from = 0; $limit = 10; $query = $pdo->prepare("SELECT * FROM archive ORDER BY id desc LIMIT $from, $limit"); $query->execute(); for($i=0; $row = $query->fetch(); $i++) { echo $i." - ".$row['author']."<br/>"; } Es vēlos šo kodu sadalīt index.php un connect.php. connect.php //---------connect part----------------- try { $hostname = "localhost"; $dbname = "resursi"; $username = "root"; $pw = "root"; $pdo = new PDO ("mysql:host=$hostname;dbname=$dbname","$username","$pw"); } catch (PDOException $e) { echo "Failed to get DB handle: " . $e->getMessage() . "\n"; exit; } index.php include "connect.php"; //-----------Fetching part----------- $from = 0; $limit = 10; $query = $pdo->prepare("SELECT * FROM archive ORDER BY id desc LIMIT $from, $limit"); $query->execute(); for($i=0; $row = $query->fetch(); $i++) { echo $i." - ".$row['author']."<br/>"; } Throws "Fatal error: Call to a member function prepare() on a non-object ". Vai ir kāds veids kā to paveikt?