Jump to content

dmcdaniel

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Everything posted by dmcdaniel

  1. Maybe I didn't clarify properly. Sorry about that. What I want to do is this: Basically, create an internal mailer of sorts. I have a form that places info into a database and places a 0 in the read box (this signifies unread). My first page shows all of the unread messages. Where the message_id is located, I want to create a link to another page so that it ONLY brings up that one message from the database. Is this possible to do in php and mysql?
  2. Im fairly new to PHP and have a quick question. I am creating a mail system from scratch and I have two main SQL rows, ID and read. I need to put a link around the ID so that it only pops up in a pop up window that message. This is the coding I have so far, feel free to point out where I have gone wrong: <? include('../config/config.php'); $Query = sprintf("SELECT * FROM qa LEFT JOIN EmployeeInfo ON(qa.Agentsname = EmployeeInfo.Name) WHERE EmployeeInfo.Name LIKE '%s'", mysql_real_escape_string($_SESSION['SESS_NAME'])); $result = mysql_query($Query); $num_rows = mysql_num_rows($result); echo "<table border='0' cellspacing='10' cellpadding='10'>"; echo "<tr>"; echo "<td><strong>Message ID</strong></td><td><strong>Team Lead</strong></td><td><strong>Unread/Read</strong></td><td><strong>Score</strong></td>"; while($row = mysql_fetch_array($result)) { echo "<tr><td><a href='http://10.0.11.5/form/employees/attendance/qaview.php?id='". $row['ID'] . ">" . $row['ID'] . "</a></td><td>" . $row['Name'] . "</td><td>" . $row['read'] . "</td><td>" . $row['Score'] . "</td></tr>"; } echo "</table>"; ?> and this is the qaview.php page <? include('../config/config.php'); $query = doquery("SELECT * FROM qa WHERE ID='$ID'"); $update_query=doquery("UPDATE qa SET read='1' WHERE ID='$ID'"); $row = mysql_fetch_array($query); echo "<td><strong>" . $row['Name'] . "</strong></td></tr>"; ?>
  3. You sir, Are absolutely amazing! Thank you very much for your help! Thank you thank you thank you thank you!
  4. We here personally use Ubuntu Server for multiple reasons. Low cpu usage (text based), easy to use, Debian based. Highly recommend installing LAMP and webmin as well as locking down your firewall to prevent unauthorized access.
  5. Yes it is good. As long as you keep your Title to 60 characters (or under), google will read it. Also, in your title, do NOT use - as that signifies a break. Instead, use a | and you want to use keywords in your title. For example, one that we have written recently looks like this: Call Center Services | Call Center Answering | Call Center
  6. I am having a bit of trouble here. I will explain what I am trying to do: I am trying to pull the Field Name: Account into my input form. My input form code looks like this: Account Number: <input type="text" value="<?php echo($Account); ?>" name="Account"/> My PHP code above this looks like this: <?php @ $db = mysql_connect("localhost", "usr", "pass"); mysql_select_db("EmployeeInfo"); $sQuery = sprintf("SELECT * FROM EmployeeInfo WHERE EmployeeInfo.Name LIKE '%s'", mysql_real_escape_string($_POST['NameSelect'])); $result = mysql_query($sQuery); $actualResult = mysql_fetch_array($result); echo $actualResult['aSQLRow']; ?> My select query works properly. Can anyone find my error because I sure can't Thanks in advance, dmcdaniel
  7. I tried using a LIKE statement but that didn't work either. Not sure if it is something in my view.php code from the form but I created a select query and gave it the name NameSelect so it should all be working properly. Not Sure why its not. Maybe if I pull the NameSelect into a variable. I will give that a shot and see.
  8. I am having a problem with my PHP/MySQL coding and I can not figure out what I am doing wrong. I have two tables in a database. One called EmployeeInfo and another called Absence. In the Employee Info table, I have two employees, Derek and Adrian. In the Absence table, I have two records, One for Derek and Adrian. Goal: Using PHP/MySQL, I want to call upon an employee using a form and display that person's absence. The form pulls up correctly. If I do NOT put a WHERE clause into my SQL statement, it pulls up all the absences perfectly fine. Once I put in the WHERE = EmployeeInfo.Name = 'NameSelect' then it fails every time. Here is my SQL Coding: $result = mysql_query("SELECT * FROM Absence LEFT JOIN EmployeeInfo ON(Absence.Account = EmployeeInfo.Account) WHERE EmployeeInfo.Name='NameSelect'"); Any help is greatly appreciated.
  9. Yeah, I noticed that so I removed it. That didn't fix it either. Maybe if I explain further. I have two tables, EmployeeInfo and Abscence. Inside of both of those tables, I have a field called Account (This is a Primary key). I need to link both of the Account fields inside EmployeeInfo and Absence so I only pull the correct absence dates for that employee and not everyones. Hope that gives enough information
  10. Thanks. That worked for me. This is my new coding: <?php @ $db = mysql_connect("localhost", "root", "markscott"); mysql_select_db("EmployeeInfo"); $strSQL = "SELECT * FROM EmployeeInfo, Absence ORDER BY Name WHERE Name='NameSelect'"; ?> Your are now viewing the Attendance sheet for <strong><?php echo $_POST["NameSelect"]; ?></strong>!<br /><br /><br /> <?php $result = mysql_query("SELECT AbsDate FROM 'EmployeeInfo', Absence WHERE Absence.Account = EmployeeInfo.Account"); echo "<table border='1'> <tr> <th>Absence Date < 1 Year</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['AbsDate'] . "</td>"; echo "</tr>"; } echo "</table>"; I am now having problems with this part of the code here: <?php $result = mysql_query("SELECT AbsDate FROM 'EmployeeInfo', Absence WHERE Absence.Account = EmployeeInfo.Account"); echo "<table border='1'> <tr> <th>Absence Date < 1 Year</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['AbsDate'] . "</td>"; echo "</tr>"; } echo "</table>"; If I take away the link, it works properly, however, I need to have the link in there so I make sure I only get the correct absences for the correct person. Without the link, it just displays them all. I have checked my syntax, it looks correct. I have checked my tables, they are correct. Not exactly sure what I am doing wrong.
  11. So I can't quite get it to work for me. This is the code I have in my two files. view.php (This is used to select the employee) <center> <form onsubmit="return validateForm()" name="frmRequest" action="attendance.php" method="post" encytype="multipart/form-data"> Which employee would you like? <select name="NameSelect"> <? @ $db = mysql_connect("localhost", "dbuser", "dbpass"); mysql_select_db("EmployeeInfo"); $strSQL = "SELECT Name FROM EmployeeInfo ORDER BY Name"; $rs = mysql_query($strSQL); $nr = mysql_num_rows($rs); for ($i=0; $i<$nr; $i++) { $r = mysql_fetch_array($rs); echo "<OPTION VALUE=\"".$r["Name"]."\">".$r["Name"]."</OPTION>"; } ?> </select> <input type="submit" class="submit" value="Submit" /> </form> </center> This is my attendance.php file (used to display the employee name only for the time being <?php @ $db = mysql_connect("localhost", "dbuser", "dbpass"); mysql_select_db("EmployeeInfo"); $strSQL = "SELECT Name FROM EmployeeInfo ORDER BY Name"; ?> Welcome <?php echo $_POST["NameSelect"]; ?>!<br /> What am I doing wrong?
  12. Thanks. I am using the W3schools.com tutorial for learning php and I think I just found that spot. Thanks again.
  13. I don't know that the subject describes exactly what I want to do so I will explain it as best as I can. I have a form that uses a select box to pull all the names of our employees from the database. I then have a submit button that opens up a page. The code from my view.php is as follows: <form onsubmit="return validateForm()" name="frmRequest" action="attendance.php" method="post" encytype="multipart/form-data"> Which employee would you like? <select> <? @ $db = mysql_connect("localhost", "db_user", "db_pass"); mysql_select_db("EmployeeInfo"); $strSQL = "SELECT Name FROM EmployeeInfo ORDER BY Name"; $rs = mysql_query($strSQL); $nr = mysql_num_rows($rs); for ($i=0; $i<$nr; $i++) { $r = mysql_fetch_array($rs); echo "<OPTION VALUE=\"".$r["Name"]."\">".$r["Name"]."</OPTION>"; } ?> </select> <input type="submit" class="submit" value="Submit" /> </form> On the attendance.php form, I need it to display that user that was pulled from the form on the page before. What would be the best way to do this? I am fairly new to PHP and i'm at a loss right now. Thanks, dmcdaniel
  14. Hello Everyone, I am trying to add a PHP Time Stamp to my MySQL database. Anyone have any ideas? When the person hits Submit - I want DD/MM/YYYY HH:MM:SS to go into the database. What would be the best option? Thank you, DMcDaniel
  15. Thanks. I fixed my issue but the closing tag was on a different echo line
  16. I tried to remove the counters but it made the formatting even worse. This is the new coding I tried: <?php header("Cache-control: private"); header("Expires: 0"); session_start(); include('database.php'); $q = mysql_query("SELECT strName, strEmail, strFirstDay, strFirstDayDate, strLastDay, strLastDayDate FROM Vacation") or die(mysql_error()); $x=0; echo" <table> <tr> <th>Requests</th>"; while($row = mysql_fetch_array($q)){ extract($row); echo "<td>$strName, $strEmail, $strFirstDay, $strFirstDayDate, $strLastDay, $strLastDayDate</td>"; } ?>
  17. I have the following Code: <?php header("Cache-control: private"); header("Expires: 0"); session_start(); include('database.php'); $q = mysql_query("SELECT strName, strEmail, strFirstDay, strFirstDayDate, strLastDay, strLastDayDate FROM Vacation") or die(mysql_error()); $x=0; echo" <table> <tr> <th>Requests</th>"; while($row = mysql_fetch_array($q)){ extract($row); if ($x==0){ echo "</tr><tr>"; } $x++; if ($x == 3){ $x = 0; } echo "<td>$strName, $strEmail, $strFirstDay, $strFirstDayDate, $strLastDay, $strLastDayDate</td>"; } echo"</tr></table>"; ?> It formats it quite ugly. Right now it just formats it as: Results Derek McDaniel, dmcdaniel@maximumcomm.com, Monday, 05/03/2010, Tuesday, 05/04/2010 Derek McDaniel, dmcdaniel@maximumcomm.com, Monday, 05/03/2010, Tuesday, 05/04/2010 Mark Slatter, mslatter@maximumcomm.com, Monday, 5/5, Friday, 5/9 Derek McDaniel, dmcdaniel@maximumcomm.com, Monday, 05/03/2010, Tuesday, 05/04/2010 I would like it to format like: Derek McDaniel, dmcdaniel@maximumcomm.com, Monday, 05/03/2010, Tuesday, 05/04/2010 Derek McDaniel, dmcdaniel@maximumcomm.com, Monday, 05/03/2010, Tuesday, 05/04/2010 Mark Slatter, mslatter@maximumcomm.com, Monday, 5/5, Friday, 5/9 Derek McDaniel, dmcdaniel@maximumcomm.com, Monday, 05/03/2010, Tuesday, 05/04/2010 What would I need to change in the above code? I am still new with this PHP coding and have very little experience but I am a very fast learner.
×
×
  • 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.