Welcome Guest, Not a member yet? Register   Sign In
Random Database Pull
#11

[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.
#12

[eluser]Pygon[/eluser]
My post at 09:06 AM covers an alternative method.
#13

[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
#14

[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".
#15

[eluser]codelearn[/eluser]
Pygon,

It seems to always order it by ID... even though it says random.

Hmm...
#16

[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".
#17

[eluser]codelearn[/eluser]
Figured it all out. Thanks for the help!




Theme © iAndrew 2016 - Forum software by © MyBB