Jump to content

hc

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Posts posted by hc

  1. I am in a bit of a bind, and am hoping someone would take a few minutes to explain this syntax. Basically, I responded to an ad and got hired. They said they needed an MS Access, ASP Programmer, and this is what I got handed to work on. So, I just want to know what this syntax is, particluarly the bolded parts. Any help would be appreciated. I understand that it returns an array of values, but what do the <<< and -> mean?? Thanks...I know this is simple stuff

    function GetEmployers()
    {
    $retval = false;
    $sqlstr = [b]<<<[/b] SQL
    SELECT
    emp.id,
    emp.employer,
    sport.id AS job_type_id,
    sport.name AS jobtype
    FROM
    businesses.employers AS emp
    LEFT JOIN
    master.sports AS sport ON
    sport.id = emp.sport_id
    WHERE
    emp.status_id = 1
    ORDER BY
    emp.employer
    SQL;
    if([b]$this->Load[/b]($sqlstr))
    {
    while($row = $this->db->fetch())
    {
    $retval[] = $row;
    }
    }
    return $retval;
    } // GetEmployers()
  2. I have the following SQL I am trying to run from pgadmin III

    INSERT INTO master.employment(employer_id, employee_id, status_id,imported_by)
    SELECT  (SELECT id FROM businesses.employers WHERE sport_id=1 AND employer=imports.menssoccer.client) as employer_id
    ,(SELECT id FROM users.employees WHERE tax_id=imports.menssoccer.ssn AND SSN Is Not Null) as employee_id
    ,1
    ,'test'
    FROM imports.menssoccer
    WHERE SSN Is Not Null

    The problem is that sometimes it violate a Unique Constraint on the item. Is there a way I can just insert the rows that dont't exist? Or can I ignore the errors somehow and just go to the next row. Thanks

    Its not as easy a regular old IF NOT EXISTS...
  3. Thanks. I sort of HAVE to do this on Windows. It is my only available box right now. I dont have time to redo another one for PHP, PG.

    Would you any chance know the name of the DLL for PG? And How do I turn it on in the PHP.ini?

    I basically copied all the .dll in the PostGresql bin folder, but it did nothing. I thought it already WAS enabled in the PHP.INI, but no dice. Any thoughts? Thanks alot
  4. ok, this is the form. The real kicker here is that this code works on a UNIX server. But when I bring it down to my develpment environment (Windows 2003), it does not work anymore. That is why I think it is a setting or something. Any help would be greatly appreciated. Thanks

    <?php include('basicheader.inc'); ?>
    <h1>Welcome to OPP</h1>
    <form action="logon.php" method="post">
    <p>Username: <input type="text" name="logonUsername" maxlength="30" value="<?php echo $_POST['logonUsername']; ?>" /></p>
    <p>Password: <input type="password" name="logonPass" maxlength="30" value="" /></p>
    <p><input type="submit" name="submit" value="Login" /></p>
    </form>
    <div id="notRegistered">
    <h6>Not registered?</h6>
    <p><a href="register.php">Sign up here</a>.</p>
    </div>
    <?php include('footer.inc') ?>
  5. ok, while that was true, and subsequently worked,  :-[

    how about about this one. That small test started because of this...

    I have this file, pretty simple

    <?php
    /*
    * logon.php
    * Created on Dec 14, 2005 10:51:13 AM
    * by Keith Swallow
    *
    * Updated on 12/20/05 - 16:38:59
    * by Matthew Miller
    *
    * Script to handle logons
    */

    $includePath = '../classes/';  // Should be in a global config file as a constant
    require_once($includePath . 'dataobject.inc');
    require_once($includePath . 'employee.inc');
    require_once($includePath . 'passmgr.inc');
    require_once($includePath . 'functions.inc');

    $bodyID = "logon";  // sets body ID for the view, helps with navigation.  Move into view?

    if($_POST['submit'])  // if this form has been submitted
    {
    //unset($_POST['submitted']);  // reset the global variable in case they use other forms.
    $username = $_POST['logonUsername'];
    $uPass = $_POST['logonPass'];

    $user = new Employee;
    $id = $user->UsernameExists($username);  // Get employee ID
    if($id === 0) // if does not exist
    {
    $pageTitle = "Logon Error: Username";
    $error = "Username not found.";
    include('../views/logonform.inc');
    exit;
    }
    $user->SetEmployee($id);  // populate employee from DB

    $pm = new PassMgr;
    if(!$pm->Validate($uPass, $user->GetPass()))  // check passwords
    {
    $pageTitle = "Logon Error: Password";
    $error = "Password incorrect.";
    include('../views/logonform.inc');
    exit;
    }

    // if everything worked out
    session_start();
    $_SESSION['username'] = $user->username;
    $_SESSION['user_id'] = $user->id;
    $_SESSION['loggedOn'] = TRUE;

    $clients = $user->GetEmployers(array('Official'));

    if(is_array($clients) && $_SESSION['user_id'] != 1)
    {
    $_SESSION['officialonly'] = 0;
    }
    else
    {
    $_SESSION['officialonly'] = 1;
    }

    header("Location: index.php");
    }
    else
    {
    session_start();
    include('../views/logonform.inc');
    }
    ?>

    When I submit the page, instead of presenting me with a login message or error, it goes to blank page. nothing in the

    if($_POST['submit'])

    seems to get processed. Any ideas? Thanks
  6. I have a file called test.php. When I browse to it, I get the results for the browser test

    Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6

    But, the included file (testinc.php) does not get included. The contents of testinc.php are simply

    <!-- a general PHP test -->
    <?php phpinfo(); ?>

    If I take that out and put it in the body of the test.php file, it works fine. So, it is clearly include files that are not working. Can someone please help. I have been searching all afternoon.

    <html>
    <head>
    <title>PHP Test</title>
    </head>
    <body>
    <!-- testing sessions -->
    <?php session_start(); ?>

    <!-- testing browscap.ini -->
    <?php
    echo $_SERVER['HTTP_USER_AGENT'] . "<br/><br/>";
    $browser = get_browser(null, true);
    print_r($browser);
    echo "<br/><br/>";
    ?>

    <?phpinclude 'inctest.php';?>
    </body>
    </html>
×
×
  • 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.