-2

PHP Parse 错误:语法错误,第 20 行 /home/xxx/public_html/xxxx/index.php 中的意外 ','

代码:

<?php
$title = "Home";
$page = "index";
$return = TRUE;
require( "./configuration.php" );
include( "./include.php" );
$returned = @( "harper");
if ( ( $returned ) != @( "harper" ) )
{
exit( "Error. Contact Us." );
}
$rows = ( "SELECT * FROM `client` WHERE `clientid` = '".$_SESSION['clientid']."' LIMIT  1" );
$result1 = ( "SELECT `serverid`, `ipid`, `name`, `game`, `status`, `online`, `slots`,  `type`, `port` FROM `server` WHERE `clientid` = '".$_SESSION['clientid']."' ORDER BY  `serverid`" );
$servers = array( );
while ( $rows1 = ( $result1 ) )
{
if ( !empty( $rows1['ipid'] ) )
{
    $rows2 = ( "SELECT `ip` FROM `ip` WHERE `ipid` = '".$rows1['ipid']."' LIMIT 1" );
    $rows1 = ( $rows1, $rows2 );
}
( $servers, $rows1 );
}

1 part
4

4 回答 4

6

PHP 不支持在括号内合并两个表达式:

$rows1 = ( $rows1, $rows2 )

您需要添加函数调用、数组关键字或类似内容。

于 2012-09-28T11:12:26.953 回答
3

您试图以错误的方式创建数组:

$rows1 = ( $rows1, $rows2 );

它应该是

$rows1 = new Array( $rows1, $rows2 );

或者

$rows1 = $rows1.$rows2;

代码中的最后一行也是如此:

new Array( $servers, $rows1 );

无论如何,你想用它做什么?它不会重定向到任何东西,所以它只是丢失了。您应该将其保存在变量中

如果要存储$rows1在 中$servers,请执行以下操作:

$servers[] = $rows1;
于 2012-09-28T11:12:44.677 回答
1

您必须.像此编辑一样用于连接使用

$rows1 = $rows1.$rows2;

array用于将它们存储在这样的数组中

$rows1 = array($rows1,$rows2);
于 2012-09-28T11:15:44.853 回答
1

你真正想做的代码 $rows1 = ( $rows1, $rows2 ); ?

您的代码看起来像一个函数调用,它不是 php 语句。

例如:$rows1 = array($rows1, $rows2);

于 2012-09-28T11:16:58.900 回答