Location: PHPKode > scripts > UNKNOW > webifycore/phpcode.php
<?php
$con = mysql_connect(localhost, webify_databaseusername, databasepassword); mysql_select_db(webify_databasename,$con);
?>

mysql_query ("CREATE TABLE IF NOT EXISTS `BLOGPOSTS` (`ID` INT NOT NULL AUTO_INCREMENT , PRIMARY KEY ( `id` ) )");
mysql_query ("ALTER TABLE `BLOGPOSTS` ADD `TITLE` TEXT NOT NULL");
mysql_query ("ALTER TABLE `BLOGPOSTS` ADD `SUMMARY` TEXT NOT NULL");
mysql_query ("ALTER TABLE `BLOGPOSTS` ADD `DESCRIPTION` TEXT NOT NULL");

$SQL = "SELECT * from TABLENAME";
$result = @mySQL_query( $SQL ); while( $row = @mySQL_fetch_array( $result ) ) {
// DO STUFF IN HERE, it looks out every record in the database
}

$SQL = "SELECT * from TABLENAME WHERE FIELDNAME = '$somevalue'";
$result = @mySQL_query( $SQL ); while( $row = @mySQL_fetch_array( $result ) ) {
// DO STUFF IN HERE, it looks out every record in the database, but selects only specific entries defined in the WHERE condition
}

$SQL = "SELECT * from TABLENAME WHERE FIELDNAME = '$somevalue'"; $result = @mySQL_query( $SQL ); $row = @mySQL_fetch_array( $result );
// selects ONE record from the DB only
//get stuff out like this,
echo $row[FIELDNAME1];
echo $row[FIELDNAME2];
echo $row[FIELDNAME3]; //etc


$sql    = "INSERT INTO TABLENAME SET
FIELDNAME1   = '$value',
FIELDNAME2   = '$_POST[postvalue]',
FIELDNAME3   = '$etc'"; //<------- last one GETS NO commma
$query  = @mysql_query($sql);
// inserts a record into the database,

$sql    = "UPDATE $table SET
FIELDNAME1   = 'FIELD',
FIELDNAME2   = 'FIELD' WHERE ID = '$ID'"; //<------- last one GETS NO commma
$query  = @mysql_query($sql);
//like insert, but updates an existing entry instead of inserting a new one.

if ($x == 1) {
        //if $x equals 1 do something here
}

if ($x != 1) {
        //if $x equals 1 do something here
}

if ($x == 1 && $y == 2) {
        //if $x equals 1 AND y == 2 do something here
}

if ($x == 1 || $y == 2) {
        //if $x equals 1 OR y == 2 do something here
}
Return current item: UNKNOW