Skip to content

Instantly share code, notes, and snippets.

<?php
mysql_connect("localhost", "root", "");
mysql_select_db("testing");
?>
<form action="" method="post">
<select name="country">
<?php
$country_query = "SELECT country_id, country_name FROM countries";
@phpfiddle
phpfiddle / fiddle_817110.php
Created September 1, 2013 00:22
Testing pdo
<?php
/**
* PDO MySQL initial code
*
* User permissions of database
* Create, Alter and Index table, Create view, and Select, Insert, Update, Delete table data
*
* @package PhpFiddle
* @copyright Copyright (c) 2012 - 2013, PhpFiddle.org
@phpfiddle
phpfiddle / ef59545dc02685334418ee23a2f30777.php
Created September 1, 2013 00:30
[ Posted by eicto ] Pdo fetchobject test
<?php
require_once "dBug!.php";
$dsn = "mysql:host=localhost;dbname=xfiddlec_max;port=3306";
$user_name = "xfiddlec_user";
$pass_word = "public";
$connect = new PDO($dsn, $user_name, $pass_word);
@phpfiddle
phpfiddle / 08f7ba11250a1b8c157ebaf7c6fc8678.php
Last active July 15, 2016 02:09
[ Posted by eicto ] php pdo test
<html>
<head>
</head>
<body>
<table border="1" width="90px" height="50px">
<tr><td>
<form action=f.php method=POST>
Rollno<input type=text name=Roll><br>
Name<input type=text name=Na><br>
<select name=couse>
@phpfiddle
phpfiddle / fiddle_493421.php
Created September 1, 2013 21:49
Php color palette shade generator
<?php
class ColorPalette{
public $color;
public function __construct($color){
$this->color = $color;
}
public function color_mod($hex, $diff) {
$rgb = str_split(trim($hex, '# '), 2);
@phpfiddle
phpfiddle / fiddle_243637.php
Created September 3, 2013 03:07
Calculate costumize array
<?php
function calculate($array_1, $array_2){
$x = 0; $total = 0;
foreach($array_1 as $element){
$total += ($element - $array_2[$x]);
$x++;
}
@phpfiddle
phpfiddle / fiddle_928856.php
Created September 5, 2013 09:00
ENCOMENDA_RECEBIDA.PHP
<html>
<head>
<title><strong>Encomenda recebida com sucesso!</strong></title>
</head>
<body>
Encomendou:
<li>
<ul>
1 pizza 4 Queijos
2 coca-cola
@phpfiddle
phpfiddle / fiddle_802304.php
Created September 5, 2013 09:30
ttttttttttttttttttttttttttttttttttttttttt
<?php
?>
<html>
<head>
<title><strong>Encomenda recebida com sucesso!</strong></title>
</head>
<body>
Encomendou:
@phpfiddle
phpfiddle / fiddle_176066.php
Created September 11, 2013 10:12
calculater design
<?php
$a=$_request[$a]
?>
<form>
<table width="278" height="201" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" align="center" style="color:#FF0000; font-size:24px;"><?php echo $c; ?></td>
@phpfiddle
phpfiddle / ceef20cd5a41ffc4fafd5f1deb3adb18.php
Created September 11, 2013 21:27
[ Posted by Justin ] Array Example - Multidimensional
<?php
//Made the headers bold on this one. Maybe can use css to do that next time?
$cars=array("Dodge"=>array("Avenger","Challenger","Charger","Dart"),"Toyota"=>array("Highlander","Tundra","Corolla"),"Nissan"=>array("Sentra","Altima","Maxima"));
foreach($cars as $x=>$x_value)
{
echo "<b>Make: $x<br></b>";
foreach($x_value as $y){