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.

Sign in Email. Forgot your password? Ask a Question. Please Sign up or sign in to vote. See more: SQL.

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.

When answering a question please: Read the question carefully.

.

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. Submit a Pull Request Report a Bug. Warning This extension was deprecated in PHP 5. Parameters result The result resource that is being evaluated.

Mysqli_fetch_assoc expects parameter 1 to be mysqli_result

Fetches one row of data from the result set and returns it as an associative array. Each subsequent call to this function will return the next row within the result set, or null if there are no more rows. If two or more columns of the result have the same name, the last column will take precedence and overwrite any previous data. Note : Field names returned by this function are case-sensitive.

Oriellys cave city ky

Couldn't have been a dumb mistake never admit to that! This topic was automatically closed 91 days after the last reply. Steve Wake. Add your solution here. 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 Don't tell someone to read the manual. I think I'm going to be a rich man Thanks for the 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. Treat my content as plain text, not as HTML. Web01 2. Update: Ah, figured it out. Also, I have now set the default value of ID as an integer, rather than a string.

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

Do you need your password? Also, I have now set the default value of ID as an integer, rather than a string. If anyone can help i would really appreciate it If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Thank you for the post; appreciated. New replies are no longer allowed. Encode HTML. Thanks for the reply. The readdb function now looks like this, and at least produces a result:. 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? Accept Solution Reject Solution. Chances are they have and don't get it.

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 *