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 GSimpson's Avatar
    Join Date
    Aug 2006
    Location
    New Zealand
    Posts
    268
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Table name from Post Variable.

    Why doesn't this work - I can't figure it out.
    PHP Code:
    $txt1 $_POST[Title];

    $sql2 "CREATE TABLE $txt1 (
    ThreadTitle varchar(9999),
    Date varchar(12),
    Username varchar(12)
    )"
    ;
    mysql_query($sql2,$con);

    echo 
    "Your Forum Was Successfully Created. Please Return <a href='index.php'>Here</a>.";
    mysql_close($con);
    ?> 
    The internet is my Sandbox, and notepad is my Spade n' Bucket.

  • #2
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Add mysql_error() onto your code:
    mysql_query($sql2,$con) or die(mysql_error());

    Side note, varchar's max size is 255 and maybe you'd be interested in using the data type of date for your date column.
    Ref:
    http://dev.mysql.com/doc/refman/5.0/en/char.html

  • #3
    $object->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Jun 2003
    Posts
    3,092
    Thanks
    2
    Thanked 23 Times in 23 Posts
    Also, make sure $txt1 isn't a reserve word. You don't always get a meaningful error message when you do something like that.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    SNAP to it!


  •  

    Posting Permissions

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