Jump to content
MakeWebGames

can someone tell me what I am doing wrong here


shaved92bravada

Recommended Posts

$changeinfo = sprintf("UPDATE `usershops` SET `location` = `%d` , `shopname` = '%s', `shopdescription` = '%s' WHERE `userid` = ('%u')",$_POST['sl'], $_POST['shopname'],$_POST['description'], $userid);
$db->query($changeinfo);

 

I am getting this error

QUERY ERROR: Unknown column '1' in 'field list'

Query was UPDATE `usershops` SET `location` = `1` , `shopname` = 'Testing ', `shopdescription` = 'Testing functions still' WHERE `userid` = ('1')

I am still trying to get used to using sprintf so if I am doing something that I shouldn't be point me in the right direction please.

Link to comment
Share on other sites

Re: can someone tell me what I am doing wrong here

still getting the same error... it has something to do with the location I am just not sure what

but if I dont need the () around the `%u` then that will save two extra keystrokes lol.

anyway the location field in the table is int (11) just like normal I just can't figure out why it is saying unknown field and then the location # when it should just update the location to that number..... any more help will be appreciated.

I am attempting to make my own usershops mod if your wondering lol.

Link to comment
Share on other sites

Re: can someone tell me what I am doing wrong here

 

Shaved, i would suggest spreading out your work like luke has done. It make's it easier for us to kind of read it.

Yeah I plan on going back through and making everything legible for others to read. etc. I have been wanting usershops for awhile so I am using examples from the regular shops, itembuy, etc and making my own. Once I get it done I am thinking of having ya'll look over it privately and see what else I can do to secure it better, etc. I have figured out that the only way I am gonna learn is to try it.

 

Error was, as I did not say yet...

You were using back ticks around the `%d` - they need to be apostrophes.

Table and row names = back ticks

Anything else = apostrophe

Of course, I may have forgot about something that will make this wrong, but for the most part, that is how it should be.

I knew it was gonna be something simple like that.... but now that I know what to do it shall make it easier the next time.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...