Jump to content

SalientAnimal

Members
  • Posts

    366
  • Joined

  • Last visited

Posts posted by SalientAnimal

  1. Great, so I have managed to get the mailer to do the validation after quite a bit of reading and trial and error. So I have two more questions on this thread that I would like assistance with. I have the mailer working for two of my options, but the thrid isn't working... I think the reason for this is because I am trying to validate the mailer on a wildcard function (%) as the field here is a free text field.

     

     

    My Code:

    else if
    	(
    	$_POST['organogram'] == "%"
    	)
    {
    $to = 'MYMAIL@MYDOMAIN.COM';
    $subject = "New Change Request - Reference Number $_POST[reference]_$_POST[lname]";
    $message = "
    New Churn Request - $_POST[churn_type]. Action Required
    
      A Churn request has been logged for $_POST[fname] $_POST[lname].
      Please log onto the churn management system via the link http://localhost and action the request accordingly.
    ";
    }  
    

     

    How do I get the wildcard function to work here?

  2. Hi Guys/Gals

     

    So I have this nice little page displaying a table with information. I would like to also display graphs below the table. I have managed to get the graph to represent one kind of data, and will get to it displaying more once I get the include working.

     

    The php file for the graph displays fine when on its own, as does the table page. The problem is when I try to include the Graph, get the table displaying, and a whole lot of junk thrown out at the bottom instead of the graph. I must apologise as I know my code isn't the cleanest, but it is all self taught.

     

     

    Can someone help me here perhaps?

     

    Here is my code for the table:

    I must apologise as I know my code isn't the cleanest, but it is all self taught.

    <?php
    
    session_start();
    $conn = @mysql_connect("localhost","root","MYPASSWORD") or exit("Could not establish a connection to MySQL Server. mysql_error()");
    $select = @mysql_select_db("MYDATABASE",$conn) or exit("Could not select the appropriate database for this operation. mysql_error()");
    
    if(isset($_COOKIE['ID_my_site']))
    {
        $username = $_COOKIE['ID_my_site'];
        $name = $_COOKIE['ID_my_name'];	
        $pass = $_COOKIE['Key_my_site'];
        $check = @mysql_query("SELECT * FROM userinfo WHERE username='$username'") or die("Failed to execute SQL Statement.");
        while($info = mysql_fetch_array($check))
        {
            if($pass != $info['password'])
            {
                header("Location: login.php");
            }
            else{
    
    	}
    }
    }
    else{
        header("Location:login.php");
    }
    
    include "navigation/churn.html";
    ?>
    
    <title> ? 2012 Initiator Log </title>
    <meta http-equiv="refresh" content="10">
    <script type="text/javascript">
    var count = 0;
    var delay = 250;
    var text = "? 2012 Churn Management                                ";
    function scroll () {
      document.title = text.substring(count, text.length) + text.substring (0, count)
      if (count < text.length) {
        count ++;
      } else {
        count = 1;
      }
      setTimeout ("scroll()", delay);
    }
    scroll();
    </script>
    <LINK REL="SHORTCUT ICON" HREF="favicon.ico">
    
    <script language="javascript" src="js/admin.js"></script>
    
    
    
    
    <style type="text/css">
    <!--
    #form1 table tr td {
    color: #FFF;
    }
    #form1 table tr td {
    font-family: "Segoe Print", Tahoma, "Segoe UI";
    font-size: 13px;
    }
    #form1 p {
    color: #FFF;
    font-size: 36px;
    font-weight: bold;
    text-align: center;
    font-family: "Segoe Print", Tahoma, "Segoe UI";
    }
    -->
    </style>
    </head>
    <link rel="stylesheet" type="text/css" href="/css/layout_churn.css"/>
    </head>
    
    <html>
    <table width="100%" border="0">
      <tr>
        <td width="20%"></td>
        <td width="80%"><p align="justify"></p></td>
      </tr>
      <tr>	
        
    <p>Input 
    the Reference, to make sure we have the right one:<br>
    (Quick Search Listed Below)</p>
    
    <form method=post action="http://10.249.135.30/search_updates/amend_churn_i.php">
    <input type="text" name="record" size="50">
    <br>
    <img src="images/find.png" alt="find">
    <input type="submit" name="search" value="Search">
    </form>
    
    <?php
    // Show simple format of the records so person can choose the reference name/number
    // this is then passed to the next page, for all details
    
    $con = mysql_connect("localhost"
    ,"root"
    ,"MYPASSWORD");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
      
    mysql_select_db("MYDATABASE", $con);
    
    $sql="SELECT 
    staff_churn.reference
    , staff_churn.champ
    , staff_churn.churn_type
    , staff_churn.effective_date
    , staff_churn.department
    , staff_churn.exit_department
    , staff_churn.position
    , staff_churn.contract_type
    , staff_churn.status
    , TIMESTAMPDIFF(DAY, sys_date,NOW()) AS days
    , SEC_TO_TIME(TIMESTAMPDIFF(SECOND,sys_date,NOW()) MOD 86400) AS current_tat
    FROM staff_churn
    WHERE staff_churn.username='$username'
    ";
    
    $result = mysql_query( $sql)
    or die(" - Failed More Information:<br><pre>$sql</pre><br>Error: " . mysql_error());
    
    $num_rows = mysql_num_rows($result);
    if ($myrow = mysql_fetch_array($result)) {
    
    echo "<br><p>Outstanding Churn Management - Initiator Log<BR></p><br>";
    echo "<table border=1>\n";
    echo "<tr>
    <td bgcolor=#444444 align=center><p><b>Reference</p></td>
    <td bgcolor=#444444 align=center><p><b>Champ</p></td>
    <td bgcolor=#444444 align=center><p><b>Churn Type</p></td>
    <td bgcolor=#444444 align=center><p><b>Effective Date</p></td>
    <td bgcolor=#444444 align=center><p><b>Department</p></td>
    <td bgcolor=#444444 align=center><p><b>Exit Department</p></td>
    <td bgcolor=#444444 align=center><p><b>Position</p></td>
    <td bgcolor=#444444 align=center><p><b>Contract Type</p></td>
    <td bgcolor=#444444 align=center><p><b>Status</p></td>
    <td bgcolor=#444444 align=center><p><b>Days</p></td>
    <td bgcolor=#444444 align=center><p><b>HH:MM:SS</p></td>
    
    </tr>\n";
    do {
    
    
    
    
    printf("<tr>
    <td><p>%s</p></td>
    <td><p>%s</p></td>
    <td><p>%s</p></td>
    <td><p>%s</p></td>
    <td><p>%s</p></td>
    <td><p>%s</p></td>
    <td><p>%s</p></td>
    <td><p>%s</p></td>
    <td><p>%s</p></td>
    <td><p>%s</p></td>
    <td><p>%s</p></td>
    </tr>\n"
    ,$myrow["reference"]
    ,$myrow["champ"]
    ,$myrow["churn_type"]
    ,$myrow["effective_date"]
    ,$myrow["department"]
    ,$myrow["exit_department"]
    ,$myrow["position"]
    ,$myrow["contract_type"]
    ,$myrow["status"]
    ,$myrow["days"]
    ,$myrow["current_tat"]
    );
    
    
    
    
    
    
    
    
    } while ($myrow = mysql_fetch_array($result));
    echo "</table>\n";
    } else {
    echo "$ref There are currently no pending actions"; 
    } 
    
    mysql_free_result($result);
    mysql_close($con);
    
    
    
    ?>
    </html>
    <?php
    
    

     

    And the code for the graph:

    <?php   
    
    include("graphlib/phpgraphlib.php");  
    
    $graph=new PHPGraphLib(550,400); 
    
    
    $link = mysql_connect('localhost', 'root', 'MYPASSWORD')  
    
       or die('Could not connect: ' . mysql_error());  
    
          
    
    mysql_select_db('MYDATABASE') or die('Could not select database');  
    
       
    
    $dataArray=array();  
    
       
    
    //get data from database  
    
    $sql="SELECT reference, 
    COUNT(*) AS 'queries' FROM staff_churn 
    WHERE status = 'Open'
    GROUP BY status";  
    
    $result = mysql_query($sql) or die('Query failed: ' . mysql_error());   
    
    if ($result) {  
    
      while ($row = mysql_fetch_assoc($result)) {   
    
          $status=$row["Open Query"];  
    
          $count=$row["queries"];  
    
          //add to data areray  
    
          $dataArray[$status]=$count;  
    
      }  
    
    }  
    
       
    
    //configure graph  
    
    $graph->addData($dataArray);  
    
    
    $graph->setTitle("Open Queries");
      
    $graph->setTextColor("black");
    
    $graph->setGradient("red", "maroon"); 
    
    $graph->setBarOutlineColor("black");  
    
    $graph->createGraph();  
    
    ?> 
    
    

  3. I'm having some problems applying the td class css.

     

    Can you perhaps help me with placing it correctly in my code?

     

    $result = mysql_query("SELECT * FROM cs_2012
    WHERE 
    DATE(sys_date) = CURDATE()
    ");
    $num_rows = mysql_num_rows($result);
    
    if ($value >= 50) $class = 'low';
    if ($value >= 150) $class = 'mid';
    if ($value >= 300) $class = 'high';
    echo "<table border='4' width='250' align='middle'>";
    echo "<td class='$class'>$value Sales</td>";
    

     

     

    This is my CSS code:

     

    body
    { 
    background: url(../img/vmsa.jpg) fixed;
    background-color: white;
    font-family:  Segoe UI, Tahoma;
    font-weight: normal;
    } 
    
    
    p 
    { 
    font-family:  Segoe UI, Tahoma;
    font-size:50px;
    color: white; 
    text-indent:8px;
    font-weight: normal;
    } 
    
    table
    {
    border-collapse:collapse;
    }
    table,th, td
    {
    font-family:  Segoe UI, Tahoma;
    font-size: 100px;
    color: white; 
    font-weight: bold;
    width: auto;
    } 
    
    low
    {
    font-family:  Segoe UI, Tahoma;
    font-size: 100px;
    color: red; 
    font-weight: bold;
    width: auto;
    } 
    
    mid
    {
    font-family:  Segoe UI, Tahoma;
    font-size: 100px;
    color: orange; 
    font-weight: bold;
    width: auto;
    } 
    
    high
    {
    font-family:  Segoe UI, Tahoma;
    font-size: 100px;
    color: green; 
    font-weight: bold;
    width: auto;
    } 
    

  4. Thanks :)

     

    Just for my understanding, as I don't jsut want to plug and play the code, what exactly does the MOD 86400 do?

     

    I know the 86400 is a representation of 3600 minutes in a day ,etc...

     

    Also I am using a system generated date, and not a predefined date as you have captured, hopefully this won't effect the results?

  5. Ok cool, so here is what I have managed to do:

     

    <link rel="stylesheet" type="text/css" href="/css/layout_sales.css"/>
    </head>
    <p align='center'>
    <br>
    <br>
    <br>
    <table align='center'>
    <tr>
    
    <?php
    // Show simple format of the records so person can choose the reference name/number
    // this is then passed to the next page, for all details
    
    $con = mysql_connect("localhost"
    ,"root"
    ,"MYPASSWORD");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
      
    mysql_select_db("MYDATABASE", $con);
    
    $result = mysql_query("SELECT * FROM cs_2012
    WHERE 
    DATE(sys_date) = CURDATE()
    ");
    $num_rows = mysql_num_rows($result);
    
    echo "<table border='4' width='250' align='middle'>";
    echo "<tr>";
    echo "<td> $num_rows Sales \n </td>";
    

     

    I have also changed me CSS file so the results are displayed in the center. I had to however use line breaks to move the table down, is there a way to center it without the use of the line breaks?

     

    Then the other thing that I haven't figured out yet is how to get the font to change color when the results get to certain values (50, 150, 300) - Any help on this?

     

    My results are also displaying all on one line eg. 100 Sales, I would prefer it to display as:

     

    100

    Sales

     

    And to be centered in the table.

  6. Hi Guys/Gals

     

    I have the following PH page and it prints my results. I now have it returning the correct results and now I need to present it on a PHP page in a "PRETTY" way.

     

    Basically I want the result to display:

    1. In the center of the page in a square

    2. In a rather large font, so as to almost fill the screen

    3. And being really fancy now - have the number being printed change colour at certain values from red to orange to green These colour intervals will be 50, 150, 300.

     

    Here is my existing code which returns the results:

     

    <?php
    
    session_start();
    $conn = @mysql_connect("localhost","root","MYPASSWORD") or exit("Could not establish a connection to MySQL Server. mysql_error()");
    $select = @mysql_select_db("MYDATABASE",$conn) or exit("Could not select the appropriate database for this operation. mysql_error()");
    
    if(isset($_COOKIE['ID_my_site']))
    {
        $username = $_COOKIE['ID_my_site'];
        $name = $_COOKIE['ID_my_name'];	
        $pass = $_COOKIE['Key_my_site'];
        $check = @mysql_query("SELECT * FROM userinfo WHERE username='$username'") or die("Failed to execute SQL Statement.");
        while($info = mysql_fetch_array($check))
        {
            if($pass != $info['password'])
            {
                header("Location: login.php");
            }
            else{
    
    	}
    }
    }
    else{
        header("Location:login.php");
    }
    include "navigation/backoffice.html";
    ?>
    
    <title> ? 2012 SALES COUNT </title>
    <meta http-equiv="refresh" content="10">
    <script type="text/javascript">
    var count = 0;
    var delay = 250;
    var text = "? SALES COUNT                              ";
    function scroll () {
      document.title = text.substring(count, text.length) + text.substring (0, count)
      if (count < text.length) {
        count ++;
      } else {
        count = 1;
      }
      setTimeout ("scroll()", delay);
    }
    scroll();
    </script>
    <LINK REL="SHORTCUT ICON" HREF="favicon.ico">
    
    <script language="javascript" src="js/admin.js"></script>
    
    
    
    
    <style type="text/css">
    <!--
    #form1 table tr td {
    color: #FFF;
    }
    #form1 table tr td {
    font-family: "Segoe Print", Tahoma, "Segoe UI";
    font-size: 13px;
    }
    #form1 p {
    color: #FFF;
    font-size: 36px;
    font-weight: bold;
    text-align: center;
    font-family: "Segoe Print", Tahoma, "Segoe UI";
    }
    -->
    </style>
    </head>
    <link rel="stylesheet" type="text/css" href="/css/layout_churn.css"/>
    
    
    <?php
    // Show simple format of the records so person can choose the reference name/number
    // this is then passed to the next page, for all details
    
    $con = mysql_connect("localhost"
    ,"root"
    ,"MYPASSWORD");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
      
    mysql_select_db("MYDATABASE", $con);
    
    $result = mysql_query("SELECT * FROM cs_2012
    WHERE 
    DATE(sys_date) = CURDATE()
    ");
    $num_rows = mysql_num_rows($result);
    
    echo "$num_rows Sales Today \n";
    echo date('l \t\h\e jS');
    
    
    
    
    
    ?></html>
    
    

  7. Ok, so I finally after lots of trial nad error got this to work.

     

    I can only assume that the reason I wasn't getting any results is because my sys_date column is a TIMESTAMP field.

     

    Here's the solution:

     

    $result = mysql_query("
    SELECT * FROM cs_2012
    WHERE 
    DATE(sys_date) = CURDATE()
    ");
    $num_rows = mysql_num_rows($result);
    

  8. If you're getting no results then there aren't any records being "captured". Try running your query using some tool like phpMyAdmin or MySQL Workbench.

     

     

    I've run the query using a like function and then using today's date and I am getting results, however, I don't want to have to update the query everyday.

     

    $result = mysql_query("SELECT * FROM cs_2012WHERE sys_date = like '2012-06-25%'");$num_rows = mysql_num_rows($result);echo "$num_rows Rows\n";

     

    The above query returns 270 Rows. But when using CURDATE() or CURRENT_DATE() it says 0 Rows

  9. Hi All,

     

    I am runningt his query to count and then display the current date's records captured. Even thoguh I know there are records captured, why am I still getting no results?

     

    $result = mysql_query("SELECT * FROM cs_2012
    WHERE 
    sys_date = CURRENT_DATE()");
    $num_rows = mysql_num_rows($result);
    
    echo "$num_rows Rows\n";

  10. Hi there,

     

    Yes, my mailing is now working. The problem I have now is identify who actually needs to recieve the e-mail and when.

     

    Eg. email2@domain.com needs to receive the e-mail only when criteria matching them needs to be actioned, i.e systems access for example. In this case if any of the fields from query below would be selected in the form they need to get an e-mail, however if none of these fields were selected in the form then only the areas that had fields selected in the form would need to get the mail.

     

    $sql="INSERT INTO churn_it
    (reference
    ,champ_portal
    ,pc
    ,email
    ,phone
    ,lan
    ,g_folders
    ,h_folders
    ,distribution
    ,clarify_access)
    
    VALUES
    ('$_POST[reference]_$_POST[lname]'
    ,'$_POST[champ_portal]'
    ,'$_POST[pc]'
    ,'$_POST[email]'
    ,'$_POST[phone]'
    ,'$_POST[lan]'
    ,'$_POST[g_drive] $_POST[drive_a] $_POST[drive_c] $_POST[drive_e] $_POST[drive_g]'
    ,'$_POST[h_drive] $_POST[drive_b] $_POST[drive_d] $_POST[drive_f] $_POST[drive_h]'
    ,'List: $_POST[list_a] $_POST[list_b] $_POST[list_c] $_POST[list_d] $_POST[list_e] $_POST[list_f] $_POST[list_g] $_POST[list_h]'
    ,'Clarify Level: $_POST[clarify_access]'
    )";

     

    Not sure if I am making any sense here?

     

    Then the person who completes the form should also get an e-mail notify them that they have successfully logged a request. The users e-mail address is stored in a seperate database that is linked to their username used to log in.

     

    Thanks again to everyone who is helping here. Really want to get this one working 100%

  11. Hi All,

     

    Again I have a very simple question. I would like to show the TAT of a particular item in the format of DD:HH:MM. The creation date is stored in my database as a TIMESTAMP and the time difference is calculated on the current time.

     

    Here is what I have at the moment:

    , TIMESTAMPDIFF(HOUR,sys_date,NOW()) AS current_tat

     

    I tried

    , TIMESTAMPDIFF(DAY, HOUR, MINUTE,sys_date,NOW()) AS current_tat

    which did not work and also other simplar variations. What is the corect way to do this please?

     

    Thanks

  12. The table needs to contain all the data that you think is relevant.

     

    Files should not be stored in databases, but in the filesystem. You would store the location of the file in your table.

     

    Hi Jesirose,

     

    Can you maybe give me some guidance of how to do all this? Keep in mind I would need to add an "Attach Document" field to my form.

     

    Thanks

  13. I know how to do the coding and the structuring of the tables.

     

    I just need to know:

    What must the table look like?

    Are there any other requirements that I need to make to the webserver/database to handle attachments, if so, what?

     

  14. Hi Guys/Gals,

     

    I have a database that curerntly has 4 tables in it that are all linked to each other with a refernce number. I would like to create another table, one that will store all my attachments. I have never done nor create a table that stores any kind of attachments and need some advice in how to go about with creating the table:

    What fields do have to have in the table?

    What is the correct structure for each field in the table?

    I need to have the reference number also saved in this table as it is my unique identifier.

    How do I then save the file into the database using the attachment function from a PHP form?

     

    Thanks.

     

  15. Yip, I have a column in the table which is the sys_date and then I have a date_modified.

     

    I just need to know how would I get the date_modified to populate in the form update without the administrator being able to modify/minipulate this date. Basically the modified date must also be a system generated date.

  16. Hi All,

     

    Yes I'm becoming a frequent poster... Hope I get my voyager miles  :P.

     

    Ok but on a more serious note, I'm hoping to get some direction on this. I have a form that submits to the tables in the database. It is capturing the system date in a field named sys_date. At a later stage this task is updated by an user with an administrator function, I would like that when the administrator does the update a new system date is captured, keeping the existing one. The reason I want to do this is so that I can track turn around times.

     

    Can anyone give me an idea of how to do this?

  17. I managed to get this working to a certain extent. Not exacty the way I want it to, but its a fix for now.

     

    I fixed it by adding this befor executing the query to the database:

     

    $to = 'email@domain.com,email2@domain.com';
    $subject = "New Change Request - Reference Number $_POST[reference]_$_POST[lname]";
    $message = "
    New Churn Request - $_POST[churn_type].
    
    A Churn request has been logged for $_POST[fname] $_POST[lname].
    Please log onto the churn management system via the link http://localhost and action the request accordingly.
    ";
    mail($to, $subject, $message);

×
×
  • 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.