afallingpanda Posted January 8, 2014 Share Posted January 8, 2014 hello guys, so i have an interface that inserts data into a mysql database with PDO. so i am binding params, however not everything in my query is binded, as some of them are just ints which i entered my self (see below): $query = $pdo->prepare('INSERT INTO leaderboards (rank, username, rounds, players, last_round_time, system, verified, game_id, mode_id, map_id) VALUES (?, ?, ?, ?, ?, ?, ?, 3, 1, 8)'); $query->bindValue(1, $rank); $query->bindValue(2, $username); $query->bindValue(3, $rounds); $query->bindValue(4, $players); $query->bindValue(5, $lastroundtime); $query->bindValue(6, $system); $query->bindValue(7, $reference); $query->execute(); Now as you can see the game_id,mode_id,and map_id are the ones which i set the value of in the query. here is the result in the table: http://gyazo.com/93facff162aa944043176c31119eb16b As you can see all the data is succesfully inserted depending on what the user types into the interface, but the last 3 columns are for some reason "1" and not the ones i put in the query? Why is this? please help? mabey some syntax fault? Quote Link to comment https://forums.phpfreaks.com/topic/285206-help-with-phpmysql-inserting-with-binds/ Share on other sites More sharing options...
mac_gyver Posted January 8, 2014 Share Posted January 8, 2014 a) what is your database table definition? b) any chance the data is left over from some previous testing that inserted those values or some update code that updated those values? Quote Link to comment https://forums.phpfreaks.com/topic/285206-help-with-phpmysql-inserting-with-binds/#findComment-1464439 Share on other sites More sharing options...
afallingpanda Posted January 8, 2014 Author Share Posted January 8, 2014 a) what is your database table definition? b) any chance the data is left over from some previous testing that inserted those values or some update code that updated those values? a) what is a database table definition? b) no chance. Quote Link to comment https://forums.phpfreaks.com/topic/285206-help-with-phpmysql-inserting-with-binds/#findComment-1464440 Share on other sites More sharing options...
ginerjm Posted January 8, 2014 Share Posted January 8, 2014 He is asking you 'What are the field types of the ones you are not using bound params for?'. (You really should have known that) Quote Link to comment https://forums.phpfreaks.com/topic/285206-help-with-phpmysql-inserting-with-binds/#findComment-1464441 Share on other sites More sharing options...
afallingpanda Posted January 8, 2014 Author Share Posted January 8, 2014 the ones im not using bound params for is game_id, mode_id, map_id Quote Link to comment https://forums.phpfreaks.com/topic/285206-help-with-phpmysql-inserting-with-binds/#findComment-1464455 Share on other sites More sharing options...
afallingpanda Posted January 9, 2014 Author Share Posted January 9, 2014 still need help with this please Quote Link to comment https://forums.phpfreaks.com/topic/285206-help-with-phpmysql-inserting-with-binds/#findComment-1464552 Share on other sites More sharing options...
ginerjm Posted January 9, 2014 Share Posted January 9, 2014 show us some code. NOT ALL of it - just the part that is pertinent to this whole retrieval of inputs, creation of query and execution - AND the check that the query actually ran! Quote Link to comment https://forums.phpfreaks.com/topic/285206-help-with-phpmysql-inserting-with-binds/#findComment-1464584 Share on other sites More sharing options...
mac_gyver Posted January 9, 2014 Share Posted January 9, 2014 (edited) the 'jargon' used in programming (or any activity) is not to exclude people, but to insure that the people partaking in the activity share a common base of information, so that a book doesn't have to be written each time information is exchanged, because there have been books written to teach the basics. you were not asked which database columns were the offending ones, you were asked for the definition of your database table, and then more specifically what the field types are of those columns. edit: i'm kind of curious how you know there are ones in these columns? what is the method or code that produced the output showing those? Edited January 9, 2014 by mac_gyver Quote Link to comment https://forums.phpfreaks.com/topic/285206-help-with-phpmysql-inserting-with-binds/#findComment-1464585 Share on other sites More sharing options...
afallingpanda Posted January 9, 2014 Author Share Posted January 9, 2014 (edited) the 'jargon' used in programming (or any activity) is not to exclude people, but to insure that the people partaking in the activity share a common base of information, so that a book doesn't have to be written each time information is exchanged, because there have been books written to teach the basics. you were not asked which database columns were the offending ones, you were asked for the definition of your database table, and then more specifically what the field types are of those columns. edit: i'm kind of curious how you know there are ones in these columns? what is the method or code that produced the output showing those? because i went into the database my self and saw that they were entered as ones, what information do you need, that i can tell you, all the field types are there. and they are all INT apart from "username" ,"system", and "reference" aka "verified" If you read my whole post and clicked on the link, you wouldnt of asked the question of how i know the ones are produce, just like previously where you didnt read my previous thread and thought i was using PDO and not PDOStatement Edited January 9, 2014 by afallingpanda Quote Link to comment https://forums.phpfreaks.com/topic/285206-help-with-phpmysql-inserting-with-binds/#findComment-1464590 Share on other sites More sharing options...
ginerjm Posted January 9, 2014 Share Posted January 9, 2014 Uuuuuhhh... You can show us some code! Quote Link to comment https://forums.phpfreaks.com/topic/285206-help-with-phpmysql-inserting-with-binds/#findComment-1464591 Share on other sites More sharing options...
afallingpanda Posted January 9, 2014 Author Share Posted January 9, 2014 Uuuuuhhh... You can show us some code! IVE SHOWN YOU CODE. Tell me what code you want to see and il show you. Quote Link to comment https://forums.phpfreaks.com/topic/285206-help-with-phpmysql-inserting-with-binds/#findComment-1464593 Share on other sites More sharing options...
ginerjm Posted January 9, 2014 Share Posted January 9, 2014 show us the line where you check the result of your execute statement. Prove to us that the line ran and we're not looking at a duplicate record. Or perhaps add a retrieval query and output the results of your insert. Do Something to solve this yourself instead of whining about what to do. Quote Link to comment https://forums.phpfreaks.com/topic/285206-help-with-phpmysql-inserting-with-binds/#findComment-1464594 Share on other sites More sharing options...
afallingpanda Posted January 9, 2014 Author Share Posted January 9, 2014 show us the line where you check the result of your execute statement. Prove to us that the line ran and we're not looking at a duplicate record. Or perhaps add a retrieval query and output the results of your insert. Do Something to solve this yourself instead of whining about what to do. okay so ive just reported your post and i will see to blocking you on this site some how, reason being you have absolutely no knowledge in fixing this so you are just posting complete junk for god knows what reason, "Do something to solve this your self" = you absolute idiot, wtf you think i been doing for last 2 days. "instead of whining about what to do"= err this is a forum where people ask for help, if you dont like it then get out. and also, i showed you a picture of the query running and outputting the records, so again dont ask for code that is already pretty much had evidence shown to, It is not duplicate data because its the only data thats in there ( i delete them all one by one) . next time, dont pretend like you CAN solve problems when you clearly dont even know what your talking about. To all others: sorry about the above, his just really annoyed me, i would appreciate if you could help me out. thanks Quote Link to comment https://forums.phpfreaks.com/topic/285206-help-with-phpmysql-inserting-with-binds/#findComment-1464600 Share on other sites More sharing options...
kicken Posted January 9, 2014 Share Posted January 9, 2014 If you read my whole post and clicked on the link, you wouldnt of asked the question of how i know the ones are produce, just like previously where you didnt read my previous thread and thought i was using PDO and not PDOStatement Your image doesn't show jack-shit. You were asked what your table definition was, not what values it contains. You can get the definition by running a 'DESC tableNameHere' query, or just post the CREATE TABLE statement you used when creating the table. Secondly, assuming there is no problem with the table definition, there is no reason those columns would contain 1 rather than the values you set. There is nothing syntactically wrong with your query or code. As such, the most likely explanations are: 1) You are not giving us an accurate representation of your code or 2) You are not verifying the results of your code accurately. There have been numerous times people have come on here adamant that they have correctly checked things only to realize days later(after being told numerous times) that they actually were not. Hence the suggestions to make sure you are checking correctly by having your code select and output the data after inserting. Or at the very least have your code output the ID for the row just entered and make sure you match it up properly when check the table data. Quote Link to comment https://forums.phpfreaks.com/topic/285206-help-with-phpmysql-inserting-with-binds/#findComment-1464604 Share on other sites More sharing options...
mac_gyver Posted January 9, 2014 Share Posted January 9, 2014 just like previously where you didnt read my previous thread and thought i was using PDO and not PDOStatement that's the other help forum site where you have been posting these same questions. you need to keep your threads and replies straight between all the different places you have posted them. i'm pretty sure no one that has replied in this thread is the same as the member you are referring to on that other site and someone misreading code and stating there's not a function/method is hardly anything to whine about, especially since he was questioning your code because it contains an obvious problem that would have prevented it from producing any output. Quote Link to comment https://forums.phpfreaks.com/topic/285206-help-with-phpmysql-inserting-with-binds/#findComment-1464609 Share on other sites More sharing options...
ginerjm Posted January 9, 2014 Share Posted January 9, 2014 Thank you for your support Kicken - at least someone understands where I'm coming from. With that said - I think I'll sign off this post. Can't fix ...... Well you know what I mean. Quote Link to comment https://forums.phpfreaks.com/topic/285206-help-with-phpmysql-inserting-with-binds/#findComment-1464612 Share on other sites More sharing options...
afallingpanda Posted January 10, 2014 Author Share Posted January 10, 2014 (edited) your all a bunch of retards, im out, go fuck ur mothers Edited January 10, 2014 by afallingpanda Quote Link to comment https://forums.phpfreaks.com/topic/285206-help-with-phpmysql-inserting-with-binds/#findComment-1464687 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.