gpt4 book ai didi

php - 如何排除选择和所有相关的(MySQL + PHP)

转载 作者:行者123 更新时间:2023-11-29 19:18:25 25 4
gpt4 key购买 nike

我正在尝试解决一个神秘的代码,在选择中写一个数字我会得到与该数字相反的数字 我几乎完成了唯一的问题,我可能会记忆起相反的事情,因为他在另一门类(class)中确实有另一个记录更详细地说,当我询问我的 PHP 类(class)时,我的 PHP 类(class)很好地告诉了我所有人如何没有参加类(class) 1,但有些人因为他们有其他类(class)而被召回

当我选择例如类(class) X 时的问题,我确实得到了所有没有参加类(class) X 的人,但有些人是从同一个表中调用的,因为他们确实参加了同一个表中的其他类(class)

我确实使用以下代码解决了第一个问题

if(isset($_GET['course_guid']) && $_GET['course_guid']!="" )
$f.=" AND s.course_guid != '".$_GET['course_guid']."'";

我使用以下代码创建了另一个页面 Select.php 以忽略 Orig.php 中的所有已识别人员

<?php


if(isset($_GET['id']))
foreach($_GET as $key => $post)
$_GET[$key]=m($post);
$ff="";

if(isset($_GET['id']) && $_GET['id']!="")
$ff.=" AND cs.id = '".$_GET['id']."' ";

$prns =(isset($_GET['prn'])? $_GET['prn']:'');
if(isset($prns) && $prns!="")
$ff.=" AND cs.prn = '".$prns."' ";

$course_guids =(isset($_GET['course_guid'])? $_GET['course_guid']:'');
if(isset($course_guids) && $course_guids!="")
$ff.=" AND cs.course_guid = '".$course_guids."' ";


$from_time=system_time();
$date_from= date("d",$from_time)."-".date("m",$from_time)."-".date("Y",$from_time);
$date_to=date("d",system_time())."-".date("m",system_time())."-".date("Y",system_time());
if(isset($_GET['alldates']) && $_GET['alldates']=="on") {
$t_f=mktime(0,0,0,6,1,2011);
$t_t=system_time();
} else {
$t_f=mktime(0,0,0,substr($date_from,3,2),substr($date_from,0,2),substr($date_from,6,4));
$t_t=mktime(23,59,59,substr($date_to,3,2),substr($date_to,0,2),substr($date_to,6,4));
}

$query="SELECT cs.id,cs.prn,cs.course_guid FROM courses_attend cs

WHERE cs.time BETWEEN $t_f AND $t_t

$ff

";

//echo "$prns";
$rs22 = mysql_query($query) or die(mysql_error());

// $total22 = mysql_num_rows($rs22);
/*
while($row22=mysql_fetch_assoc($rs22))
{
$prnss =(isset($row22['prn'])? $row22['prn']:'');
print($prnss);
}
*/
?>

打印($prnss);//这应该是 Orig.php 中需要调用的代码它应该在循环 mysql_fetch_array 中调用,它不能在 orig.php 中使用,因为我已经有一个结构和另一个循环在该页面中,因为真正的输出接口(interface)在那里据我所知,我确实认为函数回调()将是一个解决方案,但另一方面我不知道如何创建一个

最佳答案

//回答

for ($i= 0; $i < mysql_num_rows($rs22);$i++) {
$row22 = mysql_fetch_assoc($rs22);
$prnss = $row22['prn'];
// echo "$prnss"; // return print all Omitted data
// echo "<br />\n";
$f.=" AND s.prn != '".$prnss."' ";
}

通过在 Orig.php 中添加此解决方案

另一方面,经过测试 Select.php 数据可以添加到 Orig.php

致以诚挚的问候

关于php - 如何排除选择和所有相关的(MySQL + PHP),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42578570/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com