Toon posts:

Mysql ORDER BY RAND() werkt wel en niet

Pagina: 1
Acties:
  • 32 views sinds 30-01-2008

Verwijderd

Topicstarter
Als ik het zo doe dan werkt het wel.

$sql = "SELECT * ";
$sql .= "FROM $table ";
$sql .= "ORDER BY RAND() ";

Vreemd is het dan dat dit weer niet werkt.

$sql = "SELECT * ";
$sql .= "FROM $table ";
$sql .= "WHERE `periode` = $maand OR `periode` = $hulpperiode";
$sql .= "ORDER BY RAND() ";

Hoe moet ik de onderste vermelden om toch een selectie uit te voeren en random de volgorde te krijgen?

Wie kan me helpen.

  • NMe
  • Registratie: Februari 2004
  • Laatst online: 15-04 22:07

NMe

Quia Ego Sic Dico.

Door een spatie achter "$hulpperiode" te zetten. ;)

'E's fighting in there!' he stuttered, grabbing the captain's arm.
'All by himself?' said the captain.
'No, with everyone!' shouted Nobby, hopping from one foot to the other.


  • Brakkie
  • Registratie: Maart 2001
  • Niet online

Brakkie

blaat

En daar had je achter kunnen komen (als je met php werkt) door
PHP:
1
echo mysql_error();

te doen.

Systeem | Strava


Verwijderd

Topicstarter
Ik was er al achter komen. Dat was het inderdaad. Ik heb daar verschrikkelijk overheen gekeken.
Thxs Anyway.

  • Creepy
  • Registratie: Juni 2001
  • Laatst online: 10-05 12:29

Creepy

Tactical Espionage Splatterer

"I had a problem, I solved it with regular expressions. Now I have two problems". That's shows a lack of appreciation for regular expressions: "I know have _star_ problems" --Kevlin Henney


Dit topic is gesloten.