SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Threaded View

  1. #1
    SitePoint Enthusiast XploreR's Avatar
    Join Date
    May 2001
    Location
    Singapore
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello, all. I have this piece of code to allow me to add data via from to my database. However, it doesn't work for me at all and so i would appreicate if anyone can point me the errors, as i new to this


    Code:


    <?

    if (!isset($submit)):

    ?>


    <html>
    <head><title>New Game Entry</title>
    <link rel="stylesheet" href="http://www.xplodercodes.com/xiccc.css" type="text/css">
    </head>

    <body bgcolor="#000000" text="#ffffff" link="#00ff00" vlink="#c0d9d9" alink="#ffffff">

    <h3>New Game Entry</h3><p>

    <form method=post action="<?=$PHP_SELF?>">

    <center>
    <table border=0 cellpadding=0 cellspacing=5>

    <tr><td align=right>Alpha</td>
    <td><input name=Alpha type=text maxlength=100 size=25>
    </td>
    </tr>

    <tr><td align=right>Game</td>
    <td><input name=Game type=text maxlength=100 size=25> </td>
    </tr>

    <tr>
    <td align=right>Publisher</td>
    <td><input name=Publisher type=text maxlength=100 size=25></td>
    </tr>

    <tr><td align=right>Developer</td>
    <td><input name=Developer type=text maxlength=100 size=25></td>
    </tr>

    <tr><td align=right colspan=2>
    <input type=reset value="Reset Form">
    <input type=submit name=”submit” value="Submit">
    </td>
    </tr>
    </table>
    </form>
    </center>

    </body>
    </html>

    <?php
    else:

    $dbhost = "localhost";
    $dbuser = "xiccc";
    $dbpass = "******";

    $dbcnx = @mysql_connect($dbhost, $dbuser, $dbpass)
    or die("The database appears to be down.");

    if ($db!="" and !@mysql_select_db($db))
    die("The site database is unavailable.");

    return $dbcnx;


    if ($Alpha=="" or $Game=="" or $Publisher=="" or $Developer=="") {
    error("One or more required fields were left blank.\\n".
    "Please fill them in and try again.");
    }

    $sql = "INSERT INTO PlaystationRpg SET
    Alpha = '$Alpha',
    Game = '$Game',
    Publisher = '$Publisher',
    Developer = '$Developer'";

    if (!mysql_query($sql)) {
    error("A database error occurred in processing your submission.");
    }

    ?>

    <html>
    <head><title> Adding Complete </title></head>
    <body>
    <p>Entry Successfully Added!
    </body>
    </html>

    <?php
    endif;
    ?>

    Last edited by XploreR; May 24, 2001 at 04:17.


Bookmarks

Posting Permissions

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