Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6575913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:26:44+00:00 2026-05-25T15:26:44+00:00

I need a database for this: <?php if (isset($_POST[‘addcontentbox’])) { // Connection to Database

  • 0

I need a database for this:

<?php

if (isset($_POST['addcontentbox'])) {
    // Connection to Database
    include('config.php');

    // no Query Injection
    $message = mysql_real_escape_string($_POST['addcontentbox']);
    $sql = 'INSERT INTO wall (message) VALUES( "' . $message . '")';
    mysql_query($sql);

    echo $message;
} else {
    echo '0';
}

this is the config file:

/* Database config */
$db_host        = 'my host goes here';
$db_user        = 'the user name is here';
$db_pass        = 'my password goes here';
$db_database    = 'the datbase name is here'; 
/* End config */

$link = mysql_connect($db_host,$db_user,$db_pass) or die('Unable to establish a DB connection');
mysql_select_db($db_database,$link);

Where I need help is on creating the database. It looks so easy in myphp admin, but I just have no idea of what I’m doing. Since the table on the above codes will be “wall”, does that means the name has to be that as well? I also don’t know if I have to create a table (the “message” one) or if when the script is running it will do that.

I tried setting one up already, but it just doesn’t save any data. I made sure all the database connection parameters were correct ( the name, pw, user..) and still was not saving any data. I’m not getting any mysql errors from the server, it just all looks like is running fine, only that no data is saved. Can anyone help me with this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:26:44+00:00Added an answer on May 25, 2026 at 3:26 pm

    Well, if I understood what you are looking for … follow how to create a table and insert data on it.

    On line command do the follow

    CREATE database test | mysql -u your_user -p your_pwd
    

    or by script -> echo “CREATE database test” | mysql -u your_user -p your_pwd
    –> http://dev.mysql.com/doc/refman/5.1/en/create-database.html

    CREATE TABLE `test`.`wall` (
    `id` INT( 6 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
    `message` VARCHAR( 255 ) NOT NULL
    ) ENGINE = MYISAM ;
    

    INSERT DATA

    INSERT INTO test.wall (
    id ,
    message
    )
    VALUES (
    NULL , ‘Your First Message Here’
    );

    That All..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem: Need to store field value when doing this query on my database. Have
I need to set up this scenario: A SQL Server 2005 database will create
I have this scenario where I need data integrity in the physical database. For
I need to create a Firebird Database programmatically using DBExpress. I have done this
I need a variable to hold results retrieved from the database. So far this
I'm working with someone else's database connection PHP function that works fine as long
<?php // This is a code to check the username from a mysql database
I need to migrate Access databases to SQL Server 2005. Since this needs to
I need a database that could be stored network drive and would allow multiple
I need a database where one (or more) fields behave like a wiki. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.