Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,263 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,161 people online right now. Registration is fast and FREE... Join Now!




Arrays

 
Reply to this topicStart new topic

Arrays

RichardSA
post 10 Apr, 2005 - 07:25 AM
Post #1


New D.I.C Head

Group Icon
Joined: 16 Feb, 2005
Posts: 24



Dream Kudos: 25
My Contributions


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:

CODE
$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 Apr, 2005 - 07:30 AM
User is offlineProfile CardPM

Go to the top of the page

snoj
post 10 Apr, 2005 - 09:46 AM
Post #2


$Null

Group Icon
Joined: 31 Mar, 2003
Posts: 3,304



Thanked 5 times

Dream Kudos: 700
My Contributions


CODE

$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 Apr, 2005 - 09:47 AM
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/21/08 11:42PM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month