mysqli_fetch_assoc expects parameter 1 to be mysqli_result

Mysqli_fetch_assoc expects parameter 1 to be mysqli_result

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.

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.

Mysqli_fetch_assoc expects parameter 1 to be mysqli_result

Sign in Email. Forgot your password? Ask a Question. Please Sign up or sign in to vote. See more: SQL. Posted May pm Matas - developer. Add a Solution. You could start by clicking on the numerous links at the right side of this page which relate to this issue :. Richard MacCutchan May am. I think I'm going to be a rich man Accept Solution Reject Solution. Permalink Share this answer.

Quoted Text. Thanks for the reply.

.

This extension was deprecated in PHP 5. Alternatives to this function include:. Returns an associative array that corresponds to the fetched row and moves the internal data pointer ahead. It only returns an associative array. Returns an associative array of strings that corresponds to the fetched row, or false if there are no more rows. If two or more columns of the result have the same field names, the last column will take precedence. Note : Field names returned by this function are case-sensitive.

Mysqli_fetch_assoc expects parameter 1 to be mysqli_result

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:.

Devon hamilton y&r

Chances are they have and don't get it. Once you have it working, you need to use prepared statements instead of just appending strings into your query. It looks to me like it is only catching when your query string is empty, if you want to error check the result in your class then you will have to manually check your DB wrapper error result because it didn't throw an error. New replies are no longer allowed. Insults are not welcome. Dmitry Ruban. Let's work to help developers, not make them feel stupid. It does pose a question about your classes error handling which looks like it is more the issue because you would have wanted it to catch that. Posted May pm Richard MacCutchan. I'm sure I just messed something up and cant see it. You could start by clicking on the numerous links at the right side of this page which relate to this issue :.

Doing an assignment for uni, and stuck on an error. Ill attach some files to show the problem and any help very much appreciated.

Optional Password. 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. I do not think that is what you want. Hey admitting your mistakes is the first step to learning :D but sure it was a typo Thanks for the help and the better code This topic was automatically closed 91 days after the last reply. Hey, yea thanks that fixed that problem Paste as-is. Yes, can confirm that my code works okay without the semi-colon in the query. Dmitry Ruban. If anyone can help i would really appreciate it Thank you again for your previous assistance droopsnoot; I really do appreciate it. Somthing like this might work better: [code] if! It does pose a question about your classes error handling which looks like it is more the issue because you would have wanted it to catch that. New replies are no longer allowed.

0 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 *