本文整理汇总了PHP中Mysql::openAndAdd方法的典型用法代码示例。如果您正苦于以下问题:PHP Mysql::openAndAdd方法的具体用法?PHP Mysql::openAndAdd怎么用?PHP Mysql::openAndAdd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mysql
的用法示例。
在下文中一共展示了Mysql::openAndAdd方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fread
$contents = fread($handle, filesize($filename));
$names = [];
$location = [];
$date = [];
$area = [];
$park = explode(PHP_EOL, $contents);
print_r($park);
foreach ($park as $key => $value) {
$newpark = explode(',', $value);
$key1 = "park";
$key2 = "location";
$key3 = "date";
$key4 = "area";
$newpark[$key1] = $newpark[0];
$newpark[$key2] = $newpark[1];
$newpark[$key3] = $newpark[2];
$newpark[$key4] = trim($newpark[3]);
echo count($newpark) / 2;
for ($i = 0; $i < count($newpark) - 1; $i++) {
unset($newpark[$i]);
}
print_r($newpark);
$park[$key] = $newpark;
}
array_pop($park);
$dbc = new Mysql("parks_db", "national_parks", 1);
$dbc->newTable();
for ($i = 0; $i < count($park); $i++) {
$dbc->openAndAdd("{$park[$i]["park"]}", "{$park[$i]["location"]}", "{$park[$i]["date"]}", "{$park[$i]["area"]}");
$dbc->littleBobbyTables("name", "location", "date_established", "area_in_acres");
}
示例2: Mysql
<?php
require "database.php";
$names = ["Acadia", "Arches", "Badlands", "Big Bend", "Biscayne", "Bryce Canyon", "Carlsbad"];
$location = ["Maine", "Utah", "South Dakota", "Texas", "Florida", "Utah", "New Mexico"];
$date = ["1919-02-26", "1929-04-12", "1978-11-10", "1944-06-12", "1980-06-28", "1928-02-25", "1930-05-14"];
$area = [47389.67, 76518.98, 242755.94, 801163.21, 172924.07, 35835.08, 46766.45];
$dbc = new Mysql("parks_db", "national_parks", 2);
print_r($names);
$dbc->deleteTableInfo();
$dbc->newTable();
for ($i = 0; $i < count($names); $i++) {
$dbc->openAndAdd($names[$i], $location[$i], $date[$i], $area[$i]);
$dbc->reallyAdd("name", "location", "date_established", "area_in_acres");
}
示例3: date
$array["posted"] = date('F jS\\, Y h:i:s');
$array["textbody"] = htmlspecialchars($_POST["textbody"]);
$array["image"] = $img;
return $array;
}
$jsonarray = jsonArray($imgFile);
print_r($jsonarray);
$mysql = new Mysql();
$json = new Json("test");
if ($securimage->check($_POST['captcha_code']) == false) {
echo "Ding dong, you're wrong!";
echo "Go <a href='javascript:history.go(-1)'>back</a> and try again.";
exit;
} else {
move_uploaded_file($_FILES["imgupload"]["tmp_name"], $imgFile);
$mysql->openAndAdd($jsonarray["title"], $jsonarray["posted"], $jsonarray["textbody"], $jsonarray["image"]);
$mysql->reallyAdd();
$awesome = true;
}
if ($awesome) {
echo "You did it!";
$uploadsuccess = true;
} else {
echo "OOPS. There was an error... (._.')";
}
if ($uploadsuccess == true) {
// header("Location: /testblog.php");
echo "success";
}
?>
<!DOCTYPE html>
示例4: Mysql
<?php
require_once "database.php";
require_once "../Input.php";
$dbc = new Mysql("parks_db", "national_parks", 0);
var_dump($_POST);
try {
$dbc->openAndAdd(Input::getString("parkname"), Input::getString("state"), Input::getString("established"), Input::getString("size"));
} catch (Exception $e) {
echo "Oops! You broke the internet... ;_; " . $e->getMessage() . PHP_EOL;
}
try {
$dbc->littleBobbyTables("name", "location", "date_established", "area_in_acres");
} catch (Exception $e) {
echo "Uh oh! There's a problem with uploading to our database! o_o'" . $e->getMessage() . PHP_EOL;
}
echo "I'm still running though!";
header("Location: /national_parks.php");