Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax - I think

Status
Not open for further replies.

lynque

IS-IT--Management
Sep 30, 2004
124
CA
I am very green with PHP so be gentle...
I have a page that runs fine on our dev server (offsite)
but when I try to run it on my local machine I see some (not all) of the PHP code, which is why I think it could be syntax related

Code:
if(!$P) {
        $P = 1; // start on page 1.
} else {
        if(strspn($P,"0123456789")<>strlen($P)) { // make sure it's a number.
                $P = 1;
        } else {
                if($P < 1) {
                        $P = 1;
                }
        }
}

Everything from <>strlen is visible on screen.
I've tested the phpInfo file and it works fine.
I'm not really sure what is happening so any suggestions are welcome.
 
Thanks Chacalinc

I tried that and while that piece of PHP code no longer displays, it starts displaying code from further down the page.
 
from where? could you post the code some lines before it beginds to show up to some lines after?

cheers.
 
Here is the code it is now starting to display...

Code:
1 && strlen($sealDateExpire) > 1)

Again what doesn't make sense is that this page runs fine on another server.
No syntax errors.

I'm looking at my server settings now...
 
pls, post some codes before and after...

We can't see what's going on if we can't see the code in order to do some diagnostics.
 
Ok, sorry about that...

The monster if statement


Code:
if(!$P) {
        $P = 1; // start on page 1.
} else {
        if(strspn($P,"0123456789")<>strlen($P)) { // make sure it's a number.
                $P = 1; 
        } else {
                if($P < 1) {
                        $P = 1;
                }
        }
}

$sealDateIssue = $_REQUEST['sealDateIssue'];
$sealDateExpire = $_REQUEST['sealDateExpire'];

if(!strcmp($sealDateIssue,"1969-12-31")) { 
	$sealDateIssue = "";
}

if(!strcmp($sealDateExpire,"1969-12-31")) {
	$sealDateExpire = "";
}

if(strlen($sealDateIssue) > 1 && strlen($sealDateExpire) > 1) { // both start date and end date
	if(!$_REQUEST['company'] && !$_REQUEST['country']) { // none
	        $query = "select * from factoryInfo where compliancsealDateExpire>= '$sealDateIssue' AND compliancsealDateExpire<= '$sealDateExpire' order by $SORT asc";
	} else
	if($_REQUEST['company'] && $_REQUEST['country']) { // all
	        $query = "select * From factoryInfo where factoryName like '%".$_REQUEST['company']."%' and country like ".
	                "'%".$_REQUEST['country']."%' order by $SORT asc";
	} else
	if($_REQUEST['company']) { // only company
	        $query = "select * From factoryInfo where factoryName like '%".$_REQUEST['company']."%' order by $SORT asc";
	} else { // only country
	        $query = "select * From factoryInfo where country like '%".$_REQUEST['country']."%' order by $SORT asc";
	}
} else
if(strlen($sealDateIssue) > 1) { // only start date
	if(!$_REQUEST['company'] && !$_REQUEST['country']) { // none
	        $query = "select * from factoryInfo where compliancsealDateExpire>= '$sealDateIssue' order by $SORT asc";
	} else
	if($_REQUEST['company'] && $_REQUEST['country']) { // all
	        $query = "select * From factoryInfo where factoryName like '%".$_REQUEST['company']."%' and country like ".
	                "'%".$_REQUEST['country']."%' AND compliancsealDateExpire>= '$sealDateIssue' order by $SORT asc";
	} else
	if($_REQUEST['company']) { // only company
	        $query = "select * From factoryInfo where factoryName like '%".$_REQUEST['company']."%' AND compliancsealDateExpire>= '$sealDateIssue' order by $SORT asc";
	} else { // only country
	        $query = "select * From factoryInfo where country like '%".$_REQUEST['country']."%' AND compliancsealDateExpire>= '$sealDateIssue' order by $SORT asc";
	}
} else { // no date search
	if(!$_REQUEST['company'] && !$_REQUEST['country']) { // none
	        $query = "select * from factoryInfo order by $SORT asc";
	} else
	if($_REQUEST['company'] && $_REQUEST['country']) { // all
	        $query = "select * From factoryInfo where factoryName like '%".$_REQUEST['company']."%' and country like ".
	                "'%".$_REQUEST['country']."%' order by $SORT asc";
	} else
	if($_REQUEST['company']) { // only company
	        $query = "select * From factoryInfo where factoryName like '%".$_REQUEST['company']."%' order by $SORT asc";
	} else { // only country
	        $query = "select * From factoryInfo where country like '%".$_REQUEST['country']."%' order by $SORT asc";
	}
}

Thanks for your help
 
ok, I understand the problem.

By php.ini setting, a php code could be:

<?php php.code.. ?>

-or-

<? php.code ?>

-or- however you define.. so you must be a seting telling "hey, php code ends with >"

take a look to that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top