1 Replies - 1238 Views - Last Post: 10 April 2005 - 10:46 AM Rate Topic: -----

#1 RichardSA  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 24
  • Joined: 16-February 05

Arrays

Posted 10 April 2005 - 08:25 AM

I know this is a totaly n00bish question, and i am sorry for asking, but i am really stuck.

Ok, what i need: i'm reading from a forum, a vB forum, and i need to make an array for all the "threadid" numbers in the "forum" table. then i need to seach the "posts" table for posts matching the threadid.

is there an easy way i could do this?

EDIT: would it just be like:

$x = 1, 4, 7, 10, 24, 74;
$y = (random Number);
if ($y == $x) {
   echo "Yes, theres a match.";
} else {
   echo "No match";
}

This post has been edited by RichardSA: 10 April 2005 - 08:30 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Arrays

#2 snoj  Icon User is offline

  • Married Life
  • member icon

Reputation: 84
  • View blog
  • Posts: 3,564
  • Joined: 31-March 03

Re: Arrays

Posted 10 April 2005 - 10:46 AM

$x = array(1, 4, 7, 10, 24, 74);

//Note I put minimum and maximum values relating to your array of numbers so we don't get 72311 or something.
$y = rand(1,74); //or array_rand($x) if you want a random number from your array

if ($y == $x) {
  echo "Yes, theres a match.";
} else {
  echo "No match";
}

This post has been edited by hotsnoj: 10 April 2005 - 10:47 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1