English 中文(简体)
PHP 数据库搜索结果回报中的平差错[封闭]
原标题:PHP parse error on database search result return [closed]
  • 时间:2011-10-02 05:55:12
  •  标签:
  • php

我试图从我的手工艺中获取数据,我手里的标识被保存在另一个档案中。 用户名称正从我的表格上发送到页码,一米正在浏览。

Parse出错: syntax出错,意料[, 预期,或 ;C:xampphtdocswaladminipfinder.php,行文31。

我不理解为什么它说,尽管如此,一切都看不起。

Here s my PHP:

<?php
testinclude( db_login.php );

$con = mysql_connect($db_host,$db_username,$db_password);
//$con = mysql_connect( 10.241.10.40 , waladmin , waladmin );
if (!$con)
{
die( Could not connect:   . mysql_error());
}

$db_select=mysql_select_db($db_database);
if(!db_select)
{
die("Could not select the database. <br />".mysql_error());
}

$select =   Select  ;
$column =   IP_Address,Workstation,Username  ;
$from =   FROM  ;
$tables =   admintable  ;
$where =   where Username = " & ControlChars.Quote & Username & Username &           ControlChars.Quote & "ORDER BY admintable.Time_Stamp DESC ;
$query = $select.$column.$from.$tables.$where;

$result = mysql_query($query);
if(!result)
{
die("Could not query the database:  <br />".mysql_error());
}

while($result_row = mysql_fetch_row(($result))){
echo  Username:    . result_row[2] .   <br />  ;
echo  Workstation:   . result_row[2] .   <br />  ;
echo  IP Address:    . result_row[1] .   <br />  ;
}
echo $con;
mysql_close($con)   
echo $con;
?>
最佳回答

更改<代码>result_row[1/2]至$result_row[1/2]

问题回答

You are missing the $ in front of several references to $result_row. Since PHP sees constants, the [ is unexpected.

You have problem in last while loop...you missed $ sign and you also missed semicolumn too...

replace this code with respectives..

while($result_row = mysql_fetch_row(($result))){
echo  Username:    . $result_row[2] .   <br />  ;
echo  Workstation:   . $result_row[2] .   <br />  ;
echo  IP Address:    . $result_row[1] .   <br />  ;
}
echo $con;
mysql_close($con);
echo $con;   




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签