Clinton Posted September 8, 2007 Share Posted September 8, 2007 I tried doing this in my navigation area instead of my authentication area. Here is what I tried doing by i'm getting multiple errors. I finally stopped trying and here's the error that was settled on: Parse error: syntax error, unexpected '.' in /home/anderse/public_html/NAIS/8321/inc/nav.php on line 12 <? $db=mysql_connect ("localhost", "******", "******") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("anderse_inventory"); $rn=("SELECT Status FROM users WHERE username='" . $_SESSION['username']."'"); $rz=mysql_query($rn); while( $row = mysql_fetch_array($rz)) { if (.$row["Status"]=="0") echo ("The Administrator has not yet approved your account. You will be contacted once this occurs."); else echo " } ?> <html> <head> <META http-equiv="REFRESH" content="60"; url="nav.php"> <SCRIPT TYPE="text/javascript"> <!-- function popup(mylink, windowname) { if (! window.focus)return true; var href; if (typeof(mylink) == 'string') href=mylink; else href=mylink.href; window.open(href, windowname, 'width=600,height=300,scrollbars=yes'); return false; } //--> </SCRIPT> </head> <center> <? $dbh=mysql_connect ("localhost", "*******", "******") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("anderse_inventory"); $rnq=("SELECT First,MI,Last,Status FROM users WHERE username='" . $_SESSION['username']."'"); $rs=mysql_query($rnq); while( $row = mysql_fetch_array($rs)) { echo("<h3>".$row["First"]); echo(" ".$row["MI"]); echo(". ".$row["Last"]); echo("</h3> "); } ?> <? $ztime = date("H:i d-M-y", strtotime("now + 6 hour")); $ptime = date("H:i d-M-y", strtotime("now -3 hour")); $mtime = date("H:i d-M-y", strtotime("now -2 hour")); $ctime = date("H:i d-M-y", strtotime("now -1 hour")); $atime = date("H:i d-M-y"); ?> <body bgcolor="#3366FF" text="#99FF00" link="#00FF99" vlink="#00FF99" alink="#00FF99"> <h5><font color=green>Pacific Time: </font><? echo $ptime;?> <? echo "<font color=#FFCC33>   Mountain Time: </font>",$mtime;?> <? echo "<font color=green>   Central Time: </font>",$ctime;?> <? echo "<font color=green>   Atlantic Time: </font>",$atime;?> <? echo "<font color=green>   Zulu Time: </font>",$ztime;?><br> </font></h5> </center> <? "; ?> Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted September 8, 2007 Share Posted September 8, 2007 Parse error: syntax error, unexpected '.' on line 12 ------------> .$row Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted September 8, 2007 Share Posted September 8, 2007 Correct Code: <?php if ($row["Status"]=="0")?> Quote Link to comment Share on other sites More sharing options...
Clinton Posted September 8, 2007 Author Share Posted September 8, 2007 That fixed that problem but now it's giving me a problem in the HTML area... it's like the php hasn't ended and the problem is with a ;?? Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/anderse/public_html/NAIS/8321/inc/nav.php on line 25 (By the way, thanks for the quick help) <? $db=mysql_connect ("localhost", "anderse_admin", "2006*Cj*") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("anderse_inventory"); $rn=("SELECT Status FROM users WHERE username='" . $_SESSION['username']."'"); $rz=mysql_query($rn); while( $row = mysql_fetch_array($rz)) { if($row["Status"]=="0") echo ("The Administrator has not yet approved your account. You will be contacted once this occurs."); else echo " ?> <html> <head> <META http-equiv="REFRESH" content="60"; url="nav.php"> <SCRIPT TYPE="text/javascript"> <!-- function popup(mylink, windowname) { if (! window.focus)return true; var href; if (typeof(mylink) == 'string') href=mylink; else href=mylink.href; window.open(href, windowname, 'width=600,height=300,scrollbars=yes'); return false; } //--> </SCRIPT> </head> <center> <? $dbh=mysql_connect ("localhost", "anderse_admin", "2006*Cj*") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("anderse_inventory"); $rnq=("SELECT First,MI,Last,Status FROM users WHERE username='" . $_SESSION['username']."'"); $rs=mysql_query($rnq); while( $row = mysql_fetch_array($rs)) { echo("<h3>".$row["First"]); echo(" ".$row["MI"]); echo(". ".$row["Last"]); echo("</h3> "); } ?> <? $ztime = date("H:i d-M-y", strtotime("now + 6 hour")); $ptime = date("H:i d-M-y", strtotime("now -3 hour")); $mtime = date("H:i d-M-y", strtotime("now -2 hour")); $ctime = date("H:i d-M-y", strtotime("now -1 hour")); $atime = date("H:i d-M-y"); ?> <body bgcolor="#3366FF" text="#99FF00" link="#00FF99" vlink="#00FF99" alink="#00FF99"> <h5><font color=green>Pacific Time: </font><? echo $ptime;?> <? echo "<font color=#FFCC33>   Mountain Time: </font>",$mtime;?> <? echo "<font color=green>   Central Time: </font>",$ctime;?> <? echo "<font color=green>   Atlantic Time: </font>",$atime;?> <? echo "<font color=green>   Zulu Time: </font>",$ztime;?><br> <? echo "<font color=green>3350 Directors Row, Suite 600     Salt Lake City, UT     84104-4585     Office: 801-908-5350       Fax: 866-636-2629<br>";?></font></h5> </center> <style> <!-- .skin0{ position:absolute; width:165px; border:1px solid red; background-color:menu; font-family:Verdana; line-height:20px; cursor:default; font-size:14px; z-index:100; visibility:hidden; } .menuitems{ padding-left:10px; padding-right:10px; } --> </style> <div id="ie5menu" class="skin0" onMouseover="highlightie5(event)" onMouseout="lowlightie5(event)" onClick="jumptoie5(event)" display:none> <div class="menuitems" url="index.php">Home</div> <div class="menuitems" url="keyper.php">Personnel</div> <div class="menuitems" url="calendar.php">Calendar</div> <div class="menuitems" url="inventory.php">Inventory</a></div> <div class="menuitems" url="hotels.php">D.B. Hotels</a></div> <div class="menuitems" url="options.php">Edit Personal Info</div> <div class="menuitems" url="admin.php">Admin Area</div> <div class="menuitems" url="logout.php">Logout</div> </div> <script language="JavaScript1.2"> var display_url=0 var ie5=document.all&&document.getElementById var ns6=document.getElementById&&!document.all if (ie5||ns6) var menuobj=document.getElementById("ie5menu") function showmenuie5(e){ var rightedge=ie5? document.body.clientWidth-event.clientX : window.innerWidth-e.clientX var bottomedge=ie5? document.body.clientHeight-event.clientY : window.innerHeight-e.clientY if (rightedge<menuobj.offsetWidth) menuobj.style.left=ie5? document.body.scrollLeft+event.clientX-menuobj.offsetWidth : window.pageXOffset+e.clientX-menuobj.offsetWidth else menuobj.style.left=ie5? document.body.scrollLeft+event.clientX : window.pageXOffset+e.clientX if (bottomedge<menuobj.offsetHeight) menuobj.style.top=ie5? document.body.scrollTop+event.clientY-menuobj.offsetHeight : window.pageYOffset+e.clientY-menuobj.offsetHeight else menuobj.style.top=ie5? document.body.scrollTop+event.clientY : window.pageYOffset+e.clientY menuobj.style.visibility="visible" return false } function hidemenuie5(e){ menuobj.style.visibility="hidden" } function highlightie5(e){ var firingobj=ie5? event.srcElement : e.target if (firingobj.className=="menuitems"||ns6&&firingobj.parentNode.className=="menuitems"){ if (ns6&&firingobj.parentNode.className=="menuitems") firingobj=firingobj.parentNode //up one node firingobj.style.backgroundColor="highlight" firingobj.style.color="yellow" if (display_url==1) window.status=event.srcElement.url } } function lowlightie5(e){ var firingobj=ie5? event.srcElement : e.target if (firingobj.className=="menuitems"||ns6&&firingobj.parentNode.className=="menuitems"){ if (ns6&&firingobj.parentNode.className=="menuitems") firingobj=firingobj.parentNode //up one node firingobj.style.backgroundColor="#3366FF" firingobj.style.color="#99FF00" window.status='' } } function jumptoie5(e){ var firingobj=ie5? event.srcElement : e.target if (firingobj.className=="menuitems"||ns6&&firingobj.parentNode.className=="menuitems"){ if (ns6&&firingobj.parentNode.className=="menuitems") firingobj=firingobj.parentNode if (firingobj.getAttribute("target")) window.open(firingobj.getAttribute("url"),firingobj.getAttribute("target")) else window.location=firingobj.getAttribute("url") } } if (ie5||ns6){ menuobj.style.display='' document.oncontextmenu=showmenuie5 document.onclick=hidemenuie5 } </script> <? "; } ?> Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted September 8, 2007 Share Posted September 8, 2007 the problem is echo " ?> You don't need to echo stuff outside of the PHP code. It will appear by itself. Quote Link to comment Share on other sites More sharing options...
Clinton Posted September 8, 2007 Author Share Posted September 8, 2007 Ok, so I got rid of the second echo and it worked to a point. It now includes the statement, "The Administrator has not yet approved your account. You will be contacted once this occurs." If the account status equals 0 but it also shows the rest of the website, which is not what I want. I want it to show that phrase if their account has not been approved and that's it. It's like the else phrase isn't working. (I just joined this site and it's awesome. I can't believe how fast responses are here. Thanks!) Quote Link to comment Share on other sites More sharing options...
Clinton Posted September 8, 2007 Author Share Posted September 8, 2007 I'm so close to getting this solved... I know one of you geniuses out here know the answer. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted September 8, 2007 Share Posted September 8, 2007 <?php $db=mysql_connect ("localhost", "anderse_admin", "2006*Cj*") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("anderse_inventory"); $rn=("SELECT Status FROM users WHERE username='" . $_SESSION['username']."'"); $rz=mysql_query($rn); while( $row = mysql_fetch_array($rz)) { if($row["Status"]=="0"){ echo ("The Administrator has not yet approved your account. You will be contacted once this occurs."); }else{ ?> Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted September 8, 2007 Share Posted September 8, 2007 if you arent echoing the rest of the site inside the php it should be used else { ?> html here Quote Link to comment Share on other sites More sharing options...
Clinton Posted September 8, 2007 Author Share Posted September 8, 2007 And then where do I put my ending curly bracket? I put it at the very end so it's like <? } ?> but then I get the error: Parse error: syntax error, unexpected $end in /home/anderse/public_html/NAIS/8321/inc/nav.php on line 198 <? $db=mysql_connect ("localhost", "anderse_admin", "2006*Cj*") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("anderse_inventory"); $rn=("SELECT Status FROM users WHERE username='" . $_SESSION['username']."'"); $rz=mysql_query($rn); while($row=mysql_fetch_array($rz)) { if($row["Status"]=="0"){ echo;("The Administrator has not yet approved your account. You will be notified when this occurs"); }else{ ?> <html> <head> <META http-equiv="REFRESH" content="60"; url="nav.php"> <SCRIPT TYPE="text/javascript"> <!-- function popup(mylink, windowname) { if (! window.focus)return true; var href; if (typeof(mylink) == 'string') href=mylink; else href=mylink.href; window.open(href, windowname, 'width=600,height=300,scrollbars=yes'); return false; } //--> </SCRIPT> </head> <center> <? $dbh=mysql_connect ("localhost", "anderse_admin", "2006*Cj*") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("anderse_inventory"); $rnq=("SELECT First,MI,Last,Status FROM users WHERE username='" . $_SESSION['username']."'"); $rs=mysql_query($rnq); while( $row = mysql_fetch_array($rs)) { echo("<h3>".$row["First"]); echo(" ".$row["MI"]); echo(". ".$row["Last"]); echo("</h3> "); } ?> <? $ztime = date("H:i d-M-y", strtotime("now + 6 hour")); $ptime = date("H:i d-M-y", strtotime("now -3 hour")); $mtime = date("H:i d-M-y", strtotime("now -2 hour")); $ctime = date("H:i d-M-y", strtotime("now -1 hour")); $atime = date("H:i d-M-y"); ?> <body bgcolor="#3366FF" text="#99FF00" link="#00FF99" vlink="#00FF99" alink="#00FF99"> <h5><font color=green>Pacific Time: </font><? echo $ptime;?> <? echo "<font color=#FFCC33>   Mountain Time: </font>",$mtime;?> <? echo "<font color=green>   Central Time: </font>",$ctime;?> <? echo "<font color=green>   Atlantic Time: </font>",$atime;?> <? echo "<font color=green>   Zulu Time: </font>",$ztime;?><br> <? echo "<font color=green>3350 Directors Row, Suite 600     Salt Lake City, UT     84104-4585     Office: 801-908-5350       Fax: 866-636-2629<br>";?></font></h5> </center> <style> <!-- .skin0{ position:absolute; width:165px; border:1px solid red; background-color:menu; font-family:Verdana; line-height:20px; cursor:default; font-size:14px; z-index:100; visibility:hidden; } .menuitems{ padding-left:10px; padding-right:10px; } --> </style> <div id="ie5menu" class="skin0" onMouseover="highlightie5(event)" onMouseout="lowlightie5(event)" onClick="jumptoie5(event)" display:none> <div class="menuitems" url="index.php">Home</div> <div class="menuitems" url="keyper.php">Personnel</div> <div class="menuitems" url="calendar.php">Calendar</div> <div class="menuitems" url="inventory.php">Inventory</a></div> <div class="menuitems" url="hotels.php">D.B. Hotels</a></div> <div class="menuitems" url="options.php">Edit Personal Info</div> <div class="menuitems" url="admin.php">Admin Area</div> <div class="menuitems" url="logout.php">Logout</div> </div> <script language="JavaScript1.2"> var display_url=0 var ie5=document.all&&document.getElementById var ns6=document.getElementById&&!document.all if (ie5||ns6) var menuobj=document.getElementById("ie5menu") function showmenuie5(e){ var rightedge=ie5? document.body.clientWidth-event.clientX : window.innerWidth-e.clientX var bottomedge=ie5? document.body.clientHeight-event.clientY : window.innerHeight-e.clientY if (rightedge<menuobj.offsetWidth) menuobj.style.left=ie5? document.body.scrollLeft+event.clientX-menuobj.offsetWidth : window.pageXOffset+e.clientX-menuobj.offsetWidth else menuobj.style.left=ie5? document.body.scrollLeft+event.clientX : window.pageXOffset+e.clientX if (bottomedge<menuobj.offsetHeight) menuobj.style.top=ie5? document.body.scrollTop+event.clientY-menuobj.offsetHeight : window.pageYOffset+e.clientY-menuobj.offsetHeight else menuobj.style.top=ie5? document.body.scrollTop+event.clientY : window.pageYOffset+e.clientY menuobj.style.visibility="visible" return false } function hidemenuie5(e){ menuobj.style.visibility="hidden" } function highlightie5(e){ var firingobj=ie5? event.srcElement : e.target if (firingobj.className=="menuitems"||ns6&&firingobj.parentNode.className=="menuitems"){ if (ns6&&firingobj.parentNode.className=="menuitems") firingobj=firingobj.parentNode //up one node firingobj.style.backgroundColor="highlight" firingobj.style.color="yellow" if (display_url==1) window.status=event.srcElement.url } } function lowlightie5(e){ var firingobj=ie5? event.srcElement : e.target if (firingobj.className=="menuitems"||ns6&&firingobj.parentNode.className=="menuitems"){ if (ns6&&firingobj.parentNode.className=="menuitems") firingobj=firingobj.parentNode //up one node firingobj.style.backgroundColor="#3366FF" firingobj.style.color="#99FF00" window.status='' } } function jumptoie5(e){ var firingobj=ie5? event.srcElement : e.target if (firingobj.className=="menuitems"||ns6&&firingobj.parentNode.className=="menuitems"){ if (ns6&&firingobj.parentNode.className=="menuitems") firingobj=firingobj.parentNode if (firingobj.getAttribute("target")) window.open(firingobj.getAttribute("url"),firingobj.getAttribute("target")) else window.location=firingobj.getAttribute("url") } } if (ie5||ns6){ menuobj.style.display='' document.oncontextmenu=showmenuie5 document.onclick=hidemenuie5 } </script> <? } ?> So I took it out and the error then focuses on the "</script>" giving the same unexpected end error. Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted September 8, 2007 Share Posted September 8, 2007 echo "<font color=#FFCC33>   Mountain Time: </font>",$mtime What's the comma before $mtime? Should it be a dot? Quote Link to comment Share on other sites More sharing options...
Clinton Posted September 8, 2007 Author Share Posted September 8, 2007 Well it worked just fine with the comma, not sure why, but I changed it to a dot and it works like it did before. Can that affect what's going on with the placement of the ending curly bracket? Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted September 8, 2007 Share Posted September 8, 2007 my bad. i didn't realize that commas are a valid concatenation symbol for echo. i use dots because they work everywhere. i'll look some more. Quote Link to comment Share on other sites More sharing options...
Clinton Posted September 8, 2007 Author Share Posted September 8, 2007 No problem, thanks for your help. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted September 8, 2007 Share Posted September 8, 2007 dont forget to hit topic solved Quote Link to comment Share on other sites More sharing options...
Clinton Posted September 8, 2007 Author Share Posted September 8, 2007 I will but it's not solved. He said he was going to look at the code a little bit more. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted September 9, 2007 Share Posted September 9, 2007 oh and about the else thing you say it gives you "unexpected end", thats because you need an extra curly close bracket at the end so its like <?php if ($url) { ?> ///html <?php }else{ more code }; ?> Quote Link to comment Share on other sites More sharing options...
Clinton Posted September 9, 2007 Author Share Posted September 9, 2007 I do. My Code is: <? $db=mysql_connect ("localhost", "", "") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("anderse_inventory"); $rn=("SELECT Status FROM users WHERE username='" . $_SESSION['username']."'"); $rz=mysql_query($rn); while($row=mysql_fetch_array($rz)) { if($row["Status"]=="0"){ echo;("The Administrator has not yet approved your account. You will be notified when this occurs"); }else{ ?> HTML HERE <? } ?> And I am still getting that error Quote Link to comment Share on other sites More sharing options...
Clinton Posted September 9, 2007 Author Share Posted September 9, 2007 By the way, how do you get that pretty code box? Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted September 9, 2007 Share Posted September 9, 2007 make sute your <? syntax has php after the ? then highlight the code and hit the code button Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted September 9, 2007 Share Posted September 9, 2007 <?php $db=mysql_connect ("localhost", "", "") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("anderse_inventory"); $rn=("SELECT Status FROM users WHERE username='" . $_SESSION['username']."'"); $rz=mysql_query($rn); while($row=mysql_fetch_array($rz)) { if($row["Status"]=="0"){ echo;("The Administrator has not yet approved your account. You will be notified when this occurs"); }else{ ?> HTML HERE <?php }} ///keepadding curly close until it goes away ?> Quote Link to comment Share on other sites More sharing options...
Clinton Posted September 9, 2007 Author Share Posted September 9, 2007 You're the man. Thanks! Quote Link to comment 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.