Jump to content
Larry Ullman's Book Forums

Placid

Members
  • Posts

    12
  • Joined

  • Last visited

Posts posted by Placid

  1. It may be the worst question in the forum, but I really need to ask.

    If WordPress can do so much so easily, why do we need to learn PHP frameworks, such as Laravel, that seem so hard. What can be built with these frameworks that is in demand.

    Please don't be annoyed with the naivety of the question. I would really appreciate some insights regarding this matter.

  2. I have an HTML table generated by PHP querying from MySQL table.

        <table>
           <tr>
              <th>Sl</th>
              <th>ID</th>
              <th>Article Name</th>
              <th>Publish Status</th>
           </tr>
           <?php
              $i = 1;
              foreach ($obj->showAllFromTable('pattern') as $pattern) {
              extract($pattern);
              ?>
           <tr>
              <td><?php echo $i++; ?></td>
              <td><?php echo $id; ?></td>
              <td><?php echo $pattern_name; ?></td>
              <td id="publish_<?php echo $id; ?>" class="status_pattern">
                 <?php echo $publish; ?>
              </td>
           </tr>
           <?php
              }           
              ?>
        </table>

    I want to change the status of any article by clicking on the 'publish' cell of the corresponding article row. I am trying to use ajax method of jquery for this purpose as shown in the following:

        <script type="text/javascript">
        $(document).ready(function(){    
        $('.status_pattern').click(function(){
            var thisid = $(this).attr('id');
            
            $.ajax({
                url: "status_change_pattern.php",
                data: {
                    id: thisid
                },
                success: function (response) {
                    alert(response);
                }
            });
        });
        });
        </script>
    In the "success" block, instead of "alert", I want to create a functionality to change the text of the specific cell which I clicked. The "status_change_pattern.php" has just a text "Hey Hey".
    Can anyone help? Please.
    Thanks.

  3. Dear Larry Sir,

     

    Since I am new and I don't want to give you any wrong picture, I want to go into details.

     

    I have deleted and recreated the 'users' table as follows:

    CREATE TABLE users (
    user_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
    first_name VARCHAR(20) NOT NULL,
    last_name VARCHAR(40) NOT NULL,
    email VARCHAR(60) NOT NULL,
    pass CHAR(40) NOT NULL,
    registration_date DATETIME NOT NULL,
    PRIMARY KEY (user_id));

     

    In phpMyAdmin, the 'SHOW COLUMNS FROM users' command shows the following table:

     

    Field                            Type                                  Null     Key       Default     Extra

    user_id                         mediumint(8) unsigned      NO       PRI        NULL        auto_increment

    first_name                    varchar(20)                        NO                    NULL

    last_name                    varchar(40)                        NO                    NULL

    email                            varchar(60)                        NO                    NULL

    pass                             char(40)                             NO                    NULL

    registration_date          datetime                             NO                    NULL

     

    Then, I tried to insert a new record without 'last_name' by the following code (as per second syntactical example on page 128 which says every column must be provided a value, even if it's NULL):

    INSERT INTO users VALUES (NULL, 'Placid', NULL, 'placid@example.com', SHA1('nothing'), NOW())

     

    The phpMyAdmin shows: #1048 - Column 'last_name' cannot be null

     

    Then I tried the first method on Page 128 and inserted a record using the following code:

    INSERT INTO users (first_name, email, pass, registration_date)
    VALUES ('Placid', 'placid@example.com', SHA1('nothing'), NOW());

     

    This time, the insert was successful. And the 'SELECT * FROM users' shows all the fields keeping the last_name field as blank.

     

    I hope I am clear.

     

    Finally, I thank you for your reply. I have grown huge respect for you reading your book. I am really learning. Thanks again.

     

    Placid

  4. Dear Masters,

     

    I am creating the first table columns in mysql client following the instructions in Ch 5 page 125.

     

    I have added the first_name and last_name columns with attribute "NOT NULL" but the "SHOW COLUMNS from users" shows the default values as "NULL".

    My codes are:

     

    CREATE TABLE users (

    user_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,

    first_name VARCHAR(20) NOT NULL,

    last_name VARCHAR(40) NOT NULL);

     

    The book says that mysql will change the user_id column to NULL for better performance. It does not say anything about the other columns and the books result image show that only the user_id has default value of NULL and others have blank values under the Default column.

     

    Can any one please tell me what's the problem here.

    Much appreciate.

    Thanks

    Placid

  5. Dear HartleySan,

    The following messages come when I start XAMPP (though the examples in the first Chapter are working accurately). Can you please give me a hint if I need to do anything about these.

    10:53:12 AM [main] Initializing Control Panel

    10:53:12 AM [main] Windows Version: Windows 7 Ultimate 64-bit

    10:53:12 AM [main] XAMPP Version: 1.8.0

    10:53:12 AM [main] Control Panel Version: 3.0.12 [ Compiled: June 24th 2012 ]

    10:53:12 AM [main] You are not running with administrator rights! This will work for

    10:53:12 AM [main] most application stuff but whenever you do something with services

    10:53:12 AM [main] there will be a security dialogue or things will break! So think

    10:53:12 AM [main] about running this application with administrator rights!

    10:53:12 AM [main] XAMPP Installation Directory: "c:\xampp\"

    10:53:12 AM [main] Initializing Modules

    10:53:12 AM [apache] Apache Service Detected With Wrong Path

    10:53:12 AM [apache] Uninstall the service manually first

    10:53:12 AM [apache] Possible problem detected!

    10:53:12 AM [apache] Port 80 in use by "httpd.exe"!

    10:53:12 AM [apache] Possible problem detected!

    10:53:12 AM [apache] Port 443 in use by "httpd.exe"!

    10:53:12 AM [mysql] MySQL Service Detected With Wrong Path

    10:53:12 AM [mysql] Uninstall the service manually first

    10:53:12 AM [mysql] Possible problem detected!

    10:53:12 AM [mysql] Port 3306 in use by "mysqld.exe"!

    10:53:12 AM [main] Starting Check-Timer

    10:53:12 AM [main] Control Panel Ready

     

    I appreciate your response.

    Thanks

    Placid

  6. Dear Masters:

     

    I am very new to to PHP & MySQL.

     

    I have just followed the instruction in the book to install XAMPP (v 3.0.12) on my Windows 7 PC.

     

    I tested PHP as per the instruction and it was successful.

     

    But testing PHP and MySQL failed and showed the following error:

    Fatal error: Call to undefined function msqli_connect() in C:\xampp\htdocs\mysqli_test.php on line 2

     

    I am almost sure I followed the instructions exactly. But the above error comes.

     

    I looked for solutions in other posts but could not find it.

     

    Anyone, please help.

     

    Thank you.

    Placid

  7. Dear Masters:

     

    I am new to JS, learning it first from this book. Completed sequentially upto Ch 6.

    Now I am stuck at Chapter 6, Pursue Problem No. 3 - "Update the original tasks.js so that the output also shows a random task."

     

    I have tried many ways but unable to generate a purely random task.

     

    Can any one help, please.

     

    I am using:

    Browser: Firefox 13.01

    OS: Windows 7

    IDE: Aptana Studio 3

     

    P.S. My gratitudes to Sir Ullman for this awesome book. I have tried many but started to really learn from here.

     

    Thank you.

     

    Placid

×
×
  • Create New...