www.webdeveloper.com
Page 3 of 3 FirstFirst 123
Results 31 to 38 of 38

Thread: [RESOLVED] PHP Confirm on Delete Confusion

  1. #31
    Join Date
    May 2007
    Location
    Las Vegas, NV
    Posts
    42
    With your last post . . . I get the same fetch() issue I started with . . . Line 15. Here is the page with the code . . . this is category_db.php

    PHP Code:
    <?php
    function get_categories() {
        global 
    $db;
        
    $query 'SELECT * FROM categories
                  ORDER BY categoryID'
    ;
        
    $result $db->query($query);
        return 
    $result;
    }

    function 
    get_category_name($category_id) {
        global 
    $db;
        
    $query "SELECT * FROM categories
                  WHERE categoryID = 
    $category_id";
        
    $category $db->query($query);
        
    $category $category->fetch();
        
    $category_name $category['categoryName'];
        return 
    $category_name;
    }
    ?>

    Specifically:


    PHP Code:
        $category $category->fetch(); 


    I left the page up if you wish to see it.
    Last edited by KandiLyons; 11-23-2013 at 05:26 PM.

  2. #32
    Join Date
    Dec 2011
    Location
    Centurion, South Africa
    Posts
    792
    haha, Oops yes :P

    On line 138 in index.php. It should look like this (uncommented):

    PHP Code:
    $categories get_categories(); 
    Sorry, that was my fault.
    JavaScript: Learn | Validate | Compact

  3. #33
    Join Date
    May 2007
    Location
    Las Vegas, NV
    Posts
    42
    OMG!!!! You are a genius! I'll be staring at this code for some time to see what is different between you and me. =D

  4. #34
    Join Date
    May 2007
    Location
    Las Vegas, NV
    Posts
    42
    You have NO IDEA how incredibly happy I am right now. I can stop pounding my head!

  5. #35
    Join Date
    May 2007
    Location
    Las Vegas, NV
    Posts
    42
    Now, I have to create a NO button. I hope it's doesn't kill me.

  6. #36
    Join Date
    Dec 2011
    Location
    Centurion, South Africa
    Posts
    792
    Well, I'll leave that up to you if you don't mind. I've stayed up waaaay past my bedtime (no I'm not 10 years old, just a different timezone)
    I'll check things out tomorrow if you need help again.

    Good luck.
    JavaScript: Learn | Validate | Compact

  7. #37
    Join Date
    May 2007
    Location
    Las Vegas, NV
    Posts
    42
    Of course. I see your country label. I'm sure by now you are very tired. Thank you SO MUCH for all your help. It's been a pleasure.

  8. #38
    Join Date
    May 2007
    Location
    Las Vegas, NV
    Posts
    42

    Wink

    For those people who want to know exactly what was the code issue. . . it was the confirm.php page.

    The original:


    PHP Code:
    <form action="." method="post">
       <input type="hidden" name="action"
          value="YES" />                
       <input type="hidden" name="product_id"
          value="<?php echo $product['productID']; ?>" />
       <input type="hidden" name="category_id"
          value="<?php echo $product['categoryID']; ?>" />
       <input type="submit" value="YES" />
    </form>
    The 'fixed' version:

    PHP Code:
    <form action="." method="post">
       <input type="hidden" name="action" 
          value="YES" />
       <input type="hidden" name="product_id" 
          value="<?php echo $product_id?>" />
       <input type="hidden" name="category_id" 
          value="<?php echo $category_id?>" />
       <input type="submit" value="YES" />
    </form>
    Specifically what was changed:

    This


    PHP Code:
    <input type="hidden" name="product_id"
       value="<?php echo $product['productID']; ?>" />
    <input type="hidden" name="category_id"
       value="<?php echo $product['categoryID']; ?>" />
    was changed to

    PHP Code:
    <input type="hidden" name="product_id" 
       value="<?php echo $product_id?>" />
    <input type="hidden" name="category_id" 
       value="<?php echo $category_id?>" />
    Notice that the [ ] and ' ' were both removed. These were acceptable on the product_list.php page where the code required no confirmation, but they were NOT acceptable when redirected to the confirm.php page.

    Thanks again, bionoid.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles