grennibones Posted March 16, 2009 Share Posted March 16, 2009 Hello All, I hoping someone can help me out with this. My PHP is showing up on my web page. The PHP in question suddenly renders about half way through the block right after the ">" on the last line. I can not see any reason for this behavior. The beginning half does not show up but everything after the ">" does. OCIExecute($rsql1, OCI_DEFAULT); $vrow1 = OCI_fetch_row($rsql1,OCI_ASSOC); extract($vrow1); /* $vcnt1 = OCIrowcount($rsql1, $row; */ if (($priv_id > 1) and ($at_cnt < 3)) { Is this a configuration issue? A coding issue? Thank you for the help. Quote Link to comment https://forums.phpfreaks.com/topic/149704-why-is-my-php-code-rendering-on-my-web-page/ Share on other sites More sharing options...
wildteen88 Posted March 16, 2009 Share Posted March 16, 2009 All PHP code should be wrapped in PHP tags <?php // your code here ?> and saved within .php files (unless your host supports other file types to be parsed by PHP). Quote Link to comment https://forums.phpfreaks.com/topic/149704-why-is-my-php-code-rendering-on-my-web-page/#findComment-786104 Share on other sites More sharing options...
valoukh Posted March 16, 2009 Share Posted March 16, 2009 Not sure if this is relevant: if it's PHP5 I noticed you have to write "<?php" every time you begin some code, as opposed to just "<?". Quote Link to comment https://forums.phpfreaks.com/topic/149704-why-is-my-php-code-rendering-on-my-web-page/#findComment-786109 Share on other sites More sharing options...
Maq Posted March 16, 2009 Share Posted March 16, 2009 Not sure if this is relevant: if it's PHP5 I noticed you have to write "<?php" every time you begin some code, as opposed to just "". You're right, short tags should never be used... This should be the case with all versions of PHP. Quote Link to comment https://forums.phpfreaks.com/topic/149704-why-is-my-php-code-rendering-on-my-web-page/#findComment-786131 Share on other sites More sharing options...
grennibones Posted March 16, 2009 Author Share Posted March 16, 2009 Sorry, I should have also said that this is only part of the block. Here is the whole block: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title> System Bible Login Page </title> <link rel="stylesheet" type="text/css" href="sysb_login.css"> </head> <body> <div id="midcon"> <?php error_reporting(E_ALL); session_start(); $vmess = 0; $vcnt1 = 0; switch(@$_GET['do']) { case "login": $conn = OCILogon($usr, $pwd, $host) or die ("Could not connect to Oracle."); $sql1 = "SELECT usr_id, priv_id, status, at_cnt FROM usr WHERE UPPER(usr_name) = '$_POST[v_usrn]'"; $rsql1 = OCIParse($conn, $sql1); OCIExecute($rsql1, OCI_DEFAULT); $vrow1 = OCI_fetch_row($rsql1,OCI_ASSOC); extract($vrow1); if (($priv_id > 1) and ($at_cnt < 3)) { sql2 = "INSERT INTO audt VALUES(seq_audt.NEXTVAL,'$usr_id',SYSDATE)"; $rsql2 = OCIParse($conn, $sql2); header("Location:sysb_main.php"); } } else { if($at_cnt >= 3) { $vmess1 = 2; } else { $sql3 = "UPDATE usr SET at_cnt = '$at_cnt'+1"; $rsql3 = OCIParse($conn, $sql3); if(($at_cnt+1) >= 3) { $vmess1 = 2; } else { $vmess1 = 1; { } unset($do); include("sysb_login_form.inc"); } /* end of case statement */ break; default: include("sysb_login_from.inc"); ?> </div> </body> </html> (edited by kenrbnsn to add tags) Quote Link to comment https://forums.phpfreaks.com/topic/149704-why-is-my-php-code-rendering-on-my-web-page/#findComment-786136 Share on other sites More sharing options...
smcan Posted March 16, 2009 Share Posted March 16, 2009 I get a parse error with your code on line 29: sql2 = "INSERT INTO audt VALUES(seq_audt.NEXTVAL,'$usr_id',SYSDATE)"; try putting a $ before the sql2. Quote Link to comment https://forums.phpfreaks.com/topic/149704-why-is-my-php-code-rendering-on-my-web-page/#findComment-786152 Share on other sites More sharing options...
grennibones Posted March 17, 2009 Author Share Posted March 17, 2009 Thank you all. While I did need the $ in front of that variable it was not the cause of my problem. It's really odd. everything after The ">" in this line renders on the web page and everything before does not. if (($priv_id > 1) and ($at_cnt < 3)) Quote Link to comment https://forums.phpfreaks.com/topic/149704-why-is-my-php-code-rendering-on-my-web-page/#findComment-786666 Share on other sites More sharing options...
severndigital Posted March 17, 2009 Share Posted March 17, 2009 this is going to sound wierd, but it may be the use of the word and ... try using && instead Quote Link to comment https://forums.phpfreaks.com/topic/149704-why-is-my-php-code-rendering-on-my-web-page/#findComment-786694 Share on other sites More sharing options...
kenrbnsn Posted March 17, 2009 Share Posted March 17, 2009 Thank you all. While I did need the $ in front of that variable it was not the cause of my problem. It's really odd. everything after The ">" in this line renders on the web page and everything before does not. if (($priv_id > 1) and ($at_cnt < 3)) What that tells me is that either the web server you're using doesn't support PHP or you're not invoking the web server when processing this file. How are you invoking the script? Ken Quote Link to comment https://forums.phpfreaks.com/topic/149704-why-is-my-php-code-rendering-on-my-web-page/#findComment-786709 Share on other sites More sharing options...
grennibones Posted March 17, 2009 Author Share Posted March 17, 2009 Hello Ken, I am invoking the file like so: http://localhost/sysb_login.html When I run a PHP test http://localhost/phpinfo.php it works fine. I also corrected and extra "{" and a missing "}" too but that didn't help. Quote Link to comment https://forums.phpfreaks.com/topic/149704-why-is-my-php-code-rendering-on-my-web-page/#findComment-786748 Share on other sites More sharing options...
trq Posted March 17, 2009 Share Posted March 17, 2009 Hello Ken, I am invoking the file like so: http://localhost/sysb_login.html If its a php script it will need the php extension. Quote Link to comment https://forums.phpfreaks.com/topic/149704-why-is-my-php-code-rendering-on-my-web-page/#findComment-786766 Share on other sites More sharing options...
grennibones Posted March 17, 2009 Author Share Posted March 17, 2009 I've tried it as sysb_login.html and sysb_login.php with the same result. I have also tried it in firefox and explorer. I keep wondering if it has something to do with how I configured apache and php. Quote Link to comment https://forums.phpfreaks.com/topic/149704-why-is-my-php-code-rendering-on-my-web-page/#findComment-786791 Share on other sites More sharing options...
xylex Posted March 17, 2009 Share Posted March 17, 2009 View source on that rendering, I'm sure it's all there, just not displayed because the browser sees everything from <?php.....> as a big invalid tag, then starts displaying after that. Like Ken said, the PHP isn't being parsed. Make sure it's installed correctly and that you have PHP set as a handler in your httpd.conf. Quote Link to comment https://forums.phpfreaks.com/topic/149704-why-is-my-php-code-rendering-on-my-web-page/#findComment-786811 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.