I am trying to retrieve a value from a MySQL Database with PHP...
$_domain_check = $_POST[domain];
$res = mysql_query("SELECT column_name FROM userid_dbname.table_name WHERE domain = '$_domain_check'");
$_rs = mysql_fetch_array($res);
$_db_value = $_rs[column_name];
Then I am trying to take the value it recieved ($_db_value) and it SHOULD have a value that is numbers seperated by a pipe(|) like this:
$_db_value = "1|3|8|2|9|3";
// Or it could even be:
$_db_value = "5|7|8|10|20";
So, How could I tell if this value contains the number 5? not like 50, but 5 all by it self...
I am concerned because what if the value is only 5
or if it is 5|7
or if it is 3|4|5|6
or if it is 4|5
Therefore, in Perl I do it like this:
Actually [PERL] :o)
if ($_db_value && $_db_value =~ /\|/) { # Has a value and a pipe
while ($_db_value =~ /\|/) {# while it contains a PIPE do this
(my $_check, $_db_value) = split /\|/, $_db_value, 2;
if ($_check && $_check == 5) {
# Ok, I know it does have it :o)
}
}
} elsif ($_db_value && $_db_value == 5) {
# Ok, this does have the value...
}
[/PERL]
How could I do that in PHP? I am just starting to learn a little bit more PHP, but am not yet this far into knowing how to do it...
I would appreciate your advice/tips on this...
Thank you!
Richard