当前位置: 首页>>代码示例>>PHP>>正文


PHP getCarData函数代码示例

本文整理汇总了PHP中getCarData函数的典型用法代码示例。如果您正苦于以下问题:PHP getCarData函数的具体用法?PHP getCarData怎么用?PHP getCarData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getCarData函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCarData

<?php

require_once "functions.php";
$car_list = getCarData();
?>
<table border= 1>
	<tr>
		<th>id</th>
		<th>user_id</th>
		<th>auto nr märk</th>
		<th>auto värv</th>
	
	</tr>
	<?php 
//iga massiivis oleva elemendi kohta
//count($car_list) - massiivi pikkus
for ($i = 0; $i < count($car_list); $i++) {
    //$i = $i + 1  ==  $i =+ 1  ==o   $i++
    echo "<tr>";
    echo "<td>" . $car_list[$i]->id . "</td>";
    echo "<td>" . $car_list[$i]->user_id . "</td>";
    echo "<td>" . $car_list[$i]->number_plate . "</td>";
    echo "<td>" . $car_list[$i]->color . "</td>";
    echo "</td>";
}
?>
	


</table>
开发者ID:sizenn,项目名称:6.tund,代码行数:30,代码来源:table.php

示例2: deleteCar

<?php

require_once "functions.php";
//kas kustutame
//?delete=vastav id mida kustutada on aadressireal
if (isset($_GET["delete"])) {
    echo "kustutame id " . $_GET["delete"];
    //käivitan funktsiooni,saadan kaasa id
    deleteCar($_GET["delete"]);
}
//salvestan andmebaasi
if (isset($_POST["save"])) {
    updateCar($_POST["id"], $_POST["plate_number"], $_POST["color"]);
}
//käivitan funktsiooni
$array_of_cars = getCarData();
//trükin välja esimese auto
//echo $array_of_cars[0]->id." ".$array_of_cars[0]->plate;
?>

<h2>Tabel</h2>
<table>
	<tr>
		<th>id</th>
		<th>Kasutaja id</th>
		<th>numbrimärk</th>
		<th>Värv</th>
		<th>Kustuta</th>
		<th>Redigeeri</th>
	</tr>
	<?php 
开发者ID:jalalaba,项目名称:6.tund,代码行数:31,代码来源:table.php

示例3: deleteCar

<?php

require_once "functions.php";
//kas kustutame, ?delete = vastav id mida kustutada on aadressireal
if (isset($_GET["delete"])) {
    echo "Kustutame id" . $_GET["delete"];
    //käivitan funktsiooni, saadan kaasa id
    deleteCar($_GET["delete"]);
}
//salvestan andmebaasi
if (isset($_POST["save"])) {
    updateCar($_POST["id"], $_POST["plate_number"], $_POST["color"]);
}
//käivitan funktsiooni
$car_array = getCarData();
//trükin välja esimese auto
//echo $car_array[0]->id." ".$car_array[0]->plate;
?>

<h2>Tabel</h2>
<table border="1">
	<tr>
		<th>Id</th>
		<th>User id</th>
		<th>Numbrimärk</th>
		<th>Värv</th>
		<th>X</th>
		<th>Edit</th>
	</tr>

	<?php 
开发者ID:earist,项目名称:6.-tund,代码行数:31,代码来源:table.php

示例4: deleteCar

<?php

require_once "functions.php";
//kas kustutame
if (isset($_GET["delete"])) {
    echo "Kustutame id" . " " . $_GET["delete"];
    // käivitan funktsiooni, saadan kaasa id
    deleteCar($_GET["delete"]);
}
//salvestan ab'i
if (isset($_POST["Save"])) {
    updateCar($_POST["id"], $_POST["number_plate"], $_POST["color"]);
}
$array = getCarData();
?>
<h2>Tabel</h2>
<table border=1>
	<tr>
		<th>ID</th>
		<th>User ID</th>
		<th>Numbrimärk</th>
		<th>Värv</th>
		<th>Kustuta</th>
		<th>Muuda</th>
	</tr>
	
	<?php 
for ($i = 0; $i < count($array); $i++) {
    //kasutaja tahab muuta
    if (isset($_GET["edit"]) && $array[$i]->id == $_GET["edit"]) {
        echo "<tr>";
开发者ID:hendval,项目名称:tund6,代码行数:31,代码来源:table.php

示例5: array

    $stmt->bind_result($id, $user_id, $number_plate, $color);
    $stmt->execute();
    $array = array();
    while ($stmt->fetch()) {
        $car = new StdClass();
        $car->id = $id;
        $car->number_plate = $number_plate;
        $car->user_id = $user_id;
        $car->color = $color;
        array_push($array, $car);
        //echo "<pre>";
        //var_dump($array);
        //echo "</pre>";
    }
    $stmt->close();
    $mysqli->close();
    return $array;
}
function deleteCar($id_to_be_deleted)
{
    $mysqli = new mysqli($GLOBALS["servername"], $GLOBALS["server_username"], $GLOBALS["server_password"], $GLOBALS["database"]);
    $stmt = $mysqli->prepare("UPDATE car_plates SET deleted=NOW() WHERE id=?");
    $stmt->bind_param("i", $id_to_be_deleted);
    if ($stmt->execute()) {
        header("Location: table.php");
    }
    $stmt->close();
    $mysqli->close();
}
getCarData();
开发者ID:kertkulp,项目名称:6.tund,代码行数:30,代码来源:functions.php


注:本文中的getCarData函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。