Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'variables'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 4 results

  1. Hello Larry, First of all, I'm very glad I got your book. I'm re-learning PHP from scratch and I wished I had a book like yours in the early 2000s In chapter 6, handle_reg.php, I'm a bit troubled by the variable $age. $age should only exist within "if ($_POST['year'] < 2016) {...}" // Validate the year: if (is_numeric($_POST['year']) AND (strlen($_POST['year']) == 4)) { // Check that they were born before 2016 if ($_POST['year'] < 2016) { $age = 2016 - $_POST['year']; // Calculate age this year } else { print '<p class="error">Either you entered your birth year wrong or you come from the future'; $okay = false; } But still, you can call it like a global variable at the bottom of the page: // If there were no errors, print a success message: if ($okay) { print '<p>You have been successfully registered (but not really).</p>'; print "<p>You will turn $age this year.<p>"; print "<p>Your favorite color is a $color_type color.<p>"; } In another programming language, I would have defined it as a global variable at the top, then update it later on. Is it a common thing in PHP? Thanks a lot for your time. Cheers!
  2. Hi Larry, I haven't been on the forum in a while - what I have learned from your books so far has kept me going nicely. But I needed to create a whole slew of PHP variables with similar names and came across the ability to create them dynamically. In case it is of interest to forum readers, here's my code (from a MySQL select result): while (list($var1, $var2, $var3, $var4) = mysqli_fetch_row($result)) { ${"title_" . $var1 . "_" . $var2} = $var3 . ", " . $var4; } This creates PHP variables of the form $title_n_m where 'n' will be the value of $var1 and 'm' will be the value of $var2. Works like a treat - I was quite amazed! All the best from Oz, Cheers.
  3. From the book: Create two different name variables, using the existing first- and last-name variables: $ name1 = '$ first_name $ last_name'; $ name2 = "$ first_name $ last_name"; Technically speaking-- why aren't $name1 and $name2 arrays? I keep telling myself that arrays are variables with two or more values.
  4. Version 0.5 Page 125 Larry, please provide and example to show us how this would work: "{TIP} Most of the time you use renderPartial() within one view file, you’ll want to pass along the variables it received to the other view file." Thanks.
×
×
  • Create New...