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 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2009
    Posts
    48
    Thanks
    28
    Thanked 0 Times in 0 Posts

    Posted into table but can't see it

    Hi,

    I have posted data into a table and I can see it has added a record but can't actually view the contents.

    // Get values from form
    $id=$_POST['id'];
    $url=$_POST['url'];
    // Insert data into mysql
    $sql="INSERT INTO $tbl_name(id, url)VALUES('$id','$url')";
    $result=mysql_query($sql);

    // close connection
    mysql_close();
    ?>

    The id that I am trying to get is the username of the person that is currently using the site. Here is the code I am using

    <?php
    session_start();
    if(!session_is_registered(id)){
    header("location:main_login.php");
    }
    $session['views']=1;

    ?>

    thanks in advance

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    I have posted data into a table and I can see it has added a record but can't actually view the contents.
    How did you assume it posted into table? Add some error checks and make sure that there is no error in your query.
    PHP Code:
    $result=mysql_query($sql) or die(mysql_error()); 
    I think you are missing a space in
    Code:
    $sql="INSERT INTO $tbl_name(id, url)VALUES('$id','$url')";
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

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