![]() |
Random Database Pull - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Random Database Pull (/showthread.php?tid=6770) Pages:
1
2
|
Random Database Pull - El Forum - 03-11-2008 [eluser]codelearn[/eluser] Pygon, Is there a way to avoid that? I would like to limit the return to just one set... Thanks for all the help guys. Random Database Pull - El Forum - 03-11-2008 [eluser]Pygon[/eluser] My post at 09:06 AM covers an alternative method. Random Database Pull - El Forum - 03-11-2008 [eluser]codelearn[/eluser] Pygon, I get this error when I try to use the code: An Error Was Encountered Error Number: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group ASC, id ASC LIMIT 3' at line 3 SELECT * FROM outreach_widget ORDER BY group ASC, id ASC LIMIT 3 Random Database Pull - El Forum - 03-11-2008 [eluser]Pygon[/eluser] codelearn: This is valid SQL however you might consider wrapping your column names if you're going to use a column named "group" as this is part of the keyword "GROUP BY". Random Database Pull - El Forum - 03-11-2008 [eluser]codelearn[/eluser] Pygon, It seems to always order it by ID... even though it says random. Hmm... Random Database Pull - El Forum - 03-11-2008 [eluser]Pygon[/eluser] Sorry -- I'm not sure what you're doing. "group" isn't even in the table you showed, and your SQL query asks for "id ASC". Random Database Pull - El Forum - 03-11-2008 [eluser]codelearn[/eluser] Figured it all out. Thanks for the help! |