PHP POST GET Method

Uncategorized No Comments »

Displays all the POST variables:

foreach ($_POST as $key => $value) {
	echo "$key = $value";
}

Displays all the GET variables:
foreach ($_POST as $key => $value) {
echo “$key = $value
“;
}

Displays all the GET and POST variables:

foreach ($_REQUEST as $key => $value) {
	echo "$key = $value";
}

PHP MySql Tutorial

Uncategorized No Comments »
$connection = mysql_connect(Config::$db_host,Config::$db_user,Config::$db_pass);
if (!$connection)  {	die('Could not connect: ' . mysql_error());  }

mysql_select_db(Config::$db_database, $connection);
mysql_query($query) or die("Couldn't execute query. " . mysql_error() . "
" . $query);; mysql_close($connection);
$connection = mysql_connect(Config::$db_host,Config::$db_user,Config::$db_pass);
if (!$connection)  {   die('Could not connect: ' . mysql_error());  }

mysql_select_db(Config::$db_database, $connection);

$query  = "SELECT * FROM table_name";
$result = mysql_query($query) or die("Couldn't execute query. " . mysql_error() . "
" . $query); while($row = mysql_fetch_assoc($result)) { foreach ($row as $key => $val) { echo $key." = ".$value." | "; } }
Design by j david macor.com.Original WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in

Download from Free Wordpress templates