这里的错误是什么,我没有看到? [英] What is the error here that I am not seeing?

查看:62
本文介绍了这里的错误是什么,我没有看到?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的任务的另一个问题。我一直在尝试存储,检索并将图像显示到我的数据库中(这是此任务的要求之一)并且我坚持这个错误,一直在研究看看是什么错误,但我想我已经覆盖了所有的基地,但我想我没有,因为它有一个错误,但无法看到它。



这是我的代码





我检查了遗失分号,缺少括号,丢失引号,但反复无法提出任何我能看到的东西,所以也许三分之一可以看到我不能做什么,非常感谢回报,这里是错误



here is another question my assignment. I have been trying to store, retrieve and display an image into my db(it is one of the requirement for this assignment) and i am stuck on this error, been research to see what is the error but i think i have covered all the bases but i guess I didnt because it has an error somewhere but cant see it.

here is my code for it


I checked for missing semi-colon, missing brackets, missing inverted commas but cud not come up with anything that i can see so maybe a third can see what I cannot, many thanks in return and here is the error

Parse error: syntax error, unexpected '{', expecting '(' in C:\wamp64\www\Taylor_Luana_ITEC244_Assignment1\php\upload_pic.php on line 72





我的尝试:





What I have tried:

<pre><?php
		error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<title> Welcome </title>
		<link rel="stylesheet" type="text/css" href="../css/stylesheet.css" />
	</head>
	<body>
		<div id="container">
			
			<div id="header">
				<div  id="banner">
					<img src="../images/header.jpg" alt="header" />
				</div>
			</div>
			<div id="navbar">
				<ul>
				
					<li><a  href="../index.html" id="tlinks" class="toplinks">Homepage</a></li>
					<li><a  href="featureNaturalWonders.html" id="thold" class="toplinks">Feature Natural Wonders</a></li>
					<li><a  href="contact.html" id="linkhold" class="toplinks" >Contact Us</a></li>
					<li><a  href="register_user.html" id="phold" class="toplinks"> Sign Up</a></li>
					<li><a  href="login_user.html" id="loglinks"class="toplinks"> Login</a></li>
					<li><a  href="aboutus.html" id="panlinks" class="toplinks"> About Us</a></li>
					 
				</ul>	
					<form method="post" id="search"   action="" >						
						<input type="text" name="search" value=""/>
						<input type="submit" value="Search"/>												
					</form>				
									
			</div>	
			
			
			<div id="contentArea">
			
				<?php
				
					include'$db_server.php';
					
					if(isset($_POST['submitBtn']) &&!empty($_POST['submitBtn']))
					{
						if(isset($_FILES['uploadFile']['name']) &&!empty($_FILES['uploadFile']['name']))
						{
							//this code will allowed the file type to be uploaded
							$allowed_extension=array("jpg","jpeg","png","gif");
							
							//file extension
							$ext=strtolower(pathinfo($_FILES["uploadFile"]["name"], PATHINFO_EXTENSION));
							
							//check extension
							if(in_array($ext,$allowed_extension))
							{
								//convert image to base64
							    base64_encode(file_get_contents($_FILES['uploadFile']['temp_name']));
								$encoded_image='data:image/'.$ext.';base64,'.$encoded_image;
								$query = "insert into `images` set `encoded_image` = '".$encoded_image."'";
								mysqli_query ($conn,$query);
								echo"File name:".$_FILES['uploadFile']['name'];
								echo "<br>";
								
								if(mysql_affected_rows($conn)>0)
								{
									echo"status:Uploaded";
									
									$last_insert_id = mysqli_insert_id($conn);
									
								}
								else
								{
									echo "Status: failed to Upload";
								}
								else
								{
									echo "File not allowed";
								}
							}
							
						}
					}
				
					
				?>
				
				<?php
					
					//ths is retrieving the image from the db
					if($last_insert_id)
					{
						$query = "SELECT 'encoded_image' from visitors WHERE 'id'=".$last_insert_id;
						$result=mysqli_query($conn,$query);
						
						
						if(mysqli_num_rows($result)== 1)
						{
							$row=mysqli_fetch_object($result);
							
							echo "<br><br>";
							
							echo '<img src="'.$row->encoded_image.'" width="390">';
						}
					}
									<!---www.mitrajit.com->

					?>
			</div>

	</body>
</html>

推荐答案

db_server.php';

if(isset(
db_server.php'; if(isset(


_POST [' submitBtn'])&&!empty(
_POST['submitBtn']) &&!empty(


_POST [' submitBtn']))
{
if(isset(
_POST['submitBtn'])) { if(isset(


这篇关于这里的错误是什么,我没有看到?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆