SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Threaded View

  1. #1
    SitePoint Enthusiast XploreR's Avatar
    Join Date
    May 2001
    0 Post(s)
    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



    if (!isset($submit)):


    <head><title>New Game Entry</title>
    <link rel="stylesheet" href="" type="text/css">

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

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

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

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

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

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

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

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

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



    $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.");


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


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


Posting Permissions

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