mysqli_fetch_assoc expects parameter 1 to be mysqli_result

Mysqli_fetch_assoc expects parameter 1 to be mysqli_result

Sign in Email.

I'd move the actual fetch into the class so you wrap the nature of the db more completely Reply to author. Copy link. Report message. Show original message.

Mysqli_fetch_assoc expects parameter 1 to be mysqli_result

The script is basically trying to do a few simple things by connecting to a database and reading off a record, and then getting the results from an array. Once you have it working, you need to use prepared statements instead of just appending strings into your query. Thanks for the reply. The readdb function now looks like this, and at least produces a result:. Thank you for the post; appreciated. For prepared statements, scroll down a bit and browse some threads - there are plenty of examples on here, some in the last few days. But I always have to look up mysqli syntax. Some of my issue had to do with the fact that because I default the ID of the record to 1, when I later try to read the prior record there is none. Also, I have now set the default value of ID as an integer, rather than a string. Update: Ah, figured it out. Thanks for both replies. Yes, can confirm that my code works okay without the semi-colon in the query. Thank you again for your previous assistance droopsnoot; I really do appreciate it. After looking at documentation, it might be that if there is anything between the semicolon and the enclosing quotation marks PHP thinks it is a multi-statement and would error? I personally always opt to leave it out, but to each their own I suppose.

Let's work to help developers, not make them feel stupid. Thanks for the reply.

.

W3Schools offers a wide range of services and products for beginners and professionals, helping millions of people everyday to learn and master new skills. Create your own website with W3Schools Spaces - no setup required. Host your own website, and share it to the world with W3Schools Spaces. Build fast and responsive sites using our free W3. CSS framework. W3Schools Coding Game! Help the lynx collect pine cones. If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:.

Mysqli_fetch_assoc expects parameter 1 to be mysqli_result

Doing an assignment for uni, and stuck on an error. Ill attach some files to show the problem and any help very much appreciated. YOu posted an awful lot of c The problem is on LINE Look at it and then figure out why your db connection or your query is failing you.

Farmasi 24 mat ruj

Treat my content as plain text, not as HTML. I do not think that is what you want. I wrote that class while studying and havent really revised it since Hey, Sorry im still learning php so im not entirely sure what you mean Richard MacCutchan May am. Code block. I think I'm going to be a rich man If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Somthing like this might work better: [code] if! Reply to author. Let's work to help developers, not make them feel stupid. Mittineague September 20, , pm 9. Salvatore Terress.

Fetches one row of data from the result set and returns it as an associative array.

Somthing like this might work better: [code] if! Encode HTML. Sign in Email. Lol it was a typo wasn't it? Show original message. I'm sure I just messed something up and cant see it. See more: SQL. Salvatore Terress. Insults are not welcome. This topic was automatically closed 91 days after the last reply. Check your query in a DB gui tool or command line, I would have expected to see a column name in your Order By clause rather than just 'dsc', but I could be wrong. Hey, Sorry im still learning php so im not entirely sure what you mean

1 thoughts on “Mysqli_fetch_assoc expects parameter 1 to be mysqli_result

Leave a Reply

Your email address will not be published. Required fields are marked *