If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

Given the information that you've given me, that would be the only logical cause for that if else section of code.

The only other problem could be the query itself - eg if the DB table structure is not the same as it was on your localhost.

Try running the query in your hosts phpmyadmin SQL page and see that it works there first of all. If it does then its your script. If it doesn't then its a difference between systems - either mysql versions OR your DB structures.

after execution, after storing the results and after fetching the results. It is returning no error to me....I attempted making a similar site a while ago and could register and login perfectly. The only difference with this site is the password hashing and the use of prepared statements. In my login_select.php which is used to check the username and password, I actually echo out the value of the hashed password, after it has been combined with the retrieved salt string from the database and even they match up ok.

I don't understand what could be going wrong....

Sorry to persist, but is there anything else at all that I could take a look at?

To be honest I'm running out of ideas here so it looks like i may have to abandon ship here and hope someone else can see the wood for the trees.

My offer of a debug still remains open (no fix, no fee though I've yet to be beaten) but to be frank, I'm running out of guesses that i can supply. I'm also certain that you're more than capable of debugging it and theorising whats going on!

Whatever is causing the query problem, your either getting no results or more than one result returned.

Well it seems nowadays you're the only one who replies to me so I might have to seek a bit of advice from another forum or something because my last 2-3 threads are replied to only by yourself, no one else helps me lol.

Thanks dude appreciate the help though.

I'd take you up on your offer of a debug but what's the point when I am trying to learn PHP :P , I won't get better if I don't do it myself. Of course, your help has nearly always produced a result for me so of course a lot of credit goes to yourself and other people here.

I thought to myself, right open all scripts to do with the registration. I got my notepad out and wrote down step by step what is happening in my reg scripts and when. I also did the same for both of my login scripts and apart from minor differences such as query's and obviously in my reg scripts, the hash string is generated, combined with the pass and stored in the database along with the hashed password, where as in the login, the hash string retrieved from the database, combined with the users pass and then queried against the user's existing password field.

Thanks again for the help up to now, just unfortunate your ideas didn't resolve the issue this time. I'll keep a note of what you asked me to look for in case I have similar issues in the future.

Edit: Just printed $stmt with print_r() just after execution and it returned affected_rows as -1. php.net states it means the query returned an error but errno = 0 and error = empty string.

I printed that out after every statement issued to $stmt and it returned no errors until right after execution...

I tried adding the single quotations around the question marks but it returned this error to me:Warning: mysqli_stmt::bind_param() [mysqli-stmt.bind-param]: Number of variables doesn't match number of parameters in prepared statement

I'm not sure what else to check. I know I am matching the correct hash string from the database because when I send the $_POST['password'] and the retrieved hash string and send them both to the sha1() function like I did in the registration script, it produces the correct password...

Edit:Just ran the same print_r($stmt) code through my localhost and it is also returning affected_rows -1 but it lets me login....

Does this mean it could potentially be a different issue? Can you narrow it down given this information?