Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 686 Vote(s) - 3.44 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with Updating database from PHP?

#1
Im still in the process of learning PHP. Here is what im trying to accomplish. I have a database table named users with 4 columns. user_name, user_rank, user_tag, list_order. I want the user to be able to select the user_name from the form and enter the value for the other 3 columns and it update into the database on the selected users row. This is what I have and the error I am getting. How do I go about fixing this.

error:
Fatal error: Call to a member function bind_param() on a non-object in /hermes/bosnaweb24a/b1321/ipg.darkgaminglivecom/panel/user_rank_change.php on line 17

user_change.php:

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


user_rank_change.php:

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.

Reply

#2
Your error is probably generating from the Prepare() function as your UPDATE statement seems to be incorrect, the sytanx you wrote is for INSERT as for UPDATE it's like

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.

Reply

#3
Query should be like:

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


And the Bind_Param

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.

Reply

#4
Thanks that fixed that problem. Now the problem I am having is it is not updating it in the database.
Reply

#5
Quote:(07-27-2016, 07:59 PM)Ex094 Wrote:

[To see links please register here]

Your error is probably generating from the Prepare() function as your UPDATE statement seems to be incorrect, the sytanx you wrote is for INSERT as for UPDATE it's like

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.

I did it like this and now Im getting this error.

Error:
Warning: mysqli_stmt::bind_param(): Number of variables doesn't match number of parameters in prepared statement in /hermes/bosnaweb24a/b1321/ipg.darkgaminglivecom/panel/user_rank_change.php on line 17 New records created successfully


Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.

Reply

#6
Are you giving a correct User Name as the input? Do keep case sensitivity in mind

EDIT: Also check the data types of the Columns are correct, i.e. they are all string, if anyone of them is an int, then use 'd' instead of an 's' in the bind_param
Reply

#7
Try adding this line

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


Instead of

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


See if any errors come up
Reply

#8
Quote:(07-27-2016, 08:59 PM)Ex094 Wrote:

[To see links please register here]

Try adding this line

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


Instead of

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


See if any errors come up

Okay so I changed it over to that and the user_rank_change.php is executing correctly. Its almost as if its not pulling the values over from the form.
Reply

#9
Oh jeez, I think we got it. You forgot to add the Value attribute to the OPTION tags hence it's returning gamer_tag null I think

Replace this line:

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


With this:

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


Also just in case to make sure inputs are coming correctly, Echo out all the POST variables like:

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.

Reply

#10
Yes I have the usernames being pulled straight from the database. In the form above.


Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.

Reply



Forum Jump:


Users browsing this thread:
2 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through