Jump to content
Larry Ullman's Book Forums

shanna

Members
  • Posts

    9
  • Joined

  • Last visited

Posts posted by shanna

  1. I am trying to understand how functions.php works..

    i don't understand well, function is-administrator() .

    When we login,at login.php , we always have to give same email and password that's written in the script to login,otherwise it fails to login. so is that the admin? if so, why check every time?

      and cookies are bit confusing! are they just random values.. they are linked only to admin?

     

    if other than admin logs in, how is it going to work with login.php page? guess it wont lets in,right?

     

    and mysqli_connect.php file, I can save it outside xampp/htdoc,,?

    like just at any other folder at C:\test\mysqli_connect.php ?

     

  2. hi,

     Page 228, sending email, register.php, i am getting error/warning as:

     

     Warning: mail(): SMTP server response: 553 We do not relay non-local mail, sorry.

     

    ​what do I have to do? its from this line:

    mail($_POST['email'], 'Registration Confirmation', $body, 'From: admin@example.com');

     

    how do I enable mail? I checked Appendix A, but its not clear.

     I had installed Mercury along with xampp for windows ..

     please help..I am almost done, if I get this I can complete last chapter 13 and then go to next book!. 

     

  3. i have a problem with edit_entry.php example.(page number 383)

    after i update blog, its still saying update both title and entry.

     

     if (!empty($_POST['title']) && !empty($_POST['entry'])) {

      $title=mysqli_real_escape_string($dbc, trim(strip_tags($_POST['title'])));
      $entry=mysqli_real_escape_string($dbc, trim(strip_tags($_POST['entry'])));
     

    Looks like If statement is not working there..

    I need help!

    Thank you.

  4. I am working on chapter 12 and was able to connect to MYSQL database successfully, (example 12.1)

     But examples, 12.3 and 12.4, creating table and adding data to a table, I have problems:

      first,After creating a table and run the program, I don't get a message saying "The table has been created!" I get a blank screen.

      but if I go and check with phpmyadmin, I see a table name, columns that are created .

     

    then 2nd problem is when I run adding_data.php example, again I get a blank screen ..

    I checked with syntax and everything, ..

    I am using  (localhost, llama, camel, myblog) llike in the example..

      Please some one help..

    thank you.

  5. Thanks for the nice words and for the interest in more of my books. I really appreciate it! After the PHP for the Web, you should read "PHP and MySQL". There is some overlap, but always different examples and it goes into much greater detail. The Advanced PHP book is a bit of a jump from the PHP for the Web.

     

    Hope that helps and thanks again!

    Thank you for your response.it really helped me in deciding to choose a book. i would definetly buy PHP and Mysql . 

    After i finish these 2 books , is it possible to apply for job with out knowing advanced PHP in depth? 

  6. i changed my uploads folder to

    ..C:/uploads/{$_FILES...

     

    then i am getting error as:

     

    Warning: move_uploaded_file(..C:/uploads/sun-flower.jpg): failed to open stream: Invalid argument in C:\xampp\htdocs\PHPexamples\chapter11\upload_file.php on line 11

    Warning: move_uploaded_file(): Unable to move 'C:\xampp\tmp\php968F.tmp' to '..C:/uploads/sun-flower.jpg' in C:\xampp\htdocs\PHPexamples\chapter11\upload_file.php on line 11

    Your file couldnot be uploaded because :something unforeseen happend.

    Upload a file using this form:

     

     

      guess i am making simple mistake in making /creating folder or addressing it...which i am not able to get it !

  7. !doctype html>

    <html lang="en">

    <head>

    <meta charset="utf-8">

    </head>

    <body>

    <?php

     

    if ($_SERVER['REQUEST_METHOD'] == 'POST'){

    if (move_uploaded_file($_FILES['the_file']['tmp_name'],"C:\uploads\{$_FILES['the_file']['name']}")) {

    print '<p>your file has been uploaded.</p>';

     

    }else {

    print '<p style="color:red;">Your file couldnot be uploaded because :';

     

    switch ($_FILES['the_file']['error']) {

    case 1:

    print 'the file excceeds the upload_max-file size setting in php.oni';

    break;

    case 2:

    print 'The file exceeds the max-FILE_SIZE SETTING IN THE HTML FORM';

    break;

    case 3:

    print 'The file was only partially uploaded';

    break;

    case 4:

    print 'No fil was uploaded';

    break;

    case 6:

    print 'The temporary folder does not exixts,';

    break;

    default:

    print 'something unforeseen happend';

    break;

    }

    print '.</p>';

    }

    }

    ?>

     

    <form action="upload_file.php" enctype="multipart/form-data" method="post">

    <p> Upload a file using this form:</p>

    <input type="hidden" name="MAX_FILE_SIZE" value="300000">

    <p><input type="file" name="the_file"></p>

    <p><input type="submit" name="submit" value="upload this file"></p>

    </form>

    </body>

    </html>

     

    when i try to run this i get this error:

    Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\xampp\htdocs\PHPexamples\chapter11\upload_file.php on line 10

     

     not understanding move_uploaded_file() function here.

     if i am right, i should be able to upload any file from PC and load it to uploads folder?

     its bit confusing and not clear ,,page 318-320 ..

    i didnt even get html form to upload any file.

    i had saved jpg file in some different directory and wanted to upload that and move it to uploads folder..

    please some one explain.

    thank you.

     

  8. I ​started learning PHP for the web,5th edition..I really like this book, so easy to follow

    and very interesting.

      After finishing this book which book do you recommend to go to next level in learning.

    I have a programming experience long back in Engineering college. After a long break trying to get into IT entry level position.

    your book really gave me interest to learn and would like to continue..

    please help me out with which book I should buy next..

    is it Advanced PHP or PHP and MySQL,,?

    Thank you,

    .

×
×
  • Create New...