PHP Error: Call to a member function fetch_assoc() on a non-object in PHP Error: Ring til et medlem funktion fetch_assoc () på et ikke-objekt i
Posted on 23. Sendt den 23. Jun, 2009 by Dragos in Coding , PHP Juni, 2009 af Dragos i Kodning, PHP
If you get this error: Call to a member function fetch_assoc() on a non-object in … , it means that you have an error in your mysql syntax. Hvis du får denne fejl: Ring til et medlem funktion fetch_assoc () på en ikke-objekt i ..., betyder det, at du har en fejl i din MySQL syntaks. Supposing that $mysqli is your database connection object, put echo $mysqli->error; just before the line you're getting the error on. Antages, at $ mysql er din database forbindelse objekt, sætte echo $ mysql-> error, lige før den linje, du får fejlen på.
$mysqli=new mysqli(HOST,USER,PASS,DB); $ mysql = new mysql (HOST, BRUGER, PASS, DB); $mQuery=$mysqli->query('select `data` from `this_table` where `id`=1'); $ mQuery = $ mysql-> query ( "SELECT` data `fra` this_table `, hvor` id `= 1 '); echo $mysqli->error; //echoes that column `data` does not exist in table `this_table` echo $ mysql-> error; / / ekko, at kolonnen »data« ikke findes i tabellen `this_table` $row=$mQuery->fetch_assoc(); //gives error as the column `data` is in table `that_table`, not in table `this_table` $ row = $ mQuery-> fetch_assoc () / / giver fejl kolonnen »data« er i tabellen `that_table«, ikke i tabellen `this_table` $mysqli->close(); $ mysql-> close ();
Related posts: Relaterede stillinger:
- Wordpress: Easily Reset Your Account Password Using MySQL and PHP Wordpress: nemt nulstille din adgangskode Brug af MySQL og PHP
- Coding:How to fetch user profile data with SSI.php from a SMF forum database Coding: Hvordan at hente brugerens profil data med SSI.php fra en SMF forum database
- JavaScript: How to get the index (position within a group) of an object with jQuery? JavaScript: Sådan får du indekset (position inden for en gruppe) af et objekt med jQuery?
- JavaScript: Send function as a parameter to another function (callbacks) JavaScript: Send fungere som en parameter til en anden funktion (tilbagekald)
- Ubuntu terminal: invalid host type && configure: error: can only configure for one host and one target at a time Ubuntu terminal: ugyldig vært type & & configure: error: kan kun indstille til en vært og et mål på et tidspunkt
- Jenny Jenny












































