Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    Regular Coder
    Join Date
    Feb 2005
    Location
    Atlanta, GA
    Posts
    171
    Thanks
    5
    Thanked 0 Times in 0 Posts

    PHP training resources

    I am looking for recommendations for PHP training. I am an RPG programmer, with a couple of years experience with Perl. I started trying to learn PHP a few months ago, and so I have some basic knowledge. But there is obviously so much more. I see all kinds of tutorials on the web, but wonder if there is any good DVD or computer based training out there, either for purchase or otherwise. Any advice is appreciated!

  • #2
    Senior Coder
    Join Date
    Aug 2009
    Location
    Mansfield, Nottinghamshire, UK
    Posts
    1,555
    Thanks
    57
    Thanked 148 Times in 147 Posts
    from experience (a long time ago) find a script (any) then play around with it. Look up the functions on php.net and see what happens. Any help you need just post it here and they will be someone to point you in the right direction. Most languages are the same just wrote different.

  • #3
    Senior Coder
    Join Date
    Aug 2009
    Location
    Mansfield, Nottinghamshire, UK
    Posts
    1,555
    Thanks
    57
    Thanked 148 Times in 147 Posts
    PHP Code:
    <?php
        
    if(isset($_POST['submit']))
    {
        if(isset(
    $_GET['time']))
        {
            
    $difference = (time()-$_GET['time']);
            echo 
    "Time diff in seconds: ".$difference." secs";
        }
    }

    ?>

    <form method="post" action="index.php?time=<?php echo time(); ?>">
    <input type="submit" name="submit" value="submit">
    </form>
    alter it, see what happens.
    list of things to look up:

    $_POST[];
    $_GET[];
    time();
    echo
    if
    isset()

    google:
    'php - concatenate strings'
    'php - difference in " and ' '
    'php - variables'
    Last edited by Phil Jackson; 08-26-2009 at 03:00 PM.

  • #4
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    Where I began my journey:

    tizag.com
    w3schools.com
    PHP for dummies (book), lots of other PHP books

    Godspeed!
    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Quote Originally Posted by whizard View Post
    Where I began my journey:

    tizag.com
    w3schools.com
    PHP for dummies (book), lots of other PHP books

    Godspeed!
    Dan
    I've always been curious if the PHP for dummies book is any good?
    I find that books tend to outdate rather fast, and since PHP is probably among the most popular web scripting languages out there (excluding html of course, but thats not really a scripting language), so I recommend just the basic PHP.net site. It has pros and cons.

    I assume you have knowledge of C? PHP is very much like C syntactically, though it completely lacks explicit datatypes, function prototyping and pointers. Many of the function names are the same as from C. The API will provide great examples and user notes; however, you must know what it is you're looking for in order to review the answer (ie: you must know that array_merge is the function for merging two arrays, otherwise you won't be able to find it in the site [easily]). On that note, PHP doesn't have arrays either. Arrays are all hashmaps in PHP, and they are not genericable either, so any array takes any data. On the plus, we don't need to resize them.
    If you're like me, I'm a kinesthetic learner, so just keep playing with it an you'll learn the language.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #6
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    Well, I began learning PHP when I was 12 or 13, so it eased my entry into computer programming. At the time, I had no knowledge of C, but now I have a little. The PHP/dummies book is good if you have no clue what's going on, as the title indicates

    It had a lot of examples I could look at and play with in the way Phil Jackson suggested.

    Bottom Line: I found it helpful, but you quickly move on from it.

    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #7
    Regular Coder
    Join Date
    Feb 2005
    Location
    Atlanta, GA
    Posts
    171
    Thanks
    5
    Thanked 0 Times in 0 Posts
    I saw a reference to the PHP BLACK BOOK, but it looks like it was written in 2001. has PHP been around that long? I do not have any knowledge of C, but I do of Perl. Below is one PHP script that I wrote recently. You will see that I am using db2_ tools. This is basic. I am trying to understand more complex situations; for example, how to handle web services...

    Code:
    <html>
    <head>
    <title>Drop Ship - File Request Menu (Inventory Movements File)</title>
    </head>
    <body>
    
    <?php
    
    ini_set('display_errors','1');
    error_reporting (E_ALL);
    $error_flag = "";
    
    $process_description = "Process Returns File";
    
    // Parse input //
    $siteID 			= $_GET['site'];
    $applicationID 		= $_GET['app'];
    $environmentName 	= $_GET['envr'];
    $vendorCode		= $_GET['vendor'];
    
    // Set library list //
    $testing_flag = "No";
    $owner 	= $applicationID;
    $listname = $environmentName;
    require("setlibl_db2.php");
    
    // Open iSeries connection //
    $database 	= 'PREPROD';
    $user 		= 'myusername';
    $password 	= 'mypassword';
    $conn 	    = db2_pconnect($database, $user, $password);
    if (!$conn) { exit("<br>Connection Failed: " . $conn); }
    
    // Prepare Stored Procedure call /
    $proc = 'CALL GET_MOVEMENTS(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)';
    $stmt = db2_prepare($conn, $proc) or die("db2_prepare failed<br>");
    
    // Define output parameters //
    $return001	        = "";
    $return002	        = "";
    $return003	        = "";
    $return004	        = "";
    $return005	        = "";
    $return006	        = "";
    $return007	        = "";
    $return008	        = "";
    $jobid	        	= "";
    $return	        	= "";
    $message        	= "";
    
    // Bind output parameters //
    db2_bind_param($stmt, 1,  "applicationID", 	 DB2_PARAM_IN);
    db2_bind_param($stmt, 2,  "environmentName", DB2_PARAM_IN);
    db2_bind_param($stmt, 3,  "siteID", 		 DB2_PARAM_IN);
    db2_bind_param($stmt, 4,  "vendorCode",		 DB2_PARAM_IN);
    db2_bind_param($stmt, 5,  "return001", 		 DB2_PARAM_OUT);
    db2_bind_param($stmt, 6,  "return002", 		 DB2_PARAM_OUT);
    db2_bind_param($stmt, 7,  "return003", 		 DB2_PARAM_OUT);
    db2_bind_param($stmt, 8,  "return004", 		 DB2_PARAM_OUT);
    db2_bind_param($stmt, 9,  "return005", 		 DB2_PARAM_OUT);
    db2_bind_param($stmt, 10, "return006", 		 DB2_PARAM_OUT);
    db2_bind_param($stmt, 11, "return007", 		 DB2_PARAM_OUT);
    db2_bind_param($stmt, 12, "return008", 		 DB2_PARAM_OUT);
    db2_bind_param($stmt, 13, "jobid", 		 	 DB2_PARAM_OUT);
    db2_bind_param($stmt, 14, "return", 		 DB2_PARAM_OUT);
    db2_bind_param($stmt, 15, "message", 		 DB2_PARAM_OUT);
    
    // Execute the stored procedure //
    if ($stmt) {
    $success = db2_execute($stmt);
    if (!$success) {
        $db2_error = db2_stmt_error($stmt);
        echo "error code: $db2_error<br><br>";
    }}
    
    $msga[1] = substr($return001, 00, 50);
    $msgb[1] = substr($return001, 50, 50);
    
    $msga[2] = substr($return002, 00, 50);
    $msgb[2] = substr($return002, 50, 50);
    
    $msga[3] = substr($return003, 00, 50);
    $msgb[3] = substr($return003, 50, 50);
    
    $msga[4] = substr($return004, 00, 50);
    $msgb[4] = substr($return004, 50, 50);
    
    $msga[5] = substr($return005, 00, 50);
    $msgb[5] = substr($return005, 50, 50);
    
    $msga[6] = substr($return006, 00, 50);
    $msgb[6] = substr($return006, 50, 50);
    
    $msga[7] = substr($return007, 00, 50);
    $msgb[7] = substr($return007, 50, 50);
    
    $msga[8] = substr($return008, 00, 20);
    $msgb[8] = substr($return008, 50, 50);
    
    // Display the results //
    print "<img src='images/coxlogo.gif'>";
    print "<br><font face='verdana' size='3' color='black'><b>";
    print "Process IS1015RA81:<br>$process_description for $vendorCode<br><br>";
    
    print "<table border='1' cellspacing='2' cellpadding='2'>";
    print "<tr><td><font face='verdana' size='2' color='black'>Return Code</td><td>$return</td></tr>";
    print "<tr><td><font face='verdana' size='2' color='black'>Return Message</td><td>$message</td></tr>";
    print "<tr><td><font face='verdana' size='2' color='black'>$msga[1]</td><td>$msgb[1]</td></tr>";
    print "<tr><td><font face='verdana' size='2' color='black'>$msga[2]</td><td>$msgb[2]</td></tr>";
    print "<tr><td><font face='verdana' size='2' color='black'>$msga[3]</td><td>$msgb[3]</td></tr>";
    print "<tr><td><font face='verdana' size='2' color='black'>$msga[4]</td><td>$msgb[4]</td></tr>";
    print "<tr><td><font face='verdana' size='2' color='black'>$msga[5]</td><td>$msgb[5]</td></tr>";
    print "<tr><td><font face='verdana' size='2' color='black'>$msga[6]</td><td>$msgb[6]</td></tr>";
    print "<tr><td><font face='verdana' size='2' color='black'>$msga[7]</td><td>$msgb[7]</td></tr>";
    print "<tr><td><font face='verdana' size='2' color='black'>$msga[8]</td><td>$msgb[8]</td></tr>";
    print "</table>";
    
    print "<form method='get' action='ctdi.php'>";
    print "<input type='submit' value='Return to Menu'>";
    print "</form>";
    
    ?>

  • #8
    Regular Coder
    Join Date
    Feb 2005
    Location
    Atlanta, GA
    Posts
    171
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Arrow SoapFault exception

    I am new to PHP and web services, so this may be a simple nothing to some of you, but I would really appreciate the help. What am I doing wrong in this script?

    Code:
    <?php
                 ini_set('display_errors','1');
    	error_reporting (E_ALL);
    
        $GetUserName = new SoapClient("http://idm.east.dev.cox.net/idmwebservices/CoxIdentityServices?wsdl");
    
        $account = array("GetAllAccountInfoAcctNbr" => "6111027582601");
        $username_r = $GetUserName->username($account); <= line 11
        $userId_r   = $GetUserName->userId($account);
    
        echo "<br>Account: $account";
        echo "<br>User Name: $username_r";
        echo "<br>User ID: $userId_r";
    
     ?>
    Here is the message:

    Fatal error: Uncaught SoapFault exception: [Client] Function ("username") is not a valid method for this service in /www/zendcore/htdocs/cox/GetAccountInfo.php:11 Stack trace: #0 [internal function]: SoapClient->__call('username', Array) #1 /www/zendcore/htdocs/cox/GetAccountInfo.php(11): SoapClient->username(Array) #2 {main} thrown in /www/zendcore/htdocs/cox/GetAccountInfo.php on line 11

  • #9
    Regular Coder
    Join Date
    Feb 2005
    Location
    Atlanta, GA
    Posts
    171
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Sorry. Meant to put this as a new thread...

  • #10
    Banned
    Join Date
    Jun 2007
    Location
    Web Designer
    Posts
    321
    Thanks
    0
    Thanked 6 Times in 6 Posts
    Quote Originally Posted by tdavis View Post
    I am new to PHP and web services, so this may be a simple nothing to some of you, but I would really appreciate the help. What am I doing wrong in this script?

    Code:
    <?php
                 ini_set('display_errors','1');
    	error_reporting (E_ALL);
    
        $GetUserName = new SoapClient("http://idm.east.dev.cox.net/idmwebservices/CoxIdentityServices?wsdl");
    
        $account = array("GetAllAccountInfoAcctNbr" => "6111027582601");
        $username_r = $GetUserName->username($account); <= line 11
        $userId_r   = $GetUserName->userId($account);
    
        echo "<br>Account: $account";
        echo "<br>User Name: $username_r";
        echo "<br>User ID: $userId_r";
    
     ?>
    Here is the message:

    Fatal error: Uncaught SoapFault exception: [Client] Function ("username") is not a valid method for this service in /www/zendcore/htdocs/cox/GetAccountInfo.php:11 Stack trace: #0 [internal function]: SoapClient->__call('username', Array) #1 /www/zendcore/htdocs/cox/GetAccountInfo.php(11): SoapClient->username(Array) #2 {main} thrown in /www/zendcore/htdocs/cox/GetAccountInfo.php on line 11
    May be it is an authentication problem.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •