データベースに関係するすべてを処理するクラスを開発することから始めます。これは私が始めたデータベースクラスの例です。これは完了していませんが、別のデータベース、テーブル、または必要なものを渡すために使用できます。
<?php
 class Database
 {      // BEGIN class database
     // variables
   protected $db_host;
   protected $db_user;
   protected $db_password;
   protected $db_name;
   protected $connection;
   protected $queryRun;
   protected $numRows;
   protected $seldb;
// constructor
function __constructor(){
}
public function connect($db_host,$db_user,$db_password,$db_name)
{
    $this->db_host = $db_host;
    $this->db_user = $db_user;
    $this->db_password = $db_password;
    $this->db_name = $db_name;
    $this->connection = mysql_connect($this->db_host,$this->db_user,$this >db_password);
    if(!$this->connection)
    {
        mysql_error();
    }
    $this->seldb = mysql_select_db($this->db_name,$this->connection);
    if(!$this->seldb)
    {
        mysql_error();  
    }
}
public function disconnect()
{
    mysql_close($this->connection);
}
public function query(){
    $this->queryRun = mysql_query($this->sql,$this->connection);
    return $this->queryRun;
}
public function select($table,$columns = '*',$where = null,$order = null,$sort = null)
{
    $this->sql = 'SELECT ' .$columns. ' FROM ' .$table;
    if($where != null)
    {
        $this->sql . ' WHERE ' . $where;
    }
    if($order != null)
    {
        $this->sql . ' ORDER ' . $order;
    }
    if($sort != null)
    {
        $this->sql . ' SORT BY ' . $sort; 
    }
}
public function insert($table,$columns,$updatecolumns,$where = null)
{
    $this->sql = 'INSERT INTO ' .$table. '(' .$columns. ') VALUES (' .$updatecolumns. ')';
    if($where != null)
    {
        $this->sql . ' WHERE ' . $where;
    }
}
public function outputQuery()
{
    if(!$this->queryRun)
    {
        echo "Error";
    }
    else {
        $numRows = mysql_fetch_array($this->queryRun);
        foreach($numRows as $rows)
        {
            echo "<div id='feeditem'>";
            echo "<a href='#'><textarea>";
            echo $rows;
            echo "</textarea></a>";
            echo "</div>";
        }
    }
}
  }
?>
次に、クラスのインスタンスを作成し、必要なときに必要なクラスの関数を使用できます。
<?php
    include 'database.class.php';
    database1 = new Database();
    database1->connect('127.0.0.1','root','','users');
?>
このような何かが良いスタートになるでしょう。