Jump to content

derekbelcher

Members
  • Posts

    70
  • Joined

  • Last visited

Everything posted by derekbelcher

  1. Thanks everyone. I just didn't have my quotes in the right place.
  2. I have a table that displays the name, some info, and an email address of all members. This is done in php with a sql database. What I want to do is make the information that is stored in the email field linkable (like a mailto: in html). Here is the code that is used to display that info: echo "<td><div align='center'>" . $row['email'] . "</td>"; What do I need to add so that it becomes a clickable link capable of emailing? Thanks.
  3. What an idiot! I had it on checklogin, but not on the success page. Too funny! thanks,
  4. Hello. I am having trouble getting my session to work in php. I have a login page that sends the username and password to a "checklogin" page. Here I have code that sets the session if the right credentials are submitted: if($count==1){ // Register $myusername, $mypassword and redirect $_SESSION['myusername']=$myusername; $_SESSION['mypassword']=$mypassword; // Redirect to appropriate admin page while($row=mysql_fetch_assoc($result)){ $adminpage=$row['admin_redirect']; } header("location:$adminpage"); } else { header("location:adminLoginError.php"); } On the successful login page I have this code: <?php if(!isset($_SESSION['myusername'])) { header("location:adminLogin.php"); } ?> For some reason I am not getting to the success page. When you enter the username and password you just get a new login page. I am assuming that it is not recognizing a registered Session. If I remove the (!) from before isset, then it works fine, but I know that it is not checking the username and password. Help please!
  5. I am trying to display the first and last name of the person that is logged into my site. I am using the following Code to try to do this. Can someone point out what I am missing as nothing is displayed (first / last name) when you log in. It worked when I was using session_is_registered, but I was told that I should get away from that and use $_SESSION. Thanks for any info... Code: <? ini_set("session.cookie_lifetime", "60"); session_save_path(); session_start(); if (isset($_SESSION['myusername'])) { header("location:officerLogin.php"); } ?> <?php $host="localhost"; // Host name $username="athens"; // Mysql username $password="avfd1179"; // Mysql password $db_name="athens_officerArea"; // Database name $tbl_name="officers"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); ?> <html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Officer's Area</title></head> <body> <table cellpadding="0" cellspacing="0" width="688" height="583" align="center"> <!--DWLayoutTable--> <!-- MSTableType="layout" --> <tr> <td height="19" colspan="3" valign="top">Welcome <b><?PHP $firstname = $_POST['firstname'] ; $lastname = $_POST['lastname'] ; $user = $_POST['username'] ; $sql = "SELECT * FROM `officers` WHERE username = '".$user."'"; $result = mysql_query($sql) ; while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $dbfname = $row['firstname'] ; $dblname = $row['lastname'] ; $dbuser = $row['username'] ; } echo "$dbfname $dblname" ; ?></b></td> </tr> <tr> <td height="80" colspan="3" valign="top"> <p style="margin-top: 0; margin-bottom: 0"> <font face="georgia, bookman old style, palatino linotype, book antiqua, palatino, trebuchet ms, helvetica, garamond, sans-serif, arial, verdana, avante garde, century gothic, comic sans ms, times, times new roman, serif"> <i><font size="4">When a man becomes a fireman his greatest act of bravery has been accomplished. What he does after that is all in the line of work. ~Edward F. Croker</font></i><br> </font></td> </tr> <tr> <td width="479" height="130" valign="top" bordercolor="#000080" style="border-style: double; border-width: 5px; padding: 1px"><p>Evaluations are now available. To complete the evaluation packet, <a href="http://www.surveymonkey.com/s.aspx?sm=yucw0wu1q3O1I_2b18iRUtug_3d_3d">Click Here</a> The Password is: <strong>ffeval09</strong></p> <p>This evaluations will be available until March 20, 2009. Please complete before that date. </p></td> <td width="2" rowspan="4" valign="top"> <!-- MSCellType="empty" --> </td> <td width="199" rowspan="4" valign="top"> <table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%"> <!-- MSCellFormattingTableID="1" --> <tr> <td bgcolor="#FF0000" colspan="3" height="2"> <img alt="" width="1" height="2" src="../images/MsSpacer.gif"></td> </tr> <tr> <td bgcolor="#FF0000" width="2"> <img alt="" width="2" height="1" src="../images/MsSpacer.gif"></td> <td valign="top" width="100%"> <!-- MSCellFormattingType="content" --> <p align="center" style="margin-top: 0; margin-bottom: 0"> <font size="4" color="#FF0000">News and such...</font></p> <hr> <p align="center" style="margin-top: 0; margin-bottom: 0"> <font size="4">Don't forget to complete your evaluations by March 20, 2009 </font></p> <hr> <p align="center" style="margin-top: 0; margin-bottom: 0"> </p> <p align="center" style="margin-top: 0; margin-bottom: 0"> <font size="4">We are starting strong with the Relay for Life with several ideas in the planning process. We have set a goal of $3,000 this year and we need as much participation as possible to help us reach that goal. </font></p> <p align="center" style="margin-top: 0; margin-bottom: 0"> </p> <hr> <p align="center" style="margin-top: 0; margin-bottom: 0"> </p> <p></td> <td bgcolor="#FF0000" height="100%" width="2"> <img alt="" width="2" height="1" src="../images/MsSpacer.gif"></td> </tr> <tr> <td bgcolor="#FF0000" colspan="3" height="2"> <img alt="" width="1" height="2" src="../images/MsSpacer.gif"></td> </tr> </table> </td> </tr> <tr> <td height="22" valign="top" bgcolor="#FFFFFF"> </td> </tr> <tr> <td height="40" bordercolor="#FF0000" bgcolor="#FFFF00" style="border-style: solid; border-width: 1px; padding-top: 1px; padding-bottom: 1px"> <p align="center"><font size="5" color="#800000"><b>Training Info...</b></font></td> </tr> <tr> <td height="224" valign="top" bordercolor="#FF0000" bgcolor="#C0C0C0" style="border-style: solid; border-width: 1px; padding-top: 1px; padding-bottom: 1px"> <blockquote> <p align="left">Training is progressing. Brian has implemented a new training calendar, and we have had decent turn out each Thursday. All officers are encouraged to attend each training session as this shows leadership and committment to the firefighters. </p> <p align="left"><a href="officer_memberfiles.htm">Officer Memberfiles </a></p> <p align="left"> </p> </blockquote> </td> </tr> <tr> <td height="19"> </td> <td> </td> <td> </td> </tr> <tr> <td height="42" colspan="3" align="center" valign="top"><a href="logout.php">Log Out of Officers Area </a></td> </tr> <tr> <td height="68"> </td> <td> </td> <td> </td> </tr> </table> </body> </html>
  6. Still didn't work. It's just blank where the name should be appearing. How do I define the $_SESSION variable you mentioned? Sorry, very new to some of this.
  7. thank you. Now next question: I had this code which output the first and last name of the person with the user id that was used at login, and now it won't work. It worked with session_is_registered, but not with the new $_SESSION. <?PHP $firstname = $_POST['firstname'] ; $lastname = $_POST['lastname'] ; $user = $_POST['username'] ; $sql = "SELECT * FROM `officers` WHERE username = '{$_SESSION['myusername']}'" ; $result = mysql_query($sql) ; while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $dbfname = $row['firstname'] ; $dblname = $row['lastname'] ; $dbuser = $row['username'] ; } echo "$dbfname $dblname" ; ?>
  8. I am trying to switch from the antique code to what is recognized today. Previous code that worked fine: if(!session_is_registered(myusername)){ header("location: and so on. What I want to use is $_SESSION. I tried this: if($_SESSION[(myusername)]{ header("location: and so on. Can someone help me find the error of my way :-) Thanks.
  9. Alright...changed the session_is_registered. Give it a try if you would like to: Go to: http://www.mercercountyfa.org/stationAdmin/adminLogin.php Username: admin Password: 12345 Here is the code for the page you get when you login successfully: <?php session_start(); if($_SESSION['myusername']){ header("location:adminLogin.php"); } ini_set("session.cookie_lifetime", "60") ?> <?php $host="localhost"; // Host name $username="p2r71184"; // Mysql username $password="692134a"; // Mysql password $db_name="p2r71184_regMembers"; // Database name $tbl_name="MEMBERS"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title></head> <body> <table width="500" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC"> <!--DWLayoutTable--> <tr> <td height="44" colspan="3" valign="top"><p>Welcome <b> <?php $firstname = $_POST['firstname'] ; $lastname = $_POST['lastname'] ; $user = $_POST['username'] ; $sql = "SELECT * FROM `MEMBERS` WHERE username = '{$_SESSION['myusername']}'" ; $result = mysql_query($sql) ; while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $dbfname = $row['firstname'] ; $dblname = $row['lastname'] ; $dbuser = $row['username'] ; } echo "$dbfname $dblname" ; ?></b><br /> <img src="../images/admin/admin_title.gif" width="501" height="44" /></p> </td> </tr> <tr> <td width="14" height="59"></td> <td width="473" valign="top">This admin area will allow you to manage your firefighter roster, your photogallery, and your message board. All changes become active when submitted. If you have problems with this site, please contact the webmaster. </td> <td width="14"></td> </tr> <tr> <td height="15"></td> <td></td> <td></td> </tr> <tr> <td height="186"></td> <td align="center" valign="top" bgcolor="#FFFFFF"><p><br /> <a href="addMember.php"><img src="../images/stationAdmin/roster_buton.gif" width="305" height="48" border="0" /></a><br /> <img src="../images/stationAdmin/photo_button.gif" width="305" height="48" /><br /> <img src="../images/stationAdmin/message_button.gif" width="305" height="48" /></p></td> <td></td> </tr> <tr> <td height="19" colspan="3" valign="top"><div align="center"><a href="logout.php">Log Out of Admin Area </a></div></td> </tr> </table> </body> </html>
  10. alright, i changed the session_register to $_SESSION. That worked. Now I can get to the "successful login page", however, the errors are still there at the top of the page. It is finding a problem with the line that has this on it: session_start() I checked the spaces and additional characters and found none. This is frustrating because I didn't change anything from last week and it worked fine then. Here is the complete code for the successful login page: <? session_start(); if(!session_is_registered(myusername)){ header("location:adminLogin.php"); } ini_set("session.cookie_lifetime", "60") ?> <?php $host="localhost"; // Host name $username="p2r71184"; // Mysql username $password="692134a"; // Mysql password $db_name="p2r71184_regMembers"; // Database name $tbl_name="MEMBERS"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title></head> <body> <table width="500" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC"> <!--DWLayoutTable--> <tr> <td height="44" colspan="3" valign="top"><p>Welcome <b><?PHP $firstname = $_POST['firstname'] ; $lastname = $_POST['lastname'] ; $user = $_POST['username'] ; $sql = "SELECT * FROM `MEMBERS` WHERE username = '{$_SESSION['myusername']}'" ; $result = mysql_query($sql) ; while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $dbfname = $row['firstname'] ; $dblname = $row['lastname'] ; $dbuser = $row['username'] ; } echo "$dbfname $dblname" ; ?></b><br /> <img src="../images/admin/admin_title.gif" width="501" height="44" /></p> </td> </tr> <tr> <td width="14" height="59"></td> <td width="473" valign="top">This admin area will allow you to manage your firefighter roster, your photogallery, and your message board. All changes become active when submitted. If you have problems with this site, please contact the webmaster. </td> <td width="14"></td> </tr> <tr> <td height="15"></td> <td></td> <td></td> </tr> <tr> <td height="186"></td> <td align="center" valign="top" bgcolor="#FFFFFF"><p><br /> <a href="addMember.php"><img src="../images/stationAdmin/roster_buton.gif" width="305" height="48" border="0" /></a><br /> <img src="../images/stationAdmin/photo_button.gif" width="305" height="48" /><br /> <img src="../images/stationAdmin/message_button.gif" width="305" height="48" /></p></td> <td></td> </tr> <tr> <td height="19" colspan="3" valign="top"><div align="center"><a href="logout.php">Log Out of Admin Area </a></div></td> </tr> </table> </body> </html>
  11. I recently added a line of php code to a checklogin page and am getting some weird error: Warning: session_register() [function.session-register]: open(/home/edlegs/tmp/sess_bc52abb2dba095cba858e0238af95f35, O_RDWR) failed: Permission denied (13) in /home/p2r71184/public_html/admin/checklogin.php on line 59 Warning: session_register() [function.session-register]: Cannot send session cookie - headers already sent by (output started at /home/p2r71184/public_html/admin/checklogin.php:59) in /home/p2r71184/public_html/admin/checklogin.php on line 59 Warning: session_register() [function.session-register]: Cannot send session cache limiter - headers already sent (output started at /home/p2r71184/public_html/admin/checklogin.php:59) in /home/p2r71184/public_html/admin/checklogin.php on line 59 Warning: Cannot modify header information - headers already sent by (output started at /home/p2r71184/public_html/admin/checklogin.php:59) in /home/p2r71184/public_html/admin/checklogin.php on line 63 Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0 Warning: Unknown: open(/home/edlegs/tmp/sess_bc52abb2dba095cba858e0238af95f35, O_RDWR) failed: Permission denied (13) in Unknown on line 0 Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0 Any ideas?
  12. I am building a website content management system that will be used by 10 different admins. I want to store all 10 admins login information in the same table. What code can I use in the checklogin page that will redirect the user based on their login information. An example would be if User 1 was only to be the admin for Area 1. My initial thought was to give each admin a unique ID within the table. And then write some kind of code that checks for that ID and sends that user to the appropriate "Successful Login Page" Problem is, I don't know what code to use, or if this is how you would go about this at all. Thanks for your help
  13. Hello. I am building a tool for users to enter their roster of members and submit that to the members database. I can do it for one entry at a time, but I want to be able to allow the user to enter all the members on one form and submit them all at one time. Here is my code so far... <?php if ($HTTP_POST_VARS['submit']) { mysql_connect("Localhost","p2r71184","692134a"); mysql_select_db("p2r71184_regMembers"); $unit=$HTTP_POST_VARS['unit']; $firstname=$HTTP_POST_VARS['firstname']; $lastname=$HTTP_POST_VARS['lastname']; $rank=$HTTP_POST_VARS['rank']; $email=$HTTP_POST_VARS['email']; $query ="INSERT INTO yourmembers (unit,firstname,lastname,rank,email)"; $query.=" VALUES ('$unit','$firstname','$lastname','$rank','email')"; $result=mysql_query($query); if ($result) echo "<b>Your members have been uploaded successfully!</b>"; else echo "<b>ERROR: There was a problem uploading, please try again!</b>"; } ?> <H1>Member Roster</H1> <form method="post" action="addMember.php"> <table width="600" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000"> <tr> <td bgcolor="#FFFF00"><div align="center">Unit </div></td> <td bgcolor="#FFFF00"><div align="center">First Name </div></td> <td bgcolor="#FFFF00"><div align="center">Last Name </div></td> <td bgcolor="#FFFF00"><div align="center">Rank</div></td> <td bgcolor="#FFFF00"><div align="center">Email Address </div></td> </tr> <tr> <td> <div align="center"> <input name="unit" type="text" size="4"> </div></td> <td><div align="center"> <input name="firstname" type="text" size="30"> </div></td> <td><div align="center"> <input name="lastname" type="text" size="30"> </div></td> <td><div align="center"> <input name="rank" type="text" size="30"> </div></td> <td><div align="center"> <input name="email" type="text" size="45"> </div></td> </tr> <tr> <td><div align="center"> <input name="unit2" type="text" size="4"> </div></td> <td><div align="center"> <input name="firstname2" type="text" size="30"> </div></td> <td><div align="center"> <input name="lastname2" type="text" size="30"> </div></td> <td><div align="center"> <input name="rank2" type="text" size="30"> </div></td> <td><div align="center"> <input name="email2" type="text" size="45"> </div></td> </tr> <tr> <td><div align="center"> <input name="unit3" type="text" size="4"> </div></td> <td><div align="center"> <input name="firstname3" type="text" size="30"> </div></td> <td><div align="center"> <input name="lastname3" type="text" size="30"> </div></td> <td><div align="center"> <input name="rank3" type="text" size="30"> </div></td> <td><div align="center"> <input name="email3" type="text" size="45"> </div></td> </tr> <tr> <td><div align="center"> <input name="unit" type="text" size="4"> </div></td> <td><div align="center"> <input name="firstname" type="text" size="30"> </div></td> <td><div align="center"> <input name="lastname" type="text" size="30"> </div></td> <td><div align="center"> <input name="rank" type="text" size="30"> </div></td> <td><div align="center"> <input name="email" type="text" size="45"> </div></td> </tr> <tr> <td><div align="center"> <input name="unit" type="text" size="4"> </div></td> <td><div align="center"> <input name="firstname" type="text" size="30"> </div></td> <td><div align="center"> <input name="lastname" type="text" size="30"> </div></td> <td><div align="center"> <input name="rank" type="text" size="30"> </div></td> <td><div align="center"> <input name="email" type="text" size="45"> </div></td> </tr> <tr> <td><div align="center"> <input name="unit" type="text" size="4"> </div></td> <td><div align="center"> <input name="firstname" type="text" size="30"> </div></td> <td><div align="center"> <input name="lastname" type="text" size="30"> </div></td> <td><div align="center"> <input name="rank" type="text" size="30"> </div></td> <td><div align="center"> <input name="email" type="text" size="45"> </div></td> </tr> <tr> <td><div align="center"> <input name="unit" type="text" size="4"> </div></td> <td><div align="center"> <input name="firstname" type="text" size="30"> </div></td> <td><div align="center"> <input name="lastname" type="text" size="30"> </div></td> <td><div align="center"> <input name="rank" type="text" size="30"> </div></td> <td><div align="center"> <input name="email" type="text" size="45"> </div></td> </tr> <tr> <td><div align="center"> <input name="unit" type="text" size="4"> </div></td> <td><div align="center"> <input name="firstname" type="text" size="30"> </div></td> <td><div align="center"> <input name="lastname" type="text" size="30"> </div></td> <td><div align="center"> <input name="rank" type="text" size="30"> </div></td> <td><div align="center"> <input name="email" type="text" size="45"> </div></td> </tr> <tr> <td><div align="center"> <input name="unit" type="text" size="4"> </div></td> <td><div align="center"> <input name="firstname" type="text" size="30"> </div></td> <td><div align="center"> <input name="lastname" type="text" size="30"> </div></td> <td><div align="center"> <input name="rank" type="text" size="30"> </div></td> <td><div align="center"> <input name="email" type="text" size="45"> </div></td> </tr> <tr> <td><div align="center"> <input name="unit" type="text" size="4"> </div></td> <td><div align="center"> <input name="firstname" type="text" size="30"> </div></td> <td><div align="center"> <input name="lastname" type="text" size="30"> </div></td> <td><div align="center"> <input name="rank" type="text" size="30"> </div></td> <td><div align="center"> <input name="email" type="text" size="45"> </div></td> </tr> <tr> <td><div align="center"> <input name="unit" type="text" size="4"> </div></td> <td><div align="center"> <input name="firstname" type="text" size="30"> </div></td> <td><div align="center"> <input name="lastname" type="text" size="30"> </div></td> <td><div align="center"> <input name="rank" type="text" size="30"> </div></td> <td><div align="center"> <input name="email" type="text" size="45"> </div></td> </tr> <tr> <td><div align="center"> <input name="unit" type="text" size="4"> </div></td> <td><div align="center"> <input name="firstname" type="text" size="30"> </div></td> <td><div align="center"> <input name="lastname" type="text" size="30"> </div></td> <td><div align="center"> <input name="rank" type="text" size="30"> </div></td> <td><div align="center"> <input name="email" type="text" size="45"> </div></td> </tr> <tr> <td><div align="center"> <input name="unit" type="text" size="4"> </div></td> <td><div align="center"> <input name="firstname" type="text" size="30"> </div></td> <td><div align="center"> <input name="lastname" type="text" size="30"> </div></td> <td><div align="center"> <input name="rank" type="text" size="30"> </div></td> <td><div align="center"> <input name="email" type="text" size="45"> </div></td> </tr> <tr> <td><div align="center"> <input name="unit" type="text" size="4"> </div></td> <td><div align="center"> <input name="firstname" type="text" size="30"> </div></td> <td><div align="center"> <input name="lastname" type="text" size="30"> </div></td> <td><div align="center"> <input name="rank" type="text" size="30"> </div></td> <td><div align="center"> <input name="email" type="text" size="45"> </div></td> </tr> </table> <p align="left"> <input type="submit" name="submit" value="Submit Roster">
  14. That worked out just perfect! You mentioned something about displaying a message asking the user if they were sure they wanted to delete that record. How hard is it to do that.
  15. alright. That's awesome and I think right where I need to be. Now, here comes my "newbieness" what should my delete.php have in it. I am just starting to learn some of the different functions, but haven't used the GET one yet. Thanks for your help.
  16. I am trying to build a simple content management system and am not real sure where to go. I have the code (below) that displays my table contents. Works great! What I want to do is make that "delete" word clickable and execute a delete function of that row's data. <?php $result = mysql_query("SELECT * FROM admin"); echo "<table border='1'> <tr> <th>First Name</th> <th>Last Name</th> <th>Email Address</th> <th>DELETE USER</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['firstname'] . "</td>"; echo "<td>" . $row['lastname'] . "</td>"; echo "<td>" . $row['email'] . "</td>"; echo "<td align='center'>" . delete; echo "</tr>"; } echo "</table>"; mysql_close($con); ?>
  17. o.k. I'm an idiot. For real. I wasn't putting the "die" statement in the right place. I read the post again and realized that....I'm an idiot. When I put the "die" in, guess what????? I didn't select the flippin' database. Great tips though that I will use in the future. I absolutely love PHP...love this site cause there are some real "professional" attitudes and help here. Thanks everyone...until next time!
  18. Thanks...Here is what I have changed based on the comments: I added a comma after description $query ="SELECT title, description,"; Then I changed the date to entrydate $query.="DATE_FORMAT(entrydate, '%M %d, %Y') AS entrydate"; The addition of "or die..." caused a parse error... As you can tell, I am a little new to this and learning as I go... Still get the same error though...it is something with this line (14) mysql_fetch_row($result)) { Thanks
  19. I'm getting this error: Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/p2r71184/public_html/weblog.php on line 14 For this code: <?php mysql_connect("Localhost","p2r71184","692134a"); mysql_select_db("p2r71184"); $query ="SELECT title, description"; $query.=" DATE_FORMAT(entrydate, '%M %d, %Y') AS date"; $query.=" FROM upcoming ORDER BY entrydate DESC LIMIT 5"; $result= mysql_query($query); while (list($title,$description,$entrydate) = mysql_fetch_row($result)) { echo "<dt><b>$title ($entrydate)</b></dt>"; echo "<dd>$description</dd>"; } ?> Not sure what I'm missing. I have done this before and it worked, but I'm missing something. Please help ???
  20. I did it!!! Thanks for all your help. I used the following: $sql = "SELECT * FROM `officers` WHERE username = '{$_SESSION['myusername']}'" It was the Session that was throwing me off... Thanks again!
  21. O.K. I am learning here...I think I understand a little more about what my code is doing: In my SELECT * FROM `TABLE NAME` WHERE username (that is the column heading) = something. This is where I am getting stuck. I want username to = all the names in that column. Then I want some code that checks to see which user is logged in (based on username) and displays the real name associated with that username. In my table, I have a column that has usernames (e.g. dbelcher) and for dbelcher, on the same line, there is a first name listed under the column heading firstname. Does this make any since?
  22. I am still searching for an answer here. Just in case anyone happened by this post. No Rush...Thanks for everyone's help...this is an awesome resource
  23. The problem in my code appears to be with the: $sql = "SELECT * FROM `officers`" If I enter this line, then I get an output of the last row in the table regardless of what username is used to login. When I try to add the WHERE information I get an error. I am really not sure what I need to do to fix this. I tried to use: WHERE username = $_POST['myusername'], but that didn't work either. I would be happy to email the code to someone if that would help. Thanks.
  24. This all makes since, but when I put the code in, I get: Welcome Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/athens/public_html/Officers Area/officer_index.php on line 72 , Was there anything in the code above that I should have changed to be specific with my database? This all seems to make since, but I am not sure how to trouble shoot errors like the one above. Thanks for your help!!!
  25. Still not sure what I am missing here. Anyone have any ideas? ???
×
×
  • 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.