Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql PHP搜索内部连接_Php_Mysql_Sql - Fatal编程技术网

Mysql PHP搜索内部连接

Mysql PHP搜索内部连接,php,mysql,sql,Php,Mysql,Sql,我正在使用MYSql数据库,它从我的内部连接查询输出如下: 使用此查询(工作正常) $result=mysql\u查询(“ 选择 `帐户`.`name`、`customfield`.`value`、`note`.`occurrendOnDateTime`noteid from(`note`、`activity`、`ownedsecurableitem`ownedsecurableitem1) 在“活动”项上左键联接“活动”项。“活动id”=`activity`.`id` 左连接'item`.'

我正在使用MYSql数据库,它从我的内部连接查询输出如下:

使用此查询(工作正常)

$result=mysql\u查询(“
选择
`帐户`.`name`、`customfield`.`value`、`note`.`occurrendOnDateTime`noteid
from(`note`、`activity`、`ownedsecurableitem`ownedsecurableitem1)
在“活动”项上左键联接“活动”项。“活动id”=`activity`.`id`
左连接'item`.'id`='activity\u item`.'item\u id`
在“securableem”上左键联接“securableem”。“item\u id”=“item”。“id”
在“ownedsecurableitem”上左键联接“ownedsecurableitem”。“securableitem\u id”=`securableitem`.`id`
在“帐户”上左键加入“帐户”。“ownedsecurableitem\u id”=“ownedsecurableitem”。“id”
在“%u user”上左键联接“%u user”。`id`=`ownedsecurableitem1`.`owner\u user\u id`
在“customfield”上左键联接“customfield”。“id”=“account”。“salecyclecstm\u customfield\u id”`
其中(`account`.`name`不为空)
和'activity`.'id`='note`.'activity\u id`
和`ownedsecurableitem1`.`id`=`activity`.`ownedsecurableitem\u id`
和(`note`.`occurrendOnDateTime`不为空)
名称=“$_POST['query']。”;
按发生顺序日期时间描述
")
或者死(“选择错误:.mysql_Error());
打印“\n”;
$account=“account”;
$sale=“销售周期”;
$date=“日期”;
打印“\t$account\n”;
打印“\t$sale\n”;
打印“\t$date\n”;
而($get\u info=mysql\u fetch\u row($result)){
打印“

”; 打印“\n”; foreach($get_info as$field) 打印“\t$field\n”; 打印“\n”; } 打印“\n”;

我的问题是: 我如何创建一个表单(文本框输入),我可以搜索帐户,它将输出销售周期和日期字段(不在表中)?理想情况下,我希望它输出在同一页上,所以是Java还是Ajax

我有:HTML

<form name="form1" id="form1" method="post" action="search.php"> //change here
Select Name :
<input type="text" name="query" /> 
<input type="submit" name="submit" id="submit" value="search" />
</form>
//在这里更改
选择名称:
PHP

$query=mysql\u query($select)或die($select);
$numrow=mysql\u num\u行($query);
如果($numrow!=0)
{
while($row=mysql\u fetch\u array($query))
{   

首先,您的php编码是错误的。您正在使用
您可以使用javascript创建动态表,下面是一个示例:它允许您进行搜索和排序

<form name="form1" id="form1" method="post" action="search.php"> //change here
Select Name :
<input type="text" name="query" /> 
<input type="submit" name="submit" id="submit" value="search" />
</form>
$query=mysql_query($select) or die($select);
$numrow=mysql_num_rows($query);
if($numrow != 0)
{
while($row=mysql_fetch_array($query))
{   
<?php echo $row['name'];
<?php echo $row['SalesStages'];
<form name="form1" id="form1" method="post" action="search.php"> //change here
Select Name :
<input type="text" name="query" /> 
<input type="submit" name="submit" id="submit" value="search" />
</form>


$query="select * from table where Account='".$_POST['query']."'";
$result = mysql_query($query) or die (mysql_error());
$numrow=mysql_num_rows($result);

while($row=mysql_fetch_array($query))
{   
 echo $row['name'];
 echo $row['SalesStages'];
}