php problem

Discussion in 'PHP' started by gizy, Jan 12, 2011.

  1. #1
    im trying to add a upload thing where i could upload say like games to my website but im getting this error. could someone help me out please. here is what error says.
    2ghjkdfghScStartSmartDeskto_3AF47A4E14DF4546B1449D27245505A0.exeScStartSmartDeskto_3AF47A4E14DF4546B1449D27245505A0.exeUnknown column 'ghjk' in 'field list'

    and here is my php i wrote....

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Add Game</title>
    </head>

    <body>
    <?php

    session_start();


    if(isset($_SESSION['success']))
    {
    if(isset($_POST['add']))
    {
    if(isset($_POST['title']) && isset($_POST['description']))
    {
    // GET DB CONFIG
    require_once('php/dbConfig.php');

    mysql_connect($dbServer, $dbUser, $dbPass);
    mysql_select_db($dbName);

    $check_query = mysql_query("SELECT id FROM games ORDER BY id DESC");

    $check = mysql_fetch_assoc($check_query);

    $newid = $check['id']+1;
    $title = $_POST['title'];
    $description = $_POST['description'];
    $picture = $_FILES['picture']['name'];
    $flash = $_FILES['flashfile']['name'];

    echo $newid . $title . $description. $picture. $flash;


    $sql = "INSERT INTO games (id, title, description, picture, flash) VALUES ($newid, $title, $description, $picture, $flash)";

    mysql_query($sql) or die(mysql_error());

    move_uploaded_file($_FILES['flashfile']['name'], 'games/');
    move_uploaded_file($_FILES['picture']['name'], 'games/img/');

    }


    }



    ?>
    <h1>Add Game</h1>
    <form action="" method="post" enctype="multipart/form-data">
    Title: <input type="text" name="title" /><br />
    Description: <textarea name="description"></textarea><br />
    Flash File: <input type="file" name="flashfile" id="flashfile" /> (.swf file)<br />

    Picture: <input type="file" name="picture" id="picture" /> (.gif file)<br />

    <input type="submit" name="add" value="Add Game" />



    </form>

    <?php
    }
    else
    {

    if(isset($_POST['login']))
    {
    if($_POST['password'] == 'qqee9gnelapekkansu')
    {
    $_SESSION['success'] = 1;


    }
    else
    {
    echo 'Wrong Password';
    }
    }
    else
    {

    ?>
    <h1>Login</h1>
    <form action="" method="post">

    Enter Password: <input type="password" name="password" />
    <br /><input name="login" type="submit" value="Login" />

    </form>


    <?php
    }

    }
    ?>


    </body>
    </html>
     
    gizy, Jan 12, 2011 IP
  2. dsdf

    dsdf Peon

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    1. Did you already try upload more than 1 file & 1 game? What is the result? Are they same?
    2. What game filename dan image filename you tried to upload?
    2. Maybe it's not the full error message. Can you please looks of the view-source? Or you can use Ctrl-U for Mozilla/Firefox.
     
    dsdf, Jan 13, 2011 IP
  3. wwwbryan

    wwwbryan Well-Known Member

    Messages:
    181
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    103
    #3
    The sql should be id = '$newid'
     
    wwwbryan, Jan 13, 2011 IP
  4. bharat desi

    bharat desi Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hi ,
    My website bharatdesi.com has few errors on my comments form ... like how to restrict abused words or limit my comments form or replies form who are genuine...
     
    bharat desi, Jan 15, 2011 IP
  5. whippa craka

    whippa craka Greenhorn

    Messages:
    63
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #5
    seems to be looking for a mysql column that isnt there. check for spelling errors.
     
    whippa craka, Jan 15, 2011 IP
  6. kokulusilgi

    kokulusilgi Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    change this


    $sql = "INSERT INTO games (id, title, description, picture, flash) VALUES ($newid, '".mysql_real_escape_string($title)."', '".mysql_real_escape_string($description)."', '".mysql_real_escape_string($picture)."', '".mysql_real_escape_string($flash)."')";
     
    kokulusilgi, Jan 15, 2011 IP