Jump to content

Clinton

Members
  • Posts

    337
  • Joined

  • Last visited

Everything posted by Clinton

  1. You know, I wondered if it might have been something like that. Thanks a ton.
  2. Holy crap it worked! SELECT * FROM roster WHERE `Position`=<'4' and `Terminated`='0' ORDER BY Position What's the purpose of all the those weird dashes? (And how did you make them? Can't find them on my keyboard.)
  3. Interesting. I never thought about doing that but when I do I get an error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Terminated=0 ORDER BY Position DESC' at line 1 But if I do it the other way, Position, it works just fine. And yes, i'm not a complete idiot. ;-) LoL THe columns do exist. I've checked and rechecked my PHPAdmin and everything looks good.
  4. No I didn't but I just did and it didn't work either: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Terminated=0 ORDER BY Position DESC' at line 1
  5. Yea, it just created more of an error when I reversed it. I know it has to do with the whole Termination thing for the simple fact that it was working, the query, before I tried to add that.
  6. LoL. Wow. Same Error. I was seriously not expecting this to be that hard. :-\
  7. Still getting that same error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Terminated='0' ORDER BY Position' at line 1
  8. Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Terminated = '0' ORDER BY Position' at line 1 <? // connect to database include("inc/connect.php"); // include auth and nav include("inc/auth.php"); include("inc/nav.php"); ?> <? $rn=("SELECT * FROM users WHERE username='" . $_SESSION['username']."'"); $rz=mysql_query($rn); while($row=mysql_fetch_array($rz)) { if($row["Status"]=="0"){ echo ("<br>Have a great day! <a href='logout.php'>Close</a>"); }else{ ?> <center><h3>Explosive Personnel</h3></center> <? $q1=mysql_query("SELECT * FROM roster WHERE Position <= '4' AND Terminated = '0' ORDER BY Position") or die(mysql_error()); $q1rz=mysql_query($q1); while($row1 = mysql_fetch_array($q1rz)){ ?> <b><font color="orange" size="3"><? echo $row1['Name']; ?></font></b><br> <i><? echo $row1['Title']; ?></i><br> Cell: <? echo $row1['CellPhone']; ?> &nbsp &nbsp &nbsp Home: <? echo $row1['HomePhone']; ?><br> E-Mail: <a href=mailto:<? echo $row1['Email']; ?>><? echo $row1['Email']; ?></a><br> <? echo $row1['Notes']; ?><p> <? } ?> </body> </html> <? }} ?>
  9. Hey, I'm trying to run multiple WHERE statements in a single query but it's not working out. How would I do this? $q1=("SELECT * FROM roster WHERE (Position<='4' AND Terminated='0') ORDER BY Position");
  10. replace my now with your $timestamp. <?php $timestamp= $row['timestamp']; echo date('l jS F Y H:i:s', strtotime("$timestamp + 19 hour")); ?>
  11. Here's an example I use on my site: $ztime = date("H:i d-M-y", strtotime("now + 6 hour"));
  12. My bad: (This is also the page that's supposed to update the db) <? // connect to database include("inc/connect.php"); // include auth and nav include("inc/auth.php"); include("inc/nav.php"); ?> <? $rn=("SELECT * FROM users WHERE username='" . $_SESSION['username']."'"); $rz=mysql_query($rn); while($row=mysql_fetch_array($rz)) { if($row["Status"]=="0"){ echo ("<br>Have a great day! <a href='logout.php'>Close</a>"); }else{ ?> <?php //This code runs if the form has been submitted if (isset($_POST['submit'])) { //This makes sure they did not leave any fields blank if (!$_POST['password'] | !$_POST['password2'] | !$_POST['First'] | !$_POST['MI'] | !$_POST['Last'] | !$_POST['Email'] | !$_POST['Phone'] | !$_POST['CellPhone'] ) { die('You did not complete all of the required fields'); } // this makes sure both passwords entered match if ($_POST['password'] != $_POST['password2']) { die('Your passwords did not match. '); } // now we update the database $insert = "UPDATE users SET First = '".$_POST['First']."', MI = '".$_POST['MI']."', Last = '".$_POST['Last']."', Email = '".$_POST['Email']."', Phone = '".$_POST['Phone']."', CellPhone = '".$_POST['CellPhone']."', password = '".$_POST['password']."' WHERE username = '" . $_SESSION['username']."'"; $update = mysql_query($insert); ?> <h1>Done!</h1> <p>Thank you, you have successfully updated your information.</a>.</p> <?php } else { ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <p> <table border="0"> <tr><td>First Name:</td><td> <input type="text" name="First" maxlength="60" value="<? echo $row['First']; ?>"> </td></tr> <tr><td>Middle Initial:</td><td> <input type="text" name="MI" maxlength="60" value="<? echo $row['MI']; ?>"> </td></tr> <tr><td>Last Name:</td><td> <input type="text" name="Last" maxlength="60" value="<? echo $row['Last']; ?>"> </td></tr> <tr><td>E-mail:</td><td> <input type="text" name="Email" maxlength="100" value="<? echo $row['Email']; ?>"> </td></tr> <tr><td>Home Phone:</td><td> <input type="text" name="Phone" maxlength="60" value="<? echo $row['Phone']; ?>"> </td></tr> <tr><td>Cell Phone:</td><td> <input type="text" name="CellPhone" maxlength="60" value="<? echo $row['CellPhone']; ?>"> </td></tr> <tr><td>Username:</td><td> <? echo $row['username']; ?> </td></tr> <tr><td>Password:</td><td> <input type="password" name="password" maxlength="10" value="<? echo $row['password']; ?>"> </td></tr> <tr><td>Confirm Password:</td><td> <input type="password" name="password2" maxlength="10"> </td></tr> <tr><th colspan=2><input type="submit" name="submit" value="Update"></th></tr> </table> </form> <?php }}} ?>
  13. I did, it's four posts up. Logout.php
  14. It's not. They actually have to click logout to go to that page. It's not an include or passed from page to page.
  15. Yes. I have a logout.php page that kills the session. <? // logout.php // you must start session before destroying it session_start(); session_destroy(); echo "You have been successfully logged out. <br><br> You will now be returned to the login page. <META HTTP-EQUIV=\"refresh\" content=\"2; URL=index.php\"> "; ?>
  16. I mean that is kills the session. I have to login again to continue. auth was the one we were just working on. nav is the one I have on all my pages that basically contains all my navigation items. Here's nav <? $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> <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> <table border="0" width="100%"> <tr> <? $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("<td align=LEFT valign=TOP bgcolor=#000000>"); echo("Welcome, <br>"); echo(" ".$row["First"]); echo(" ".$row["MI"]); echo(". ".$row["Last"]."<br>"); echo("<font size=2><a href='logout.php'>Logout</a>&nbsp &nbsp <a href='options.php'>My Account</a></font>"); } ?> </td><td align=CENTER> <? $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"> <font size=4>Salt Lake City Explosive Division (8321)</font><br> <font color=green>3350 Directors Row, Suite 600 &nbsp Salt Lake City, UT &nbsp 84104-4585 &nbsp <br>Office: 801-908-5350 &nbsp Fax: 866-636-2629<br></font> <font color=green size=4>Pacific Time: </font><? echo $ptime;?> <font color=#FFCC33>&nbsp&nbsp Mountain Time: </font> <? echo $mtime;?> <font color=green>&nbsp&nbsp Central Time: </font> <? echo $ctime;?> <font color=green>&nbsp&nbsp Atlantic Time: </font> <? echo $atime;?> <font color=green>&nbsp&nbsp Zulu Time: </font> <? echo $ztime;?><br> </center> </td> </tr> </table> <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> <? }} ?>
  17. Got rid of the Array stuff at the top of the page but yea, still kicking me out. I can't remember a time when an UPDATE function gave me such a problem.
  18. Same thing happens except this show up at the top of the page now: Array ( [0] => 1 [iD] => 1 [1] => Clinton [First] => Clinton [2] => J [MI] => J [3] => Andersen [Last] => Andersen [4] => [Title] => [5] => binaryblaster@gmail.com => binaryblaster@gmail.com [6] => (801) 555-5555 [Phone] => (801) 555-5555 [7] => (801) 555-5555 [CellPhone] => (801) 555-5555 [8] => clintonandersen [username] => clintonandersen [9] => testing [password] => testing [10] => 2 [status] => 2 )
  19. I'm using an included. Auth. <? // start session session_start(); // convert username and password from _POST or _SESSION if($_POST){ $_SESSION['username']=$_POST["username"]; $_SESSION['password']=$_POST["password"]; } // query for a user/pass match $result=mysql_query("select * from users where username='" . $_SESSION['username'] . "' and password='" . $_SESSION['password'] . "'"); // retrieve number of rows resulted $num=mysql_num_rows($result); // print login form and exit if failed. if($num < 1){ echo "<br><br><br><br><br><center><b>Please login:</b><br> <font size='1'>Register <a href='inc/register.php'>Here</a></font><br><br> <form method=POST action=index.php> Username: <input type=text name=\"username\"><br> Password: <input type=password name=\"password\"><br><br> <input type=submit value=Login> </center></form>"; exit; } ?>
  20. With or without the parenthesis it still works the same, kills the session. It makes no sense because there is nothing that should kill the session.
  21. Somebody, anybody, tell me why?
  22. Are you sure because when I took it out I got: Parse error: syntax error, unexpected T_STRING in /home/anderse/public_html/NAIS/8321/options.php on line 43
  23. When I hit the update button it kicks me out (kills my session) and takes me to the login page instead of pointing out missing items or updating the fields. Any ideas? ??? <? // connect to database include("inc/connect.php"); // include auth and nav include("inc/auth.php"); include("inc/nav.php"); ?> <? $rn=("SELECT * FROM users WHERE username='" . $_SESSION['username']."'"); $rz=mysql_query($rn); while($row=mysql_fetch_array($rz)) { if($row["Status"]=="0"){ echo ("<br>Have a great day! <a href='logout.php'>Close</a>"); }else{ ?> <?php //This code runs if the form has been submitted if (isset($_POST['submit'])) { //This makes sure they did not leave any fields blank if (!$_POST['password'] | !$_POST['password2'] | !$_POST['First'] | !$_POST['MI'] | !$_POST['Last'] | !$_POST['Email'] | !$_POST['Phone'] | !$_POST['CellPhone'] ) { die('You did not complete all of the required fields'); } // this makes sure both passwords entered match if ($_POST['password'] != $_POST['password2']) { die('Your passwords did not match. '); } // now we update the database $insert = "(UPDATE users SET First = '".$_POST['First']."', MI = '".$_POST['MI']."', Last = '".$_POST['Last']."', Email = '".$_POST['Email']."', Phone = '".$_POST['Phone']."', CellPhone = '".$_POST['CellPhone']."', password = '".$_POST['password']."') WHERE username = '" . $_SESSION['username']."')"; $add_member = mysql_query($insert); ?> <h1>Done!</h1> <p>Thank you, you have successfully updated your information.</a>.</p> <?php } else { ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <p> <table border="0"> <tr><td>First Name:</td><td> <input type="text" name="First" maxlength="60" value="<? echo $row['First']; ?>"> </td></tr> <tr><td>Middle Initial:</td><td> <input type="text" name="MI" maxlength="60" value="<? echo $row['MI']; ?>"> </td></tr> <tr><td>Last Name:</td><td> <input type="text" name="Last" maxlength="60" value="<? echo $row['Last']; ?>"> </td></tr> <tr><td>E-mail:</td><td> <input type="text" name="Email" maxlength="100" value="<? echo $row['Email']; ?>"> </td></tr> <tr><td>Home Phone:</td><td> <input type="text" name="Phone" maxlength="60" value="<? echo $row['Phone']; ?>"> </td></tr> <tr><td>Cell Phone:</td><td> <input type="text" name="CellPhone" maxlength="60" value="<? echo $row['CellPhone']; ?>"> </td></tr> <tr><td>Username:</td><td> <? echo $row['username']; ?> </td></tr> <tr><td>Password:</td><td> <input type="password" name="password" maxlength="10" value="<? echo $row['password']; ?>"> </td></tr> <tr><td>Confirm Password:</td><td> <input type="password" name="password2" maxlength="10"> </td></tr> <tr><th colspan=2><input type="submit" name="submit" value="Update"></th></tr> </table> </form> <?php }}} ?>
  24. I'm trying to fill out a form with data pulled from a database. Look at the first entry for my form, the First Name. I have a PHP in the value section but it is not pulling down the data and inserting it. Not sure why. Any help would be appreciated. <? // connect to database include("inc/connect.php"); // include auth and nav include("inc/auth.php"); include("inc/nav.php"); ?> <? $rn=("SELECT * FROM users WHERE username='" . $_SESSION['username']."'"); $rz=mysql_query($rn); while($row=mysql_fetch_array($rz)) { if($row["Status"]=="0"){ echo ("<br>Have a great day! <a href='logout.php'>Close</a>"); }else{ ?> <?php } else { ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <p> <table border="0"> <tr><td>First Name:</td><td> <input type="text" name="First" maxlength="60" value="<?$row['First'] ?>"> </td></tr> <tr><td>Middle Initial:</td><td> <input type="text" name="MI" maxlength="60"> </td></tr> <tr><td>Last Name:</td><td> <input type="text" name="Last" maxlength="60"> </td></tr> <tr><td>E-mail:</td><td> <input type="text" name="Email" maxlength="100"> </td></tr> <tr><td>Home Phone:</td><td> <input type="text" name="Phone" maxlength="60"> </td></tr> <tr><td>Cell Phone:</td><td> <input type="text" name="CellPhone" maxlength="60"> </td></tr> <tr><td>Username:</td><td> <input type="text" name="username" maxlength="60"> </td></tr> <tr><td>Password:</td><td> <input type="password" name="password" maxlength="10"> </td></tr> <tr><td>Confirm Password:</td><td> <input type="password" name="password2" maxlength="10"> </td></tr> <tr><th colspan=2><input type="submit" name="submit" value="Register"></th></tr> </table> </form> <?php }}} ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.