Jump to content
Larry Ullman's Book Forums


  • Posts

  • Joined

  • Last visited

  • Days Won


Posts posted by Edward

  1. Okay, I called my isp and got the address below. This took care of the previous error. Is this the only thing I need to change with the setting below? So the e-mail address in my config.inc.php and register.php files don't really matter? I have two more issues described below.


    [mail function]

    ; For Win32 only.

    ; http://php.net/smtp

    SMTP = mail.mediacombb.net

    ; http://php.net/smtp-port

    smtp_port = 25


    ; For Win32 only.

    ; http://php.net/sendmail-from

    ;sendmail_from = postmaster@localhost



    Chpt 4 logging in:

    When I type a previously registered email address (I verified that these email addresses are in my user table) and click forgot password, I get the following error. Example of e-mail address: Brooke@mchsi.com. (this is what I am entering as it is in the user table).

    Object not found!


    The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

    If you think this is a server error, please contact the webmaster.

    Error 404


    01/30/12 20:51:22

    Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1


    Error when logging in with password (This file is according to the book and my dbc is defined in my config.inc.php file and my user table is updating when the users register the first time.):

    An error occurred in script 'C:\xampp\htdocs\includes\login.inc.php' on line 6:

    Undefined variable: dbc


    This is the first part of my login.inc.php file:



    //empty errors for storing errors:

    $login_errors = array();

    //Validate email address:

    if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)){

    $e = mysqli_real_escape_string($dbc,$_POST['email']);


    $login_errors['email'] = 'Please enter a valid email address!';



    My old thread may help on the dbc undefined error http://www.larryullman.com/forums/index.php?/topic/940-undefined-variable-dbc/

  2. Hey Larry, i wanted to ask you, since you are a fan of Yii, could you add in a Yii framework forum into the forum maybe somewhere at the bottom so we could put our questions and stuff in there.


    Yii is absolutely awesome, it has helped me to understand the use of objected orientated code and also helped me almost immediately see how the MVC (Model View Controller) System works. This framework is just so great, it saves time tremedously.

  3. This is a subject that I am also interested to hear. I have also seen this mentioned in an oreilly book, the author said if you are worried about two users accessing the same row of a table then you should lock the tables. He also mentioned that this method would slow down the website performance substantially. I have three books on Ecommerce development and none of them lock tables, but as I said on one of my previous posts Larry Ullman has the best book on the market. You will find with orielly books that one author tends to rub off another, whereas Larry has his own uniqueness in ease of expression, his books are just laid out more logically and easy to follow. The other thing I want to comment on is that u can't expect one book to cover everything you need especially in the world of eccomerce today, these books are merely starting points.


    Okay I think I have rambled on enough for one day. Let's wait for the answer.

  4. Assuming that your index.php file is in the htdocs folder, then try this


    define ('BASE_URL', '/')


    I have my site setup like this


    define ('BASE_URI', 'http://localhost/knowledge_is_power/');
    define ('BASE_URL', '/www/');
    define ('PDFS_DIR', BASE_URI . '/pdfs/'); // Added in Chapter 5.
    define ('MYSQL', '/includes/mysql.inc.php');


    I am also using the xampp localhost for running the knowledge is power website, the location of my index.php file is here




    And on the c drive it is located at




    This should be enough info for you to figure it out if the above what i have written doesn't happen to work.

  5. If i can get this yii framework installed successfully, i will work through your tutorial first before i start on anything else. I will let you know how it goes.


    I will be finishing of your Effortless E-Commerce but i would like to learn the Yii at the same time with some OOP stuff to keep things interesting.

  6. Zend Server is not the same thing as the Zend Framework. The Zend Framework is free.


    I personally prefer Yii and only use Zend for specific tasks. I tried once to use ZF as the basis of a site and really didn't care for it.


    Okay I'm going to go with the Yii framework I've just ordered the two books on the front of the yii framework website. Larry you may notice a slight increase in your income this month I've also ordered four of your books. I also got two of the object orientated books you were recommending. Well I am very excited about learning yii and the oop stuff, there is no turning back now. Thanks to you guys for helping me to come to a decision.

  7. I was thinking about pictures again today, I know why they would be cool. For example I will be making some alterations to the Knowledge is power website and I would like to put up my screen shot. Just imagine if others did this also, people who did not have the book would get inspiration from what readers of the Ullman book had created them self and get confidence to buy.

  8. I've been using that site to get the weather information I need. My questions are 1. how do I code the xmlhttprequest to get round the cross server issue and 2. how do I grab hold of the xml data it returns and pass it to my php script which processes it?


    Back last year when I first learned basic php, mysql and JavaScript there was an exercise in the book where we had to extract XML data from the yahoo news website page I think it was an rss feed. I had a look at your weather site but you can only get a trial period, but what I am wondering is where do you need to have the weather forecast for exactly?

  9. Thanks I will put my order in at amazon for these. I would like to get the first PHP book also, as I have some other authors book but I like the way you break into topics and explain them. It will be a reference guide for me.


    I have a book on php with OOP, I did read the quick start guide but then after in the book was mainly about the php 5 OOP library and functions. There is lack of example on how to adapt in the real life situation.

  10. Hi, Larry i am sorry about all these questions but i need to ask you?


    I am working through Effortless E-ccomerce book now as you know to work out how the MVC model works. But i would really like to get into the Object Orientated Programming so i can work with frameworks etc, i would like to know is your PHP Advanced book ideal for learning this stuff? I got inspiration from your loyal member Jonathon noticing he was working with the Yii framework and using OOP code. Or is there another way we should go about learning this OOP stuff, what do you suggest?


    I am planning to put my order in at Amazon.com this week to get


    PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)


    PHP for the Web: Visual QuickStart Guide (4th Edition)


    PHP 5 Advanced: Visual QuickPro Guide


    MySQL, Second Edition

  11. Well which is the php script that will receive the GET data forecast.php?


    The values passed after the .php will be part of the GET so you can extract through values individually from the $_GET array if you know what they are. The extraction takes place on your forecast.php, the script where the variables were passed to. You could process that xmlhttprequest and if the values are sent to forecast.php, see what values come in the URL if you are unsure of what they are.

    • Upvote 1
  12. I am not struggling with this Jonathon, i simply placed the mysql.inc.php below the root directory. When i run the index.php, it was running the mysql.inc.php code but was not storing the variable $dbc in memory so that it was unavialable globally. I am using Windows 7, Larry is using a Mac, well i got confused with Larry's book Page.54 Figure 3.2, it shows the apple operating system there. It seems to show in the book the mysql.inc.php below the root directory there??


    Everything with regards to the PHP server scripting language i am happy with.


    I have two other books here on E-commerce development both are in OOP, but the first one uses the three tier architecture which is not the same as MVC and the second is a OOP MVC framework. I have to admit the second book was too much for me, as at the moment i am not completely familar with what MVC is, so thats why Larry's book is perfect for me, it is helping me to see the structure while we are coding basically with procedural. The reason for me doing these books is because i don't want to be writing how i feel spaghetti type code which will be impossible to fix later on, i want to fully understand the MVC approach and use this method.

  13. Well i hope Larry's next book will be "E-Commerce with PHP and MySQL the Object Orientated way". The market is lacking a good book like that at the moment, there are framework books in OOP for E-commerce and Social networks but not an all in one.


    I will have a look at the YII and see how it fits together!


    Thanks again.

  14. Hey Larry, i tried to insert images into the forum but i keep getting this message "You are not allowed to use that image extension on this community." This was via the image url method, so an image could be loaded from a url.


    Would you be able to make it so we can load our picture's in directly.

  15. An error occurred in script 'C:\xampp\htdocs\knowledge_is_power\www\index.php' on line 38:

    mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given


    "Well this is not working because i have no data in my pages table yet, okay all done proceeding on..."


    Extract from index.php to show line 38 in red:


    <?php // Bonus material! Referenced in Chapter 5.

    // Display the most popular pages:

    echo '<h3>Most Popular Pages</h3><p>';


    $q = "SELECT COUNT(history.id) AS num, pages.id, pages.title FROM pages, history WHERE pages.id=history.page_id AND history.type='page' GROUP BY (history.page_id) ORDER BY num DESC LIMIT 10";

    $r = mysqli_query($dbc, $q);


    $n = 1; // Counter

    while ($row = mysqli_fetch_array($r, MYSQLI_NUM)) {


    // Display each record:

    echo "<h4>$n. <a href=\"page.php?id=$row[1]\">$row[2]</a></h4>\n";


    // Increment the counter:



    } // End of WHILE loop.

    echo '</p>';


  16. Finally i figured it out. It was my mistake i had misunderstood what you had written Larry, I put the mysql.inc.php file below the root directory and not in the /includes/ directory above the root folder. The index.php file was running the mysql.inc.php script but was not saving the variable $dbc for global use. That is something now i don't even understand why it doesn't work. But now its all fine while in the includes.


    Haha i have a new error now, more detective work for me today, eh!


    An error occurred in script 'C:\xampp\htdocs\knowledge_is_power\www\index.php' on line 38:

    mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given

  17. For people wondering what the disabling part in the "php.ini" file looks like for Magic Quotes here is a copied


    ; Magic quotes are a preprocessing feature of PHP where PHP will attempt to

    ; escape any character sequences in GET, POST, COOKIE and ENV data which might

    ; otherwise corrupt data being placed in resources such as databases before

    ; making that data available to you. Because of character encoding issues and

    ; non-standard SQL implementations across many databases, it's not currently

    ; possible for this feature to be 100% accurate. PHP's default behavior is to

    ; enable the feature. We strongly recommend you use the escaping mechanisms

    ; designed specifically for the database your using instead of relying on this

    ; feature. Also note, this feature has been deprecated as of PHP 5.3.0 and is

    ; scheduled for removal in PHP 6.

    ; Default Value: On

    ; Development Value: Off

    ; Production Value: Off

    ; http://php.net/magic-quotes-gpc

    magic_quotes_gpc = Off


    ; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.

    ; http://php.net/magic-quotes-runtime

    magic_quotes_runtime = Off


    ; Use Sybase-style magic quotes (escape ' with '' instead of \').

    ; http://php.net/magic-quotes-sybase

    magic_quotes_sybase = Off

  • Create New...