gpt4 book ai didi

php - 我正在尝试从数据库中提取数据,其中数据将从数据库中的两个不同表中提取,错误位于 $returns = mysql_query

转载 作者:行者123 更新时间:2023-11-29 21:28:55 24 4
gpt4 key购买 nike

我试图从数据库中的两个不同表中提取数据,但仍然出现错误。当我运行代码时它不显示任何内容

这是我的代码:

<?php 
$st="";
$sc="";

if (isset($_POST['submit']) && $_POST['submit'] == "submit"){
$st=$_POST['s-t'];
$sc= "WHERE nums like \"%$st%\" or d_n like \"%st%\" ";
}


if (isset ($_GET['look']) && $_GET ['look'] != "") {
$st=$_GET['look'];
$sc = "WHERE nums like \"%$st%\" or d_n like \"%st%\" ";
}

$db = mysql_db_connect();
$rpp = 50;

if (isset($_GET['page'])){

$pn = $_GET['page'];
$begin = ($rpp*$pn)-$rpp;
$finish=($rpp*$pn);
$finish=50;
}
else {
$pn =1;
$begin = 0;
$finish =$rpp;
}

$returns = mysql_query ("SELECT * FROM extenz $sc", $db);
$numer_rows = mysql_num_rows($returns);
$number_pages = ((int) ($numer_rows/$rpp)) +1;

if (($number_rows % rpp) ==0){
$number_pages=$number_pages -1;
}
$returns = mysql_query("SELECT nums, name , p_m FROM extenz, P_exten left join p_exten on extenz $sc order by nums & P_m LIMIT $begin, $finish", $db);

?>

最佳答案

我回答了我的问题

错误出现在以下代码行

$returns = mysql_query("SELECT nums, name , p_m FROM extenz, P_exten  left join p_exten on extenz $sc order by nums & P_m LIMIT $begin, $finish", $db);

更正为

$returns = mysql_query("SELECT extenz.nums, extenz.name,p_exten.P_M FROM extenz LEFT JOIN ON  p_exten.extenz=extenz.nums $sc ORDER BY nums LIMIT $begin, $finish",$db);

关于php - 我正在尝试从数据库中提取数据,其中数据将从数据库中的两个不同表中提取,错误位于 $returns = mysql_query,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35386919/

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