Jump to content
Larry Ullman's Book Forums

jabsalud

Members
  • Posts

    33
  • Joined

  • Last visited

Posts posted by jabsalud

  1.  

    Sure, go ahead, StephenM. Sounds exciting.

    Also, jabsalud, sorry for making the wrong assumption. The way you phrased everything made it sound like it was a school assignment or something. That's why I was a bit apprehensive to answer before.

     

    Anyway, StephenM, if your solution works, great, but I think the following is much simpler:

    <?php
      
      for ($i = 0; $i < 8; $i++) {
        
        echo (($i % 2 === 0) ? $i * 2 : -$i - 1) . '<br>';
        
      }

    thanks stephenM and hartleysan i really appreciate your works, your codes work perfect thanks again

  2. no its not an assignment. i have tried it but the output is this 

     

    +2

    0

    4

    8

    12

    +4

    0

    4

    8

    12

    +6

    0

    4

    8

    12

    +8

    0

    4

    8

    12

    so what i am asking is i cant separate the loop that will increment by 4.  what i wanted to do is to alternate them by two's as i have given the output. its not an assignment trust me. all im asking is for your help i need the actual code to compare to my answer. anyone of you could help me? its just an example and part of my studying the "nested loops".

  3. hi sir before considering this book i have one question. have you also covered jquery, ajax here? i mean discussed it in clear? or just focusing on javascript? i'm sorry for this question but i'm completely new to this language. I have browsed the net and some forums giving me advice to learn jquery and ajax. so i am wondering if you discussed it clearly too in this book. many thanks sir

     

    example like topics in making modal form in jquery something like that.

  4. i'm currently confused on how to resized an image without losing its quality. for example i have 1920x1080 picture and i resized it to 400x225 i am bit satisfy as it succeeded but the things is that, the picture losed its resolution. my formula is here: new height = (original height/original width) * new width and vice versa. while maintaining the aspect ratio i noticed that the resolution degrades and get pixelated. any advice sir?

  5. mysql returns an error on an update query if nothing has been updated. How this scenario is handled for the user is a developer decision. You can trap the error and handle it in a user friendly way or you can give the user an opt out button.

     

     

    larry's code in chapter 13 in section under edit. it works perfectly even i dont change the retrieved information at all. my concern is in chapter 12 it cannot done the same. it seems like there is something on larry's chapter'12 code an error? but if i edit it it works perfectly. argh! i'm stuck! in chapter 12.

  6. is there someone there tried not to change the retrieved title and entry and hit update button and get an error?

     

    when i run the code and did some changes it goes perfectly but when i did not make any change to the retrieved title and entry it says an error. the thing is that when i make some changes it works but when i choose not to make any changes and hit "update this entry" it says an error. isn't that the problem is you have too make an actual change? what i mean is that once i click edit i should change it atleast one letter or put space so i can update it? what if i decided not to change anything and click update?

  7. yeah i have red this before and its really good ,it taught me alot about php and mysql and now i am looking forward to take it to more advance. my very concern here is how will you connect the same database you use in programming application. for example you are programming visual basic and you use mysql as its database how will you connect that database to also use in php web developing. what i mean here is that the database is in your local computer and i want my www.example.com to fetch all informations inputted in my local computer at my home. how can i do that?

  8. hey sir i'm thinking of developing an application with mysql as it's database, i'm wondering if how can i connect that database to my php website? for example i am inputting data on my application (that's on my computer) and saved it. and latter on i want that information to be present on my website too. just like one computer application and a web application sharing at one database. so my question is, have you discussed this on your books? any advice regarding to this topic sir? thank you.

  9. hi sir

    In the php.ini, I would use the "From" address that you know works in Thunderbird. You can play with different "From" addresses in the PHP script, then. Also try different "To" addresses, starting with the one you knew worked from Thunderbird.

     

    hi sir i am having a problem. the activation message which i received in my thunder bird is successful however when i click the generated link "http://www.example.c...29aa192acc379b7" it forwards me to the this site "http://www.iana.org/domains/example/" even though in my script i wrote this "$body .= BASE_URL . 'activate.php?x=' . urlencode($e) . "&y=$a";" what might be the problem? if i cant fix it i think i cant make to it next topic because i cant activate the account created and cant login.

  10. So what happens when you reply to a current thread? Do you still get an error?

     

    I tried my post.php in response to a thread and to post a new thread and both were working. Did you setup the database and fill it in with the sample data that was provided in the sql file download for chap 17?

     

    i got it i just mispelled posts to post hooh problem was resolved! but i was still in the error of no showing the dates under "posted on" and "latest reply" what steps should i do to resolve this? i even tried copy paste the timezone ,the one i downloaded in mysql site, in this address "c:\wamp\bin\mysql" what was wrong then?

  11. I finished the message board example it all worked on my localhost. Which script are you encountering the problem on, can you print us out the php error you are receiving?

     

     

    <?php # Script 17.7 - post.php

    // This page handles the message post.

    // It also displays the form if creating a new thread.

    include ('includes/header.html');

     

    if ($_SERVER['REQUEST_METHOD'] == 'POST') { // Handle the form.

     

    // Language ID is in the session.

    // Validate thread ID ($tid), which may not be present:

    if (isset($_POST['tid']) && filter_var($_POST['tid'], FILTER_VALIDATE_INT, array('min_range' => 1)) ) {

    $tid = $_POST['tid'];

    } else {

    $tid = FALSE;

    }

     

    // If there's no thread ID, a subject must be provided:

    if (!$tid && empty($_POST['subject'])) {

    $subject = FALSE;

    echo '<p>Please enter a subject for this post.</p>';

    } elseif (!$tid && !empty($_POST['subject'])) {

    $subject = htmlspecialchars(strip_tags($_POST['subject']));

    } else { // Thread ID, no need for subject.

    $subject = TRUE;

    }

     

    // Validate the body:

    if (!empty($_POST['body'])) {

    $body = htmlentities($_POST['body']);

    } else {

    $body = FALSE;

    echo '<p>Please enter a body for this post.</p>';

    }

     

    if ($subject && $body) { // OK!

     

    // Add the message to the database...

     

    if (!$tid) { // Create a new thread.

    $q = "INSERT INTO threads (lang_id, user_id, subject) VALUES ({$_SESSION['lid']}, {$_SESSION['user_id']}, '" . mysqli_real_escape_string($dbc, $subject) . "')";

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

    if (mysqli_affected_rows($dbc) == 1) {

    $tid = mysqli_insert_id($dbc);

    } else {

    echo '<p>Your post could not be handled due to a system error.</p>'; "this is the result when i tried to submit it what might be the problem?"

    }

    } // No $tid.

     

    if ($tid) { // Add this to the replies table:

    $q = "INSERT INTO posts (thread_id, user_id, message, posted_on) VALUES ($tid, {$_SESSION['user_id']}, '" . mysqli_real_escape_string($dbc, $body) . "', UTC_TIMESTAMP())";

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

    if (mysqli_affected_rows($dbc) == 1) {

    echo '<p>Your post has been entered.</p>';

    } else {

    echo '<p>Your post could not be handled due to a system error.</p>';

    }

    } // Valid $tid.

     

    } else { // Include the form:

    include ('includes/post_form.php');

    }

     

    } else { // Display the form:

     

    include ('includes/post_form.php');

     

    }

     

    include ('includes/footer.html');

    ?>

×
×
  • Create New...