ok im having some problems with getting an error message to show up if the $id is not in the mysql, db...
if(isset($id) AND is_null($id)) {
echo "mooo error!";
}
else if (isset($id) AND $id=mysql_fetch_array($result3)) {
echo "corrrect!";
}
any way around this?where is $id coming from?
if($id == ""){
that works.$id = $_GET['id'];
how will that solve it?
it didnt.
i want index.php?id=2 to work (cause 2 is a real id)
but not want index.php?id=32824879
(to display an error message, not blank spots)
and index.php display what it should.. not the error message...
i looked all over the manual for this...ok I am a little lost.
isset() and is_null() will not do anything with '32824879'.
what you are doing is all wrong. you get the id and you query the database and you display the error if the qiery didn't return any rows.
if you want it to be always a single digit then you have to do a regular expression to determine how many digits it is.thanks for the help, but i figured it out..
i had to use nesting and NOT use is_null
i did this:
if (isset($id) AND $id=mysql_fetch_array($result3)) {
echo "blah correct..";
}
else {
if (isset($id) AND $id!==mysql_fetch_array($result3)) {
echo "error!";
}
else {
echo "correct, else stuff";
}
}long way around but ok.that doesnt work too good , so i used this:
$num_rows = mysql_num_rows($result3);
if (isset($id) && $num_rows>0) {
echo "correct";
}
else {
if (isset($id) && $num_rows<=0) {
echo "error!";
}
else {
echo "more correct";
}figured you would use that way, tha tis closer to what you should have done in the beginning
if(isset($id) AND is_null($id)) {
echo "mooo error!";
}
else if (isset($id) AND $id=mysql_fetch_array($result3)) {
echo "corrrect!";
}
any way around this?where is $id coming from?
if($id == ""){
that works.$id = $_GET['id'];
how will that solve it?
it didnt.
i want index.php?id=2 to work (cause 2 is a real id)
but not want index.php?id=32824879
(to display an error message, not blank spots)
and index.php display what it should.. not the error message...
i looked all over the manual for this...ok I am a little lost.
isset() and is_null() will not do anything with '32824879'.
what you are doing is all wrong. you get the id and you query the database and you display the error if the qiery didn't return any rows.
if you want it to be always a single digit then you have to do a regular expression to determine how many digits it is.thanks for the help, but i figured it out..
i had to use nesting and NOT use is_null
i did this:
if (isset($id) AND $id=mysql_fetch_array($result3)) {
echo "blah correct..";
}
else {
if (isset($id) AND $id!==mysql_fetch_array($result3)) {
echo "error!";
}
else {
echo "correct, else stuff";
}
}long way around but ok.that doesnt work too good , so i used this:
$num_rows = mysql_num_rows($result3);
if (isset($id) && $num_rows>0) {
echo "correct";
}
else {
if (isset($id) && $num_rows<=0) {
echo "error!";
}
else {
echo "more correct";
}figured you would use that way, tha tis closer to what you should have done in the beginning