How to echo multiple results from database

How do I echo multiple results. Currently this displays recipe names but I want to be able to echo the steps from the database as well. So the field in the database would be step 1. <?php if (isset($_POST['search'])) { $ingredient1 = $_POST['dropdown1']; $ingredient2 = $_POST['dropdown2']; $ingredient3 = $_POST['dropdown3']; $recipes = mysql_query("

如何从数据库中回显多个结果

我如何回复多个结果。 目前这显示配方名称,但我希望能够回应数据库中的步骤。 所以数据库中的字段将是第1步。 <?php if (isset($_POST['search'])) { $ingredient1 = $_POST['dropdown1']; $ingredient2 = $_POST['dropdown2']; $ingredient3 = $_POST['dropdown3']; $recipes = mysql_query(" SELECT DISTINCT `name` FROM `recipe` r INNER

PHP API array loop

I'm trying a loop through a Facebook Graph API loop via a foreach loop but I'm getting this error: "PHP Parse error: syntax error, unexpected T_VARIABLE, expecting T_CATCH". Any thoughts? Here's the code: // WRITING FIRST 50 FRIENDS LIKES $i = 0; foreach($userfriends[data] as $value) { if($key == "id"){ $friend_id = $value; } try { $username = $friend

PHP API数组循环

我试图通过一个foreach循环通过Facebook图形API循环,但我得到这个错误:“PHP解析错误:语法错误,意外的T_VARIABLE,期待T_CATCH”。 有什么想法吗? 代码如下: // WRITING FIRST 50 FRIENDS LIKES $i = 0; foreach($userfriends[data] as $value) { if($key == "id"){ $friend_id = $value; } try { $username = $friend_id; $uservar = '/'.$username.'/likes?fields=id,category&limit=20';

PHP Parsing/Syntax Error Unexpected End of File

This question already has an answer here: PHP syntax error “unexpected $end” 7 answers You have not clased the mysql_connect errorno() brackets. Use the code below <?php // Create connection $con=mysqli_connect("host","username","password","db"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } // escape variables for sec

PHP分析/语法错误意外的文件结束

这个问题在这里已经有了答案: PHP语法错误“意外$结束”7个答案 你还没有将mysql_connect errorno()括起来。 使用下面的代码 <?php // Create connection $con=mysqli_connect("host","username","password","db"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } // escape variables for security $name = mysqli_real_escape_string($con, $

Parse error: syntax error, unexpected end of file in

你能帮我得到一个分析错误:语法错误,在C: xampp htdocs xampp form-to-email.php文件的意外结束42行想知道你是否可以帮助我这个我很困惑... <?php { if(!isset($_POST['submit'])) { //This page should not be accessed directly. Need to submit the form. echo "error; you need to submit the form!"; $name = $_POST['name']; $attend = $_POST['attend']; $email = $_POST['ema

解析错误:语法错误,文件意外结束

你能帮我得到一个分析错误:语法错误,在C: xampp htdocs xampp form-to-email.php文件的意外结束42行想知道你是否可以帮助我这个我很困惑... <?php { if(!isset($_POST['submit'])) { //This page should not be accessed directly. Need to submit the form. echo "error; you need to submit the form!"; $name = $_POST['name']; $attend = $_POST['attend']; $email = $_POST['ema

Parse error: syntax error, unexpected $end

I am getting the following error Parse error: syntax error, unexpected $end in /home/test/login_success.php on line 20 heres my code <?php $host="mysql.website.com"; // Host name $username="userma,e"; // Mysql username $password="passwrd1"; // Mysql password $db_name="mbs_orderstatus"; // Database name $tbl_name="mbs_users"; // Table name // Connect to server and select databse. m

解析错误:语法错误,意外的$结束

我收到以下错误解析错误:语法错误,意外的$ end在/home/test/login_success.php在第20行 继承我的代码 <?php $host="mysql.website.com"; // Host name $username="userma,e"; // Mysql username $password="passwrd1"; // Mysql password $db_name="mbs_orderstatus"; // Database name $tbl_name="mbs_users"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "

Get the current script file name

If I have PHP script, how can I get the filename from inside that script? Also, given the name of a script of the form jquery.js.php , how can I extract just the "jquery.js" part? Just use the PHP magic constant __FILE__ to get the current filename. But it seems you want the part without .php . So... basename(__FILE__, '.php'); A more generic file extension remover would look

获取当前脚本文件名称

如果我有PHP脚本,如何从脚本中获取文件名? 另外,给定一个形式为jquery.js.php的脚本的名称,我怎样才能提取“jquery.js”部分? 只需使用PHP魔术常量__FILE__即可获取当前文件名。 但它似乎你想要没有.php的部分。 所以... basename(__FILE__, '.php'); 更通用的文件扩展名卸妆将看起来像这样... function chopExtension($filename) { return pathinfo($filename, PATHINFO_FILENAME); } var_dump(chopExtension

PHP login and get user information

Question: How can I get the user information when the user successfully login? Here is my login.php code <?php if($_SERVER['REQUEST_METHOD'] == 'POST') { $username = $_POST['username']; $password = $_POST['password']; // mysql connect function here.... // mysql query here.... $sql = "SELECT * FROM user_accounts WHERE username = '$username' and password = '$password'";

PHP登录并获取用户信息

问题:如何在用户成功登录时获取用户信息? 这是我的login.php代码 <?php if($_SERVER['REQUEST_METHOD'] == 'POST') { $username = $_POST['username']; $password = $_POST['password']; // mysql connect function here.... // mysql query here.... $sql = "SELECT * FROM user_accounts WHERE username = '$username' and password = '$password'"; $result = mysql_query($sql); $count = m

syntax error, unexpected end of file

I'm practicing Codeigniter PHP Framework, also I'm very new to it. I have created View (login.php) in view folder of Framework. My issue is that I'm getting the following error: Parse error: syntax error, unexpected end of file Please check the code with what is the syntax error into it. <h2>Login</h2> <?php if($error==1){ ?> <p>Your username / password

语法错误,意外的文件结束

我正在练习Codeigniter PHP框架,我也很新。 我在Framework的视图文件夹中创建了View(login.php)。 我的问题是,我收到以下错误: 解析错误:语法错误,文件意外结束 请检查代码中包含哪些语法错误。 <h2>Login</h2> <?php if($error==1){ ?> <p>Your username / password did not match.</p> <? } ?> <form action="<?=base_url?>users/login" method="post"> <

html tag causing unexpected end of file in .php file

When I open the file using wampserver on my browser it says: "Parse error: syntax error, unexpected end of file in C:wampwwwTestsFileUploadPractiseForm.php on line 53." I am using php scripts inside the body of the file. Can't figure out what is the problem. Here is the code: <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data

html标记导致.php文件中意外的文件结尾

当我在浏览器上使用wampserver打开文件时,它说:“解析错误:语法错误,在第53行的C: wamp www Tests FileUploadPractiseForm.php中出现意外的文件结尾。” 我在文件正文中使用了php脚本。 无法弄清楚是什么问题。 代码如下: <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" na

Error : Parse error: syntax error, unexpected $end

This question already has an answer here: unexpected $end [closed] 2 answers Problem is on 143rd line,. You are closing php 2 times 143rd line and 180th line so just remove ?> from 143rd line on line 132 you are closing the php code with '?>'. And then you continue without opening another '<?php' .remove that line. ?> if (isset($images->image

错误:解析错误:语法错误,意外的$结束

这个问题在这里已经有了答案: 意外的$结束[关闭] 2个答案 问题在第143行。 你正在关闭php 2次 第143行和 第180行 所以请从第143行删除?> 在132行,你正在用'?>'关闭php代码。 然后你继续打开另一个'<?php'删除该行。 ?> if (isset($images->image_fulltext) and !empty($images->image_fulltext)) { 因为你有许多不必要的开放和关闭的PHP部分,你必须有更多类似的