Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Oct 2010
    Posts
    127
    Thanks
    26
    Thanked 0 Times in 0 Posts

    Having issues allowing users to update database with PHP

    Hello all,

    I'm trying to set up a site that will allow users to update a database when they are logged in. So far, I've set it up to where stuff can be added to the database via a form and that works fine. Now I want the user to be able to edit information. Here's some code:


    So this first part should take the user to the page to edit information for a certain TV program. But when you click on 'edit' it takes you to a page with the ending url of 'edit_record_form.php?ID=%27

    Notice the apostrophe. How do I get rid of that? Also, I thought the script was set up to have the program name where %27 is. Thoughts?
    Code:
    <?php
    require_once("db_connx.php");
    $result = mysql_query("SELECT * FROM `Content_Calendar` ORDER BY Program") or die($myQuery."<br/><br/>".mysql_error());
    
    while($row = mysql_fetch_array($result)){
    $program = $row['Program'];
    echo "<h2>" . $row['Program'] . "</h2>";
    echo "<p>" . $row['Description'] . "</p>";
    echo "<p><strong> On-Air: </strong>" .$row['Production'] . "<br />";
    echo "<p> <strong>Promotion: </strong> " .$row['Promotion'] . "<br />";
    echo "<p><strong> Online: </strong>" .$row['Web'] . "<br />";
    echo "<p><strong> In the Community: </strong>" .$row['Community'] . "<br />";
    echo "<a href=\"edit_record_form.php?ID=".$program.”\”>Edit</a>";
    }
    require_once("db_connx_close.php");
    ?>
    I have the other pages created as well, but I can't test those out until I get this fixed. Any ideas what I'm doing wrong? I'm guessing it's something easy, but I could be wrong, Thanks

  • #2
    Regular Coder
    Join Date
    Jun 2009
    Posts
    141
    Thanks
    3
    Thanked 20 Times in 20 Posts
    That is not an apostrophe, its a percentage sign. I sommise that your $program variable has a space in

    Try
    Code:
    "<a href=\"edit_record_form.php?idi={$program}\">Edit</a>";

  • Users who have thanked itxtme for this post:

    javanewbie7 (04-11-2014)

  • #3
    Regular Coder
    Join Date
    Oct 2010
    Posts
    127
    Thanks
    26
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by itxtme View Post
    That is not an apostrophe, its a percentage sign. I sommise that your $program variable has a space in

    Try
    Code:
    "<a href=\"edit_record_form.php?idi={$program}\">Edit</a>";
    That worked. Thanks.


  •  

    Posting Permissions

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