....
public function dbConnect() {
...
...
return $db;
}
}
$db = $testConnect->dbConnect();
$sql = $db->query('SELECT name FROM qwert');
print_r($sql);
mysqli_result Object ( [current_field] => 0 [field_count] => 1 [lengths] => [num_rows] => 1 [type] => 0 )
<?php if (isset($_GET['add-entry'])): ?>
<br />
<center>
<form method="POST" action ="/admin/admin.php";
<label>Название</label>
<input type="text" name="name"><br />
<label>Юридическое название</label>
<input type="text" name="ur_name"><br />
<label>Дата запуска проекта</label>
<input type="date" name="startdate"><br />
<label>Общий приход</label>
<input type="text" name="globalinput"><br />
<label>Общий расход</label>
<input type="text" name="globaloutput"><br />
<input type="submit" name="submit" value="Добавить"><br />
</form>
</center>
<?php endif ?>
<?php
if ($_POST['submit']==true) {
$name = $_POST['name'];
$ur_name= $_POST['ur_name'];
$startdate = $_POST['startdate'];
$globalinput = $_POST['globalinput'];
$globaloutput = $_POST['globaloutput'];
$mysqli->query("INSERT INTO projects VALUES(0,'$name','$ur_name','$startdate','$globalinput','$globaloutput')") or die ("Your bunny wrote, ne dobavlyaet! >_<");
}
?>
?php
$name=$_POST['name'];
$score=$_POST['score'];
$uploads_dir = '/images';
$tmp_name = $_FILES["screenshot"]["tmp_name"];
$name = $_FILES["screenshot"]["name"];
move_uploaded_file($tmp_name, "$uploads_dir/$name");
if ($_POST['submit']==true) {
$mysqli->query("INSERT INTO guitar VALUES(0, NOW(), '$name', '$score', '$pic')");
}
?>
Warning: move_uploaded_file(/images/WIN_20131204_232139.JPG) [function.move-uploaded-file]: failed to open stream: No such file or directory in C:\srv\OpenServer\domains\localhost\tmp\addscore.php on line 35
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'H:\php49F4.tmp' to '/images/WIN_20131204_232139.JPG' in C:\srv\OpenServer\domains\localhost\tmp\addscore.php on line 35
Warning: move_uploaded_file(C:/srv/OpenServer/domains/localhost/images/) [function.move-uploaded-file]: failed to open stream: Permission denied in C:\srv\OpenServer\domains\localhost\tmp\addscore.php on line 29
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'H:\phpABBE.tmp' to 'C:/srv/OpenServer/domains/localhost/images/' in C:\srv\OpenServer\domains\localhost\tmp\addscore.php on line 29
Array ( [screenshot] => Array ( [name] => WIN_20131201_052047.JPG [type] => image/jpeg [tmp_name] => H:\phpB65.tmp [error] => 0 [size] => 122294 ) )
<?php
define('GW_UPLOADPATH', 'images/');
$name=$_POST['name'];
$score=$_POST['score'];
$pic = $_FILES['screenshot'];
$pic=move_uploaded_file($_FILES['screenshot'], GW_UPLOADPATH);
?>
bool(false)