This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class PDOFactory { | |
private $dsn; | |
private $username; | |
private $password; | |
private $options; | |
public PDOFactory($dsn, $username, $password, $options = []) { | |
$this->dsn = $dsn; | |
$this->username = $username; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (isset($_GET['view_membersdetails'])) { | |
include("includes/view_membersdetails.php"); | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ($_SERVER['REQUEST_METHOD'] == 'POST') { | |
$size = ord($_POST['size']) - 64; | |
$diamond = []; | |
for ($i = 0; $i < $size; $i++) { | |
$row = str_pad(str_pad(chr(65 + $i), $size - $i, ' ', STR_PAD_LEFT), $size); | |
$row .= strrev(substr($row, 0, $size - 1)); | |
array_splice($diamond, $i, 0, $row); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$sql = "SELECT * FROM custom_info ORDER by cust_name"; | |
$query = mysqli_query($conn, $sql); | |
echo "<form action='index4a.php' method='get'>"; | |
echo "<select name='customer'>"; | |
echo "<option value=''>Customer</option>"; | |
while($customer = mysqli_fetch_assoc($query)){ | |
echo "<option value='{$customer['cust_name']}'> {$customer['cust_name']}</option>"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$cadID = $_GET['cadID']; // validate this! | |
$url = '/uploads/'; | |
$dbc = mysqli_connect('localhost','***********','************','*********') | |
or die ('Error connecting to Database'); | |
$statement = mysqli_prepare($dbc, "UPDATE classifieds SET img1=? WHERE cadID=?;"); | |
$statement->bind_param("s", $url . $ret); // $ret is not found in the given scope | |
$statement->bind_param("s", $cadID); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/php | |
<?php | |
$db = new PDO('mysql:host=yourhost;dbname=yourdb;charset=utf8', 'yourusername', 'yourpassword'); | |
$stmt = $db->query("SELECT id, datum FROM yourtable"); | |
$records = []; | |
while ($obj = $stmt->fetchObject()) { | |
$records[$obj->id] = implode('-', array_reverse(explode('-', $obj->datum))); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<li> | |
<?php $url = 'allproducts.php?city=' . url_encode(trim($rs['city'])) . '&id=1'; ?> | |
<a href="<?php echo $url; ?>"> | |
<?php echo $rs['city']; ?> | |
</a> | |
</li> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // best practice: always have <?php at the top | |
$host="localhost"; // Host name | |
$username="root"; // Mysql username | |
$password="root"; // Mysql password | |
$db_name="account"; // Database name | |
// Connect to server and select databse. | |
$db = new mysqli($host, $username, $password, $db_name); |
NewerOlder