+ Reply to Thread
Results 1 to 9 of 9

Thread: Need help- Will pay

  1. #1
    Conmiro is offline x10 Sophmore Conmiro is an unknown quantity at this point
    Join Date
    Feb 2008
    Posts
    140

    Need help- Will pay

    When ever I load a certain page on my website, I get this message:

    http://conmiro.com/submit.php

    Here is the script of submit.php:

    <?php
    $con = mysql_connect("localhost","conmiro_conmiro","***** ***********");
    if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }mysql_select_db("my_db", $con);mysql_query
    ("INSERT INTO websites (sitename, description, email)
    VALUES ('$_POST["age"]', '$_POST["age"]', '$_POST["age"]')");
    mysql_close($con);
    ?>


    If you can help me, il give you some points.
    Edit:
    VALUES ('$_POST["age"]', '$_POST["age"]', '$_POST["age"]')");

    Thats line 8.
    Last edited by Conmiro; 09-30-2008 at 09:48 PM. Reason: Automerged Doublepost

  2. #2
    VPmase's Avatar
    VPmase is offline x10 Elder VPmase is an unknown quantity at this point
    Join Date
    Nov 2007
    Location
    Dixon, IL, USA
    Posts
    914

    Re: Need help- Will pay

    I suggest you replace your password and username with *****'s

  3. #3
    Conmiro is offline x10 Sophmore Conmiro is an unknown quantity at this point
    Join Date
    Feb 2008
    Posts
    140

    Re: Need help- Will pay

    there i fixed my password, i accidently added a space. Does that help more?
    Edit:
    oh, replace it. Oops. :D My bad. Sooo can you help?
    Last edited by Conmiro; 09-30-2008 at 09:48 PM. Reason: Automerged Doublepost

  4. #4
    DeadBattery's Avatar
    DeadBattery is offline Community Support Team DeadBattery is a name known to allDeadBattery is a name known to all
    Join Date
    Mar 2008
    Location
    localhost
    Posts
    4,019

    Re: Need help- Will pay

    Thread Moved to Marketplace


  5. #5
    Nahid_hossain is offline x10Hosting Member Nahid_hossain is an unknown quantity at this point
    Join Date
    Aug 2008
    Location
    Dhaka, Bangladesh
    Posts
    28

    Re: Need help- Will pay

    Here is the corrected code

    PHP Code:
    <?php

    $con 
    mysql_connect("localhost","conmiro_conmiro","***** ***********");
    if (!
    $con)
    {
    die(
    'Could not connect: ' mysql_error());
    }
    mysql_select_db("my_db"$con);
    mysql_query("INSERT INTO websites (sitename, description, email) VALUES('".$_POST["age"]."', '".$_POST["age"]."', '".$_POST["age"]."')");
    mysql_close($con);
    ?>

  6. #6
    mattura's Avatar
    mattura is offline x10 Elder mattura is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    563

    Re: Need help- Will pay

    erm... $_POST["age"] three times?!!!
    ----
    Life is a game. The conception is terrible but the graphics are amazing!
    matt.elementfx.com

  7. #7
    exemption is offline x10Hosting Member exemption is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    66

    Re: Need help- Will pay

    First of all you do not need 3 $_POST actions

    PHP Code:
     <?php 

    $con 
    mysql_connect("localhost","conmiro_conmiro","***** ***********"); 
    if (!
    $con

    die(
    'Could not connect: ' mysql_error()); 

    mysql_select_db("my_db"$con); 
    mysql_query("INSERT INTO websites (sitename, description, email) VALUES('".$_POST["age"]."')"); 
    mysql_close($con); 
    ?>
    Corrected code
    Last edited by exemption; 10-03-2008 at 09:39 AM.


    I program PHP..so if you need help lemme know!


  8. #8
    mattura's Avatar
    mattura is offline x10 Elder mattura is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    563

    Re: Need help- Will pay

    perhaps you meant:
    $_POST['sitename'], $_POST['description'], and $_POST['email'] or similar?
    ----
    Life is a game. The conception is terrible but the graphics are amazing!
    matt.elementfx.com

  9. #9
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: Need help- Will pay

    Here is the final complete code.
    I edited it a bit so that you may use it and put your personal info without modifying the handling code. I also removed a whitespace at the beginning that could ruin your script.
    PHP Code:
    <?php

    $db_host 
    "localhost"//keep the same
    $db_user "conmiro_conmiro"//this is your username
    $db_pass "PUT PASSWORD HERE"//this is your pasword
    $db_name "conmiro_PUT DATABASE NAME HERE"//this is your database name. it starts by conmiro_
    // change the name between the brackets [' '] to what you want i.e sitename , description , email
    $values = array($_POST['age'], $_POST['age'], $_POST['age']);

    //You do not need to edit below
    $query "INSERT INTO websites (sitename, description, email) VALUES('" $values[0] . "', '" $values[1] . "', '" $values[2] . "')"

    $con mysql_connect($db_host$db_user$db_pass); 
    if (!
    $con

    die(
    'Could not connect: ' mysql_error()); 

    mysql_select_db($db_name$con);

    mysql_query($query);

    mysql_close($con); 
    ?>
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers