Jump to content


Photo

Trouble with an if then statement


  • Please log in to reply
2 replies to this topic

#1 anthonydamasco

anthonydamasco
  • Members
  • PipPipPip
  • Advanced Member
  • 92 posts

Posted 07 August 2006 - 01:05 PM

I'm basicly trying to get this script to work

My MySQL table is called 'joborder' and the field is 'checkedby' by default 'checkedby' is set to post "no one" Basicly I want an if then statment to do this

If 'checkedby' == value "No one" Then echo ' '
Else include "checkid.html"

but I dont know the correct way to do it.


	  <?php

$checkedby = $my_row['checkedby'];

	  if($checkedby == 'no one')
{
   echo '';
}else{
   include_once("checkid.html");
}  
	  
	  ?>

but i know im doing something wrong.

#2 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 07 August 2006 - 01:07 PM

Try:
<?php
$checkedby = $my_row['checkedby'];
if(strtolower($checkedby) != "no one"){
include_once("checkid.html");
}  
?>

Orio.
Think you're smarty?

(Gone until 20 to November)

#3 radalin

radalin
  • Members
  • PipPipPip
  • Advanced Member
  • 179 posts

Posted 07 August 2006 - 01:13 PM

Well try using "No one" instead of "no one". PHP is a case sensitive language just like dbs.
Maybe there is a problem with your default post at "no one" try echoing the data you fetch first. See what it's even a space character can break that if statement. "no  one" != "no one".
Above that logic looks ok
Roy Simkes
Yet Another Parkyeri Developer




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users