Jump to content
Larry Ullman's Book Forums

Max

Members
  • Posts

    112
  • Joined

  • Last visited

Posts posted by Max

  1. Hi everyone

     

    Regarding window.open (page 320 - 322), is there a way of using this function without declaring the window (first argument) when opening with <a href>? The reason I ask is that I am writing a program in php that allows clients to select a lawnmower by various criteria (e.g. lawn size, whether they need stripes, mulcher) which will then list, say, 6 models that are suitable. The client can then click on the highlighted model name to open a new window with all of the technical specifications, images etc. I can do this easily just using html but can't control the size of the destination window (I know you don't like us doing this, Larry, but if the new window opens to full size, the client is in danger of getting lost, as well as it being neater when the client has clicked on more than one model.)

    I can insert the js code into the html using php but it seems a bit redundant and I would prefer to call the js file as recommended on the bottom of page 24 (unobtrusive javascript).

  2. Hi Larry

     

    I was terribly confused when working through 'tasks.js' which I downloaded from your web site until I realized that 'tasks.html' was calling 'tasks2.js'......Am I missing something here as 'tasks.js' has the following code which doesn't seem to do anything but seems useful:...

     

    // Update the page:

    message = 'You have ' + tasks.length + ' task(s) in your to-do list.';

    if (output.textContent !== undefined) {

    output.textContent = numbers;

    } else {

    output.innerText = numbers;

    }

     

    P.S. The book is fantastic!

  3. Hi DebP

     

    I have been writing php and MySQL for a couple of years now and have only ever used a server. Nowadays they are so cheap it isn't worth messing about if you can't get Apache to work on your PC. Set up Filezilla or similar for your ftp and register with a server company (there are many). Spend as much time as necessary to set up user permissions and SQL tables etc. and then just upload your php texts and run them live. You can stop people finding your site by accident by using the html 'meta name="robots" content = "noindex"' tag in your header.

    I have followed Larry's book from beginning to end and although I have been frustrated to the point of tears many times, this is absolutely no reflection on the book, which I think is great. Just remember the the S's...Syntax, Syntax, Syntax.

  4. Hi Josee,

     

    No, views are new to me, but look very powerful. Isn't there a danger of clogging up the server - presumably the view has to be re-created (or updated) - see Larry's post 23 August 2011 - 5:39 AM - with a large amount of data every time there is an enquiry?

     

    Just one question - don't understand the bracketed u and i ..are they just some extraneous html??.........

     

    CREATE VIEW the_name_of_the_view AS

    SELECT *

    FROM table1

  5. For some years I have used a server when developing php scripts but now need to use resident php/MySQL on my laptop. I have changed passwords as instructed on pp 594 using phpMyAdmin from the Control Panel, and in config.inc.php. Oddly, MySQL allows me into tables and the like but now refuses access to the home page:...

     

    localhost / phpmyadmin / index.php?db=db etc. etc. Any explanation?

    (Spaces are to prevent the forum from creating a link)

     

    I have installed the whole kaboodle via Apache friends and php scripts work fine. However, when I use the 1and1 server, I can program it to automatically look at a subdirectory (e.g. main/index.php) when a URL is called (e.g. www.sonningmowers.com).

     

    The question is - how can I do that in php on the laptop? Is it the line in config.inc.php:

     

    $cfg['Servers'][$i]['user'] = 'root';

     

    and should I change it to:

     

    $cfg['Servers'][$i]['user'] = 'main/root';...or the like?

     

    Thanks for the support.

  6. Hi Larry

     

    This is the URL of a very simple test program that I wrote to simplify matters:

     

    file:///D:/xampp/htdocs/phptest.php

     

    Code:

     

    <?php

    $x = 5;

    $y = 6;

    $z = $x * $y;

    echo $x . $y . $z;

    ?>

    In www.sonningmowers.com/phptest.php it gives the expected 5630. On the laptop I just get a blank screen (Firefox) and a source code which is the php script.

     

     

    Apache, MySQL and Filezilla are all ticked and 'RUNNING' according to XAMPP Control Panel.

     

    http://localhost/xampp/ shows:

     

     

    MySQL database ACTIVATED

    PHP ACTIVATED

    HTTPS (SSL) ACTIVATED

    Common Gateway Interface (CGI) ACTIVATED

    Server Side Includes (SSI) ACTIVATED

    SMTP Service DEACTIVATED

    FTP Service ACTIVATED

    Tomcat Service DEACTIVATED

     

     

    HTTP Headers:...

     

     

    HTTP Request GET /xampp/phpinfo.php HTTP/1.1

    Host localhost

    User-Agent Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1

    Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

    Accept-Language es-es,es;q=0.8,en-us;q=0.5,en;q=0.3

    Accept-Encoding gzip, deflate

    Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7

    DNT 1

    Connection keep-alive

    Referer http://localhost/xampp/navi.php

    PHP:...

     

    PHP Version 5.3.8

     

    I can't help feeling that I'm missing something simple and that (as with many times in the past) I will find the answer in your book, but it escapes me at the moment.

     

    As said before, I have had PHP MySQL running on the same laptop in the past but probably on the C: partition. Unfortunately, C: seems to be being hogged by Windows updates etc.so have to use D:

     

    As always, help very much appreciated.

  7. Hi Paul

     

    Thanks for your input.

     

    The website home page is www.sonningmowers.com/html which then loads the various .php pages (e.g. about us) and which works fine on 1and1 server. When I run it on the laptop and call other pages, they don't hook into php. XAMPP is running with php and mysql with svc ticked and 'Running' showing for both. phpinfo() gives me PHP version 5.3.8. I have tried your suggestion but no dice. Both the code and php are running out of the D: drive (partition). Hmmm. Baffling.

  8. Hi all,

    Please take a quick look at the following code which is a page for calculating the amount of fabric needed for curtains and blinds.

     

    <?php
    # fabric_enquiry.php
    // Di's Soft Furnishings fabric enquiry page
    // Starts with the header include
    //Header include has links to home, curtains, blinds and other sf
    //Page title
    $page_title = "Di's Soft Furnishings - fabric quantity enquiry";
    include ('includes/header.html');
    ?>
    <h1>How much fabric do you need?</h1>
    <?php
    include ('includes/fabric_enquiry_curtains_inc.php');
    include ('includes/fabric_enquiry_rblinds_inc.php');
    ?>
    <h3>Other links</h3>
    <a href="quote.php">Get a quote for curtains and Roman Blinds</a><br />
    <a href="measure_curtains.php">How to measure for curtains</a>
    <br /><br />
    <a href="login.php">Log in to retrieve a quote</a>
    <?php
    include ('includes/footer.html');
    ?>
    

     

    As you can see I'm weaving php and html togethor, a bit of one then the other. A general question, but what's the guidance for whether I should use echo and 'stay' in php. For instance I could write the <h1> header as:

    echo '<h1>How much fabric do you need?</h1>';

     

    Is one way better to use than the other or is it just personal taste? Thinking about it my thought would be that the less times you go in and out of php the less the server needs to work and the faster the page loads. But, of course, I could be talking complete cobblers!

     

    Cheers

    Paul

     

    Hello Paul

     

    I use both echo and html and it is a matter ot taste. Echo requires more careful thought about use of punctuation. If I have some html that works on its own, then I insert it a html as opposed to using echo.

  9. Hi Larry

    I have been using your book for some time now (I was a poster about 3 years ago on this forum) and have to say that it still amazes me what a comprehensive and well written publication it is. I wish you would write a javascript tome in the same manner.

    The question is that I have installed php and MySQL onto the D: drive of my XP Home laptop using XAMPP from www.apachefriends.org and it now appears to run well according to the XAMPP Control Panel showing Apache and MySQL "Running" but when I run a php program using Firefox it appears that php is not actually running. The browser displays the html part of the php program and looking at the Firefox source code, one can see the php code. This software works perfectly on the 1and1 server. Am I missing something?

×
×
  • Create New...