Jump to content

Can someone check this?


Usarjjaco

Recommended Posts

Hey everyone,I'm using several scripts similar to this to enter items into a players data table. This one is giving me a fit.

mysql_query("INSERT INTO weapon (username, item, pic, weight, type, npcid, vid, bid, quan) VALUES ('$uname', '$tobuilditem', '$itempic', '$itemweight', '$type', '0', '0', '$bid', '1')");

All of the values are inserting except for the one on the end (the '1'), which corresponds to the quan column.It works just fine in another table (The items table) but in this table (The weapon table) it wont put that in for the quantity.Any help would be appreciated. I'm sure it's something small I'm missing.

Link to comment
Share on other sites

Hi!Try Use Value '1' Without Quotations, Or Just Set Variable To 1 Then Use Variable In Your QueryLike: $one = 1;mysql_query("INSERT INTO weapon (username, item, pic, weight, type, npcid, vid, bid, quan) VALUES ('$uname', '$tobuilditem', '$itempic', '$itemweight', '$type', '0', '0', '$bid', '$one')");

Link to comment
Share on other sites

Right, but you still have quotes around it:mysql_query("INSERT INTO weapon (username, item, pic, weight, type, npcid, vid, bid, quan) VALUES ('$uname', '$tobuilditem', '$itempic', '$itemweight', '$type', '0', '0', '$bid', '$one')");

Link to comment
Share on other sites

so I think ultimately you're going to want to go for something like this:

mysql_query("INSERT INTO weapon (username, item, pic, weight, type, npcid, vid, bid, quan) VALUES ('$uname', '$tobuilditem', '$itempic', '$itemweight', '$type', 0, 0, '$bid', 1)");

now numbers will be seen as numbers, not strings.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...