Jump to content

falkencreative

Advanced Member
  • Posts

    4,419
  • Joined

  • Last visited

  • Days Won

    27

Posts posted by falkencreative

  1. I don't have the database, so this is a little hard to test. What happens when you click the Edit button currently? Are you initially seeing the data, and you can edit it, and it's only after you submit that it enters it as a new record? 

     

    One potential issue: it seems like in your PS_Manage_Appts.php file, you are creating the edit/delete buttons with "?id=" in the URL, but the code in the update_post.php file makes reference to a $_GET['groomingid']. I can't really tell if that is the issue, but your update_post file never accesses $_GET['id'] at all. If you are going to pass variables via the URL, you need to make sure you are both setting and getting the same variable name.

  2. OK. So if the $student_id value is "van", you need to change your database to make that student id a unique, numeric number. "van" isn't unique -- there could be other students with the name of "Van". So that's the next step -- you'd need to wipe your student_id column in the database, and set up up as a int, with auto_increment on, so that new rows will automatically contain a unique number (you'll need to update existing rows with unique numbers).

  3. Can you post the full file for whichever file has this code (or roughly this code -- I'm not sure if/how it's been changes since you last posted about it):

     

    $display_string .= "<td><a href='View_Profile.php?id=student_id'>View</a> </td>";
    $display_string .= "<td><a href='Admin_Edit_Student_Info.php?id=student_id'>Update</a></td>";
    $display_string .= "<td><a href='Admin_Delete_Student.php?id=student_id'>Delete</a></d>";
  4. An error related to a database query and a "non-object" usually means that the $Database object isn't being correctly created -- usually due to a incorrect username or password. If you are using MAMP on a Mac, the username is "root" and the password is empty. If you are using WAMP, the username is "root" and the password is "root".

     

    If you are using XAMPP, check the documentation for the correct login info. If you are running this on live web hosting, not on your computer, then talk to support about the correct username/password combination.

  5. If you're passing in "id" in the URL, you need to be retrieving "id", not "student_id". So: "$_REQUEST['id']".

     

    All that said, you can't be passing in a student's first name in the URL -- a first name could be shared between multiple students, so you can't be sure that you are editing the right student. Instead, you should be using a numeric id that is unique per student.

  6. Overall, things look good. One thing to note:

    $display_string .= "<td><a href='View_Profile.php?id=student_id'>View</a> </td>";
    $display_string .= "<td><a href='Admin_Edit_Student_Info.php?id=student_id'>Update</a></td>";
    $display_string .= "<td><a href='Admin_Delete_Student.php?id=student_id'>Delete</a></td>";

    In this section, you can't just use the string "student_id". That needs to be a variable that holds the ID. So instead, you need to be doing something like this (assuming you have a variable $student_id):

    $display_string .= "<td><a href='View_Profile.php?id=$student_id'>View</a> </td>";
    $display_string .= "<td><a href='Admin_Edit_Student_Info.php?id=$student_id'>Update</a></td>";
    $display_string .= "<td><a href='Admin_Delete_Student.php?id=$student_id'>Delete</a></td>";

    Also, you probably want to make sure you are making sure to sanitize any data that you receive from the user/browser, just in case someone edits the URL and tries to make your application do unexpected behavior. If your student_id is numbers only, you might want to do 

    $student_id = intval($_REQUEST['student_id']);
    

    to make sure it contains an int. Alternatively, if the student text contains numbers, you should at least be running it through

    $student_id = htmlentities($_REQUEST['student_id'], ENT_QUOTES);

    Basically, never trust data that you retrieve from the browser in a way that a user can edit, especially if that data is then used in a database query. Always make sure that it either matches the data type you expect, or potentially troublesome characters (quotes, code, etc.) are cleaned, so you reduce unexpected behavior. If you don't, it's likely that you will accidentally allow people more access to your database than you want them to have, potentially allowing them to even delete your database. http://www.w3schools.com/sql/sql_injection.asp

  7. 1) There really isn't any secret trick to this... You'd just need to design it within Photoshop for multiple widths -- probably for a max width of 1200 pixels, 980 pixels, and 320 pixels or so for smart phones. Overall, you're going to be doing more work compared to a non-responsive design.

     

    2) You can do your coding, and then take a screenshot of the final product? However, if the client is expecting a PSD, you'd be better off designing in Photoshop rather than in the browser.

  8. The issue is in your ajax.php file, specifically on these lines:

    $display_string .= "<td><a href='View_Profile.php'>View</a> </td>";
    $display_string .= "<td><a href='Admin_Edit_Student_Info.php'>Update</a></td>";
    $display_string .= "<td><a href='Admin_Delete_Student.php'>Delete</a></td>";

    I'm assuming you have some sort of unique numeric ID associated with each student? You need to edit each of the view/update/delete links to include that id. Something like this:

    $display_string .= "<td><a href='View_Profile.php?id=X'>View</a> </td>";
    $display_string .= "<td><a href='Admin_Edit_Student_Info.php?id=X'>Update</a></td>";
    $display_string .= "<td><a href='Admin_Delete_Student.php?id=X'>Delete</a></td>";

    Obviously, the "X" in each would need to be replaced with that student's id.

     

    Then, on the View_Profile, Admin_Edit_Student_info and Admin_Delete_Student pages, you would get that student's ID using $_GET, and use that id to retrieve the student's info for Viewing/Editing/Deleting using the database.

     

    You can see that sort of approach in my CRUD tutorial: http://www.killersites.com/community/index.php?/topic/3064-basic-php-system-view-edit-add-delete-records-with-mysqli/. In my code, you'll see that I am adding an id to my view/edit/delete links, and retrieving that id on those pages to access the correct information.

  9. You'd need to start in the view and work backwards. In this case, the code you included is actually the code to list the products, not the navigation. The navigation is in the header file (app/views/includes/public_header.php ), since it's a global item that appears on all pages. Here's the correct code:

     

    <ul class="nav">
    <?php $this->get_data('page_nav'); ?>
    </ul>
    So the next step would be to check the controller, and see where set_data('page_nav') is set. In the index file, look for the "$Template->set_data('page_nav', )" line: it should be on lines 17 and 44 (or very close). Here's the code for one of those sections:
     
    // get category nav
    $category_nav = $Categories->create_category_nav($category['name']);
    $Template->set_data('page_nav', $category_nav);
     
    So the navigation is created by the $Categories object's "create_category_nav" method, which accepts the argument of the currently active navigation item (in the index.php file, either that's the home page, or the name of the currently active category.)

     

    In order to change this, you'd need to modify the code to call set_data('page_nav') with your own navigation content. If the navigation will stay basically the same, with categories being the main focus, I would find and edit the "create_category_nav" method in the m_categories.php code. If not, perhaps you should create a new method within the main template file (m_template.php) that will return the HTML needed to create the navigation. Once you have it working on the home page, then apply that same change to any other controllers that need the updated navigation.

     

    If you want a dropdown, you'll likely need to modify the HTML, as well as add any CSS/Javascript that you will need. Does that help at all?

  10. Those switch statements need to look like this:

    switch($_POST['rgroup4']) {
        case "rg4v1":
            $value4 = "Radio Group 4 - Value 1 was selected.";
            break;
        case "rg4v2":
            $value4 = "Radio Group 4 - Value 2 was selected.";
    }
  11. These are your switch statements:

    switch($_POST['rgroup4']) {
        case "rg4v1":
            $value4 = "Radio Group 4 - Value 1 was selected.";
            break;
        case "rg4v2":
            $value4 = "Radio Group 4 - Value 2 was selected.";
    Note the opening "{", but no closing "}"? You need a closing } at the end of each of your four switch statements.
×
×
  • Create New...