The Art of Listening

March 4, 2009

tangly basic functions #1

Filed under: My Experiences

function connect()
{
    global $con;
    $dbname="";
    $con=mysql_connect("localhost","root","");
    if(!$con)
    {
        echo"Not connected to database!";
    }
    mysql_select_db($dbname);
}

function add()
{
    if(isset($_POST["id"]))
    {
        $sql="INSERT INTO $table() VALUES() WHERE id=’".$_POST["id"]."’";
        mysql_query($sql) or die(mysql_error());
    }
}

function delete()
{
    if(isset($_GET["act"])&& $_GET["act"]==’delete’)
    {
        $sql="DELETE $table WHERE id=’".$_GET["id"]."’";
        mysql_query($sql) or die(mysql_error());
    }
}
function edit()
{
    if(isset($_GET["act"])&& $_GET["act"]==’edit’)
    {
        $sql="UPDATE $table
            SET $field=’".$_POST[""]."’
            WHERE id=’".$id."’";
        mysql_query($sql) or die(mysql_error());
    }
}

Comments »

The URI to TrackBack this entry is: http://fma.blogsome.com/2009/03/04/tangly-basic-functions-1/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.


Anti-spam measure: please retype the above text into the box provided.






















Get free blog up and running in minutes with Blogsome
Theme designed by Minz Meyer