Jump to content

will35010

Members
  • Posts

    276
  • Joined

  • Last visited

Posts posted by will35010

  1.  

    if those values are in the database you can do it the query

    SELECT start
      , type
      , start + INTERVAL type MINUTE as end
    FROM testtime;
    
    +---------------------+------+---------------------+
    | start               | type | end                 |
    +---------------------+------+---------------------+
    | 2014-05-22 09:16:24 |   30 | 2014-05-22 09:46:24 |
    | 2014-05-22 09:56:24 |   20 | 2014-05-22 10:16:24 |
    +---------------------+------+---------------------+

     

    Yeah, they are in the db, but I'm building this app with laravel 4. I'm using the query builder and eloquent so I'm trying to do it in the code to avoid complicating the query since I'm new to the framework.

  2. The third line needs to be

    $endtime = date('Y-m-d H:i:s',strtotime($start, "+$type minutes"));
    

    No need for the quotes

     

    I'm afraid that returns the same thing :(

    $start = "2014-05-22 09:16:24";
    
    $type = 30;
    
    $endtime = date('Y-m-d H:i:s',strtotime($start, "+$type minutes"));
    
    echo "End: ".$endtime."</br>Start: ".$start;
    

    End: 2014-05-22 09:16:24

    Start: 2014-05-22 09:16:24

  3. Hello,

     

    I'm trying to use strtotime to add time to a mysql type timestamp. Any help would be appreciated. I think I have tunnel vision from looking at it when I know it has to be something obvious...lol

    $start = "2014-05-22 09:16:24";
    
    $type = 30;
    
    $endtime = date($start,strtotime("+ '.$type.' minutes"));
    
    echo "End: ".$endtime."</br>Start: ".$start;
    

    Right now it returns: 

    End: 2014-05-22 09:16:24

    Start: 2014-05-22 09:16:24

  4. the only thing that is apparent from the code you posted is that your $TrackingClass->GetPriority() method likely (only you know for sure) returns a mysqli result object and you are trying to echo that.

     

    wouldn't you need to to fetch a row from that result set, then access a specific element of that row before you could echo its value? or even better, wouldn't a method named GetPriority() do all the necessary work internally and just return the priority value?

     

    Thank you for pointing me in the right direction. It was the way the function was returning the result. Thank you again!

  5. Hello,

     

    I think I've been staring at this too long and now cannot see it straight anymore so another pair of eyes would be greatly appreciated.

     

    I have the below code that pulls a result from mysql and puts it into an array. I now need to run a function from my class on one of the items in the array since I am using smarty to template and cannot call the function from the template or shouldn't anyway.

    <?php
    
    ini_set('display_errors', 1);
    error_reporting(E_ALL);
    
    include ('classes/TrackingBoardClass.php');
    include ('functions.inc.php');
    
    $clientID = "1";
    
    
    $TrackingClass = new TrackingBoardClass();
    $results = $TrackingClass->GetBoardResults($clientID);
    if ($results != "") {
        while ($row2 = mysqli_fetch_assoc($results)) {
    
            $boardresults[] = $row2['priorityID'];
        }
    }
    
    //print_r($boardresults);
    
    foreach ($boardresults as $value) {
        echo $TrackingClass->GetPriority($clientID, $value)."<br>";
    }
    
    ?>
    
    

    The $TrackingClass->GetPriority is the function that I am trying to run on the results, but I get error: Object of class mysqli_result could not be converted to string.

     

    Any help or insights would be greatly appreciated. Thank you!

  6. The big thing with SSD is getting a lower disk TPS rate.

     

    I personally like to setup Apache to run on port 8080 and Nginx to run on port 80 to act as a reverse proxy to lighten the load on Apache. I also setup and tune php apc.

     

    This setup has allowed me to run some high traffic sites on really low cost boxes.

     

     

  7. Do you get an error when running your php code from php? If not, there isn't a lot that folks here will be able to do.

     

    You are better off asking for help in a forum that is specific for your IDE if it's an IDE issue.

  8. This really isn't db problem but I see you moved the thread. This problems relates to setting the db name using a session variable.

     

    I'll just use one db and use clientID's to separate the data since this doesn't seem to be easily accomplished. I know I can set a clientID for a query since I've done that in the past.

     

    Thanks for your help.

  9. I am working on an application and I wanted it to be a single app with a database for each client. What is the best way to do this? I've tried setting the DB connection using a variable, but it doesn't work.

     

    Example:

    <?php
    session_start();
    
    $_SESSION['clientid'] = "clientA";
    
    $db = $_SESSION['clientid'];
    
    $clientA = @mysqli_connect('localhost', 'fake_user', 'my_password', 'db_clientA');
    
    $clientB = @mysqli_connect('localhost', 'fake_user', 'my_password', 'db_clientB');
    
    $sql = mysqli_query($db, "SELECT * FROM test;";
    ?>
    

     

     

     

    <?php
    session_start();
    
    $_SESSION['clientid'] = "clientA";
    
    $clientid = $_SESSION['clientid'];
    
    $db_name="db_".$clientid; //Just my coding style, you could also do $db_name="db_$clientid"; If you're okay with a hybrid variable and string inside the same quotes. 
    
    $db = mysqli_connect('localhost', 'fake_user', 'my_password', $db_name);
    
    $sql = mysqli_query($db, "SELECT * FROM test");
    ?>
    

     

    If I'm not mistaken, they way you had it you would open two MySQL connections, but you'd only ever be using one of them. Major waste of server resources; and if you add more clients, it would just be a nightmare, and possibly a MySQL server crash, due to overload.

     

    Thank you for your reply. I always put my db info in a file and include it where needed and close the connection after use. I don't see how to make your solution work in the way I need. The site will be too big to have the db connect info on each page and would be a nightmare to change when the db needs to be moved.

  10. I really don't want to put the connect function on each page so I usually create a db.php and just include the file. It there a way to do it with the connection variable on mysqli instead.

     

    For example, client A:

    include('db.php');
    
    mysqli_query($clientA, "SELECT * FROM test;");
    

    ClientB

    include('db.php');
    
    mysqli_query($clientB, "SELECT * FROM test;");
    

     

    Is there a way to set the $conn name based on session data?

  11. I am working on an application and I wanted it to be a single app with a database for each client. What is the best way to do this? I've tried setting the DB connection using a variable, but it doesn't work.

     

    Example:

    <?php
    session_start();
    
    $_SESSION['clientid'] = "clientA";
    
    $db = $_SESSION['clientid'];
    
    $clientA = @mysqli_connect('localhost', 'fake_user', 'my_password', 'db_clientA');
    
    $clientB = @mysqli_connect('localhost', 'fake_user', 'my_password', 'db_clientB');
    
    $sql = mysqli_query($db, "SELECT * FROM test;";
    ?>
    

  12. Hi,

     

    I am looking to hire a developer for a medical patient tracking web app. I have coded a beta that will help you know what I'm looking for. I just don't have time to code the full app.

     

    I want the application written in php(prefer non-OOP) with a MySQL back end. I want the app to be as automated as much as possible. 30 day free trial with full functionality then require upgrade. PayPal integration. Automated sign-up process. The database needs to be normalized and be multi-tenant so only one instance is used. Data cannot be shared across clients since HIPAA and privacy laws are very important. documented code so future enhancements are a snap. Hopefully, this works into something more down the road where we can create an API HL7 interface.

     

    The developer will need the following skills:

     

    Php (obvious I know)

    MySQL

    JavaScript

    Ajax

     

    Please email me at Will35010@gmail.com with a few samples of your work if you are interested. I will review and send you login details to the beta so we can get a quote worked out.

     

    Thank you for your time.

     

    Will

     

     

  13. I have it returning the results with this:

    $sql = "SELECT adpat, adptnm, addate, adtime, adddsc, disdt, distm, drname, adptyp, ptprvtyp FROM hma711.zadpatnmf 
    JOIN hma711.addocrmf on adamdr = drno WHERE addate BETWEEN '20111115' AND '20111115' AND adpat BETWEEN '2000000' AND '2999999'";
    
    $execute = odbc_exec($conn, $sql);
    
    $count = odbc_num_rows($execute);
    echo $count."</br>";
    $i = 1;
    while($i<=$count)
      {
      $pat_num = odbc_result($execute, "adpat");
      echo $pat_num;
      $pat_nam = odbc_result($execute, "adptnm");
      echo $pat_nam."</br>";
      $i++;
      }
    
    

     

    But it repeatedly echos on the first row of data for all records returned.

  14. I have this code:

    $sql = "SELECT adpat, adptnm, addate, adtime, adddsc, disdt, distm, drname, adptyp, ptprvtyp FROM hma711.zadpatnmf 
    JOIN hma711.addocrmf on adamdr = drno WHERE addate BETWEEN '20111115' AND '20111115' AND adpat BETWEEN '2000000' AND '2999999'";
    
    $execute = odbc_exec($conn, $sql);
    
    $num = odbc_num_rows($execute);
    echo $num;
    
    while($row = odbc_fetch_array($execute)){
        echo $row['adpat'];
    } 
    

    It gets an error on this line: echo $row['adpat'];

     

    The error is Notice: Undefined index: adpat in C:\xampp\htdocs\erboard\test.php on line 29

     

    The query works directly on the AS400 I'm pulling from and the $num is being populated with the correct number of records.

     

    This is the first time I have ever used php with odbc so I'm not sure what I'm missing. Any help would be greatly appreciated. Thanks!

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