Sunamena Posted June 3, 2017 Share Posted June 3, 2017 (edited) Hey all, I have created a website on my local host. Now that i try to upload it, i get many errors. Such as this one: $result = $stmt -> fetchAll(PDO::FETCH_NUM); ERROR: Fatal error: Uncaught Error: Call to undefined method mysqli_stmt::fetchAll() in /customers/c/5/e/sunamena.be/httpd.www/eldiemus/nieuws.php:290 Stack trace: #0 {main} thrown in /customers/c/5/e/sunamena.be/httpd.www/eldiemus/nieuws.php on line 290 And will this still be valid? $stmt -> bindParam(':datum', $datum, PDO::PARAM_INT); I also had to change my connection method from $db = new PDO('mysql:host=urlToDatabasel;dbname=DatabaseName', 'DatabaseName', 'NotARealPassword'); $db -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); to $con=mysqli_connect("sunamena.be.mysql", "sunamena_be", "s6X6tyUj", "sunamena_be"); This is still save to use without the setAttribute? Edited June 3, 2017 by Sunamena Link to comment Share on other sites More sharing options...
dsonesuk Posted June 3, 2017 Share Posted June 3, 2017 Compare PHP versions from local and host, they should be >= 5.3 Link to comment Share on other sites More sharing options...
Sunamena Posted June 3, 2017 Author Share Posted June 3, 2017 (edited) The new code should be MySqli $sql="SELECT * FROM nieuws ORDER BY nieuwsID desc"; $deelStap=mysqli_query($con,$sql); $result=mysqli_fetch_all($deelStap,MYSQLI_NUM); $numberInResult = count($result); But how to fetch one? Edited June 3, 2017 by Sunamena Link to comment Share on other sites More sharing options...
justsomeguy Posted June 5, 2017 Share Posted June 5, 2017 It looks like you're mixing PDO and mysqli. They aren't the same, you can't mix them. The PHP has plenty of documentation for how to use both of them though. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now