A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Php+MySQL Help!

Threaded View

  1. #1
    the cheesy child bounceboy's Avatar
    Join Date
    Dec 2008
    Location
    Australia
    Posts
    323

    Php+MySQL Help!

    hey everybody, havent been on for a while. but i have a bit of an issue here:

    I'm making a flash chat based with PHP and MySQL (finally.)

    And right now im just trying to get used to connecting PHP with MySQL. there's always seemed to be problems whenever i do, hoping somebody can help me with this one.

    (note: dont mind my immature notes... its only a test file)

    Here's my php file:
    PHP Code:
    <?php
    $con 
    mysql_connect("secret","secret","secret");
    if (!
    $con)
      {
      die(
    'Could not connect because you suck.');
      }

    mysql_select_db("jchee_chat"$con);
    $sql mysql_query("INSERT INTO Users (Username, Age)
    VALUES ('
    $_POST[Username]', '$_POST[Age]')");


    if (!
    mysql_query($sql,$con))
      {
      die(
    'Error: ' mysql_error());
      }
    echo 
    "you were added!"

    mysql_close($con);
    ?>
    Note: replaced my details with "secret" and for a very good reason.

    in case you wanna see where i get the POST variables "username" and "age" from, here's the form it comes from:

    PHP Code:
    <html>
    <
    head>
    </
    head>
    <
    body bgcolor=#CC9966>
    <font size="100" face="Arial" color="#0066FF">
    <
    form action="test1.php" method="post">
    Username: <input type="text" name="Username" />
    Age: <input type="text" name="Age" />
    <
    input type="submit" />
    </
    form>
    </
    font>
    </
    body>
    </
    html
    Last edited by bounceboy; 04-05-2010 at 05:13 AM.

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center