Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15
  1. #11
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default

    nope same error

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


  2. #12
    Join Date
    Aug 2006
    Posts
    181
    Tokens
    0

    Default

    Try this;

    PHP Code:
    <center>
    <?php
    // set your infomation.
    $dbhost='localhost';
    $dbusername='';
    $dbuserpass='';
    $dbname '';

    // connect to the mysql database server.
    mysql_connect ($dbhost$dbusername$dbuserpass);
    //select the database
    mysql_select_db($dbname) or die('Cannot select database');

    if (
    $_POST['name']) {
    $name $_POST['name'];
    if (
    $_POST['about']) {
    $about $_POST['about'];
    if (
    $_POST['url']) {
    $about $_POST['url'];
    $query "INSERT INTO search (name,about,url) VALUES ('".$name."','".$about."','".$url."')";
    mysql_query($query)or die(mysql_error());
    echo 
    $name." was inserted successfully";
    }else{
    echo 
    "About was left blank";

    }
    }
    }
    ?>
    <h2>Add</h2>
    <form action='add.php' method='POST'>
    Name: <input type='text' name='name' size='33' /><br />
    Url: <input type='text' name='url' size='33' /><br />
    about: <textarea name='about' cols='25' rows='5'/></textarea><br />
    <input type='submit' value='Add!' />
    </form>
    <a href="search.php">Search for a website.</a>
    </center>

  3. #13
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default

    cool worked i think +rep

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


  4. #14
    Join Date
    Aug 2006
    Posts
    181
    Tokens
    0

    Default

    np

    also for future referance $end means its missing a } from the end of the php script.

  5. #15
    Join Date
    Aug 2006
    Location
    Doncaster, UK
    Posts
    479
    Tokens
    0

    Default

    I knew that ^^

Page 2 of 2 FirstFirst 12

Posting Permissions

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