WarMad Posted December 31, 2016 Posted December 31, 2016 im using pdo and for one of the mods im making it keeps repeating results and i have absolutely no idea on how to fix it i have tried everything i know Quote
SRB Posted January 2, 2017 Posted January 2, 2017 By everything you know, what have you actually tried? Quote
WarMad Posted January 2, 2017 Author Posted January 2, 2017 to many different things to even list haha i have even taking querys from other things copied it and then pasted it there and edited it so it would get the info i wanted and it still keeps doing it :-| Quote
TheMasterGeneral Posted January 6, 2017 Posted January 6, 2017 $query=$db->query("bleh"); while ($result=$db->fetch_row($query)) { //herp the derp } 1) Have you tried adding "LIMIT 1" to the end of the query? 2) Are you only selecting one data row? If so, I think you'd want fetch_single rather than fetch_row. Quote
WarMad Posted January 7, 2017 Author Posted January 7, 2017 I'm trying to select all of my items for a list saying what they all cost and stuff and I it selects them all but it repeats one of the items and it's not in the db more then one time Quote
Jax Posted January 7, 2017 Posted January 7, 2017 Clearly explaining problems in not one of your finest talents. In order for people to help you - both now and in the future, it really does help if you provide a *lot* of information. Start with the basics. McCodes engine - we know (or assume we know given the forum ...) that's a good start however if memory serves me, McCodes never had a PDO database class, only a MySQL and MySQLi class, therefore you are already presenting a problem in code that is not "out of the box". PDO in general is nice and simple: $stmt = $db->prepare("SELECT field1, field2, field3 FROM table WHERE fieldN = :expr"); $stmt->execute(['expr' => "search-expression"]); $row = $stmt->fetch(); No at all complex, and reasonable safe from a number of potential attack vectors. Now if you presented the code *you* use, then other people might be able to spot where the error lies - as it stands, we haven't a clue. You say you've tried too many different things to list - no, I suspect that is laziness. Even Guest will have the decency to actually point people to the code he's having problems with (which happens surprisingly frequently) - so please give us a better bit of information. I can assure you that your code is not special, no matter what you think - people have been modifying the venerable McCodes platform for years now, there's seldom anything new or indeed complex, so show us the snippet of code that you think is failing, show us the input variables ($_GET / $_POST etc) to it, show us the output and show us what the expected output should be. I'd also suggest that unless you are using 100% stock McCodes tables, you present the data definition (SHOW CREATE TABLE xxx) of the relevant tables. Remember, asking questions is about solving problems - if you can't present sufficient information for people to address the problem - the problem doesn't go away. *If*, on the off-chance that you have actually solved this, then I'd suggest that you actually present the problem *and* the solution so that anybody else struggling with a similar issue can learn from your experiences rather than find yet another useless topic on MWG. Quote
WarMad Posted January 7, 2017 Author Posted January 7, 2017 Ok I will post it asap and no explaining things is not something I'm even a little bit good at haha Quote
WarMad Posted January 12, 2017 Author Posted January 12, 2017 Well I forgot to update but I went on it not to long ago to check it out and the error was gonna (scratches his head) I tried to fix it for month and just poof haha Quote
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.