SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict singersower's Avatar
    Join Date
    Nov 2004
    Location
    TX
    Posts
    240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question will this work? (newbie)

    I finally installed apache, mysql and PHP and I'm trying to find a faster way to input TONS of content: sermons, into a db for a church website. How would this work?

    <?php
    mysql_connect("localhost","root",);
    mysql_select_db (heart);
    $query = "INSERT INTO heart(text , title)
    VALUES('$text','$title')";
    $result = mysql_query($query);
    echo 'Item Entered.';
    ?>

    allette

  2. #2
    Non-Member St.'s Avatar
    Join Date
    Nov 2004
    Location
    Cloud #9
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    wow.

    "insert into database_name" - it's great!

    RTFM

  3. #3
    SitePoint Wizard mark_W's Avatar
    Join Date
    Mar 2004
    Location
    West Midlands, United Kingdom
    Posts
    2,631
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by singersower
    I finally installed apache, mysql and PHP and I'm trying to find a faster way to input TONS of content: sermons, into a db for a church website. How would this work?

    <?php
    mysql_connect("localhost","root",);
    mysql_select_db (heart);
    $query = "INSERT INTO heart(text , title)
    VALUES('$text','$title')";
    $result = mysql_query($query);
    echo 'Item Entered.';
    ?>

    allette
    You will want to be inserting that into the table, not the database.

    If you have a database structure like below.

    -Database1
    --Table 1
    --Table 2

    The your code would be like:

    PHP Code:
     
    <?php
    mysql_connect
    ("localhost","root",);
    mysql_select_db (database1);
    $query "INSERT INTO table1(text , title) // Before you were trying to insert into the actual database 
    VALUES('
    $text','$title')";
    $result mysql_query($query);
    echo 
    'Item Entered.';
    ?>
    HTH

  4. #4
    SitePoint Wizard
    Join Date
    Mar 2004
    Posts
    1,647
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    church website...
    this is something new?

  5. #5
    SitePoint Wizard mark_W's Avatar
    Join Date
    Mar 2004
    Location
    West Midlands, United Kingdom
    Posts
    2,631
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by reminder
    church website...
    this is something new?
    He he he!!!


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
  •