- Joined
- Aug 17, 2007
- Messages
- 45
- Reaction score
- 0
Hello, i'm writing a script with my friend for a sort of chatbot.
now we have this piece of code:
Now what it needs to do is: If it finds the word "snap" and the word "niet" in the send message, it will pick a randomly message (snap1, snap2, snap3, snap4 or snap5) and give that to variable $msg
(later on in the script it will search for $msg in my database)
But i keep getting my error message (the message when a word isn't in the database), how can i fix this?? =]
now we have this piece of code:
PHP:
if(eregi('snap',$msg) && eregi('niet',$msg)) {
$array = array("snap1", "snap2", "snap3", "snap4", "snap5");
$msg = array_rand($array, 5);
}
Now what it needs to do is: If it finds the word "snap" and the word "niet" in the send message, it will pick a randomly message (snap1, snap2, snap3, snap4 or snap5) and give that to variable $msg
(later on in the script it will search for $msg in my database)
But i keep getting my error message (the message when a word isn't in the database), how can i fix this?? =]

