PHP:如何使用 MySQLi 显示每个 HTML 表行的多个 MySQL 表记录

2023-12-29

我想在 php 中从 mysql 数据库连续显示一组元素。我已经这样做了,但我的数据出现在一长列中。我希望每个新元素都一个挨一个地出现。

这是我得到的屏幕截图。我希望第一个位于第二个旁边:

https://www.dropbox.com/s/2y3g0n7hqrjp8oz/Capture.PNG?dl=0 https://www.dropbox.com/s/2y3g0n7hqrjp8oz/Capture.PNG?dl=0

这是我的代码:

    <?php
    require_once 'core/init.php';
    include 'includes/navigation.php';

    $sql = "SELECT * FROM interviews WHERE featured = 1";
    $featured = $db->query($sql);


    <html>

enter code here enter code here

    <link href="http://localhost/menu/css/academy.css" rel="stylesheet" `enter code here`type="text/css" />
    <?php while($product = mysqli_fetch_assoc($featured)) : ?>
    <table>
    <tr>
        <th>
        <div id="element1"></div>
        <div id="content1">

            <img src="<?= $product['image']; ?>" alt="<?= $product['title']; ?>">
            <h4><?= $product['title']; ?></h4>
            <hr>
            <p class="description"><?= $product['description']; ?></p>

    <!--------BUTTON 3-------->
    <div id="hovers">
        <a href="#" class="button">
            <span class="contentbut"> Read More</span>
        </a>
    </div>
    </th>
</tr>
    </table>    
    <?php endwhile; ?>      
    </div>
</div>

请帮忙。

谢谢你!


介绍

Note:这个答案详细介绍了创建多记录到一行安排。但是,可以更改此答案以提供单记录到一行安排。

分离关注点将帮助您编写更清晰的代码。分离关注点将使您的代码更容易维护。干净的代码是松散耦合,不受嵌入依赖项的负担。干净的代码识别其依赖关系函数签名 and 类构造函数期望这些需求能够从外部得到满足。干净的代码有紧密的凝聚力。这意味着函数/方法有一个任务,类有一个目标。干净的代码通常反映在已分解和细化的任务中(但并非总是如此)。干净的代码是我努力追求的理想,但没有人是完美的。

尝试想办法获得尽可能多的东西SQL and PHP从你的HTML文件。仅插入变量和显示函数的返回结果可以使 HTML 更易于阅读。良好的 HTML 结构也很重要。

分解动态构建的任务<table>基于 SQL 查询的结果是很有可能的。最终,您可能决定使用CSS and divs出于样式和响应能力的原因。可以更改此代码来实现此目的(毕竟,您只是将盒子堆叠成行)。

最终,创建一个 OOP 类(带有自定义命名空间)非常适合模块化您的代码并从代码中获取绝大多数符号(变量名称等)。全局命名空间.


在我们开始之前:php.ini:include_path

您想为您的项目设置逻辑目录架构吗?

Set the include_path代替php.ini.

如果您搜索您的php.ini为了include_path设置,您可以将其设置为一个目录,或任何一组适当的目录。这样,您就可以按照您想要的方式将文件排列在目录中,并且您的include, include_once, require, and require_once语句仍然会找到他们想要导入的文件。您不必输入绝对路径,例如/dir/dir/file.php或相对路径,如../../core/database.php。在这两种情况下,您都可以只指定文件名。

Example:

include 'file.php';     //Finds the file if it is in the include_path.
require 'database.php'; //Finds the file if it is in the include_path.

Note:将库文件和其他纯 PHP 编码文件(等)保留在 webroot 或任何可公开访问的目录之外。将它们逻辑地保持在网络根目录之上。设置include_path所以你不必继续做../../blah/foo一直。


Tasks

1)首先,创建一个函数来获取 a 的实例mysqli_result object.

/**
 * Returns a string, or
 * throws an UnexpectedValueException, otherwise.
 */
function isString($string)
{
    if (!is_string($string)) {
        throw new UnexpectedValueException("$string must be a string data type.");
    }

    return $string;
}

/**
 * Returns a mysqli_result object, or throws an `UnexpectedValueException`.
 * You can reuse this for other SELECT, SHOW, DESCRIBE or EXPLAIN queries.
 */
function getMySQLiResult(MySQLi $db, $sql)
{
    $result = $db->query(isString($sql));

    if (!($result instanceof mysqli_result)) {
        throw new UnexpectedValueException("<p>MySQLi error no {$db->errno} : {$db->error}</p>");
    } 

    return $result;
}

2) 其次,创建一个函数来容纳 SQL 并调用 getMySQLiResult()。

/**
 * Make sure you can get the data first.
 * returns a mysqli_result object.
 */
function getInterviews(MySQLi $db)
{
    $sql = "SELECT * FROM `interviews` WHERE `featured` = 1";
    return getMySQLiResult($db, $sql);
}

3)创建一个用于构建表数据的函数(<td></td>) 单元格及其内容。放allHTML 或您需要的数据对每个记录重复在这里。

/**
 * Returns one database table record a table data cell.
 */
function buildCell(array $record)
{
    return "<td>\n".
                '<img src="' .$record['image']. '" alt="' .$record['title']. '">' ."\n".
                '<h4>' .$record['title']. '</h4>' . "\n" .
                '<hr>' . "\n" .
                '<p class="description">' .$record['description']. '</p>' . "\n" .
                '<div id="hovers">
                     <a href="#" class="button">
                         <span class="contentbut">Read More</span>
                     </a>
                 </div>' . "\n 
            </td>\n";
}

4)创建一个用于构建表行的函数。警惕部分行。 :-)

First,一点辅助功能。

/**
 * Returns one <tr></tr> element. Helper.
 */
function makeTr($tds)
{
    return "<tr>\n" .isString($tds). "\n</tr>";
}

Second, 真正的交易。

function buildTableRow (array $tableRow)
{
    return makeTr(buildCell($tableRow)) . "\n";   //Done!
}

/**
 * Returns a string of multiple <tr></tr> elements,
 * $maxRecords per row.
 */
function buildTableRows(array $tableRows, $numRecords, $maxPerRow)
{
    $rows          = []; // Holds finished groups of <tr>s
    $row           = ''; // Temporary variable for building row of <td>s
    $numCells      = 0;  // Number of cells currently in a row of <td>s.
    $numRows       = (int)($numRecords / $maxPerRow); //Rows to make.
    $numStragglers = $numRecords % $maxPerRow;        // Extra <td>s, partialRow.

    if ($numStragglers !== 0) {  //Check if extra row is needed.
        $numRows += 1;
    }

    foreach ($tableRows as $record)
    {
        $row .= buildCell($record);
        ++$numCells;

        if ($numCells === $numRecords) {  // Builds partial, last row, if needed.
            $rows[] = makeTr($row);
            break;                        // Done!
        }

        if ($numCells === $maxPerRow) {   // Builds full row.
            $rows[]   = makeTr($row);     // Save the row.
            $numCells = 0;                // Start cell counter over.
            $row      = '';               // Start a new row.
        }
    }

    if(count($rows) !== $numRows) {  //Verify all rows were created.
        throw new RuntimeException("Rows (<tr>) for all records were not created!");
    }

    return  implode("\n", $rows) . "\n";  //Return all rows as a string.
}

5) 创建一个函数,在页面上输出您需要的 HTML。在这种情况下,您只需要一 (1) 次替换即可出现在 HTML 中。

/**
 * returns a set of HTML table rows (<tr></tr>) to fill a <tbody>.
 * or, returns an alternative message.
 */
function drawInterviews(MySQLi $db, $maxPerRow) //PDO is recommened. Dependency injection.
{
    $defaultMessage = "<tr>\n<td>There are no featured interviewers.<td>\n<\tr>\n";

    try {
           if (!is_int($maxPerRow) || $maxPerRow < 1) {
              throw new RangeException("The number of interviews per row must be an integer equal to 1, or greater than 1.");
           }

           //Make a robust connection sequence, or pass it in like above.
           //$db       = new mysqli('host', 'user', 'password', 'dbname');
           $result     = getInterviews($db);
           $numRecords = result->num_rows;

           if ($numRecords < 1) {
               return $defaultMessage;
           }

           if ($numRecords === 1) {
               return buildTableRow($result->fetch_assoc()); 
           }                

           return buildTableRows($result->fetch_all(), $numRecords, $maxPerRow);

    } catch (Exception $e)
         //Something went wrong with the query.
         error_log($e->getMessage());
    } finally { //PHP 5.5+
        $result->free();
    }

    return $defaultMessage;
}

6) 现在,有一个好的 HTML<table>结构。只需要一次插值。假设三个<td>每行 s(记录)...

不管怎样,如果你想要一张桌子,就把这张桌子“骨架”的副本放在里面academytest.php,介于headerfooter(即主要<body>HTML 文档的内容)。

<table>
    <caption>Featured Interviewers</caption> <!-- Centers above table. -->
    <thead>
        <tr>                  <!-- If needed. -->
            <th>Heading1</th> <!-- If needed. -->
            <th>Heading2</th> <!-- If needed. -->
            <th>Heading3</th> <!-- If needed. -->
        </tr>
    </thead>
    <tfoot></tfoot>           <!-- If needed. Yes, it goes after <thead>. -->
    <tbody>
        <!-- <div id="element1"></div> --> //What goes between here?
        <!-- <div id="content1">       --> //What's this? 
        <?= drawInterviews($db, 3); ?>  <!-- Dependency injection. -->
    </tbody>
</table>    

所有这些都可以变得更加模块化和可重用(甚至面向对象)。


Update:

根据您的 Dropbox 代码...

学院测试.php

1)最好的办法是创建一个名为的单独的 PHP 文件tbodyFiller.php,或类似的东西。把所有的函数都放到这个文件里,except for getInterviews() and drawInterviews()这将进入academyLibray.php, isString()这将进入library.php, and getMySQLiResult()哪个将进入database.php(以前init.php).

The 开始 of academytest.php应该看起来像这样:

<?php
//                       academytest.php
require '../../includes/library.php';    //For now, put generic helper functions here. Group them, later.
require_once '../../core/database.php';  //Formerly, init.php. Put getMySQLiResult() in here.
require '../../includes/academyLibrary.php'; //Put the two "interview"  functions here.

$db = getMySQLi();  //Many things are dependent on this being here.

require '../../includes/navigation.php';

/***************** DELETE THESE LINES *****************/
//$sql = "SELECT * FROM interviews WHERE featured = 1";
//$featured = $db->query($sql);
/******************************************************/

在页脚中academytest.php,关闭与数据库的连接。

<!-- ------FOOTER------ -->
<?php
    include '../../includes/footer.php';
    $db->close(); //Ensures $db is available to use in the footer, if necessary.
?>

库.php

The 开始 of library.php应该看起来像这样:

<?php
//                       library.php

/**
 * Returns a string, or
 * throws an UnexpectedValueException, otherwise.
 */
function isString($string)
{
    if (!is_string($string)) {
        throw new UnexpectedValueException("$string must be a string data type.");
    }

    return $string;
}

I think init.php应该被命名database.php。您可以学习使用面向对象的构造函数(使用new)序列,并在闲暇时进行错误检查。最终,你会想要学习PDO http://php.net/manual/en/book.pdo.php.

另外,创建一个单独的文件来保存您的凭据。现在,这比将它们硬编码到getMySQLi()功能。

dbCreds.php

<?php

//                        dbCreds.php

$host     =  ''; //IP or DNS name: string.
$username =  ''; //Your account: string.
$passwd   =  ''; //The password: string.
$dbname   =  ''; //The database you want to work with: string.

//*************************************************************************
//$port   =  '3306'; //Un-comment and change only if you need a differnt TCP port. 
                     //Also, you would need to add a $port as your last argument in new MySQLi(),
                     //in the getMySQLi() function.

数据库.php

<?php
//                       database.php
/**
 * Returns a mysqli_result object, or throws an `UnexpectedValueException`.
 * You can reuse this for other SELECT, SHOW, DESCRIBE or EXPLAIN queries.
 */
function getMySQLiResult(MySQLi $db, $sql)
{
    $result = $db->query(isString($sql));

    if (!($result instanceof mysqli_result)) {
        throw new UnexpectedValueException("<p>MySQLi error no {$db->errno} : {$db->error}</p>");
    } 

    return $result;
}

function getMySQLi() //This can be improved, but that's not the issue right now.
{
    require_once 'dbCreds.php'; //Choose your own file name. Do not put in public directory.

    $db = new mysqli($host, $username, $passwd, $dbname); //$port would be next.

    if(!($db instanceof MySQLi)){
        throw new UnexpectedValueException("A MySQLi object was not returned during your connection attempt.");
    }

    if(isset($db->connect_error)){
        throw new UnexpectedValueException("The database connection was not established. {$db->connect_errno} : {$db->connect_error}");
    }

    return $db
}  //Using the object form of MySQLi object has side benenfits.

学院图书馆.php

The 开始 of academyLibrary.php应该看起来像这样:

<?php
//                       academyLibrary.php
require 'tbodyFiller.php'; //Put all but four functions in here.

function getInterviews(MySQLi $db)
{
    $sql = "SELECT * FROM `interviews` WHERE `featured` = 1";
    return getMySQLiResult($db, $sql);
}

/**
 * Comments //etc...
 */
function drawInterviews(MySQLi $db, $maxPerRow)
{
    //The code, etc ...
}

如果您还没有配置您的include_path里面的php.ini, 确保academyLibrary.php and tbodyFiller.php位于same目录。


导航.php

我们将用面向对象的形式取代使用 MySQL 的过程形式。这很简单,我们不需要做太多改变。我目前不会替换您的循环或查询,但我的建议是改掉这个习惯放置 PHP 循环和 SQLdirectly在你的 HTML 中。找到一种使用函数或方法的方法,就像我对表中所做的那样academytest.php。这个时候你应该已经有足够的例子了。 :-)

重构

我花了一些时间重构这个文件。这是我在顶部的内容。再次,您可能希望创建另一个 PHP 文件,例如navLibrary.php,并将这些函数放入其中。在这种情况下,您可以用一行替换下面看到的所有函数,require 'navLibrary.php';。当然,这种导入代码的方式可能取决于您的配置include_path里面的php.ini.

<?php
//                    navigation.php    

function getPqueryMainData(MySQLi $db)
{
    $sql = "SELECT * FROM `mainmenu` WHERE `parent` = 0";       //pqueryMain
    return getMySQLiResult($db, $sql);
}

function getPqueryData(MySQLi $db)
{
    $sql = "SELECT * FROM `categories` WHERE `parent` = 0";     //pquery
    return getMySQLiResult($db, $sql);
}

function getCquery1Data(MySQLi $db)
{
    $sql = "SELECT * FROM `categories` WHERE `parent` = 1";     //cquery1
    return getMySQLiResult($db, $sql);
}

function getCquery2Data(MySQLi $db, $int)
{
    $sql = "SELECT * FROM `categories` WHERE `parent` = '$int'"; //cquery2
    return getMySQLiResult($db, $sql);
}

//Consider doing at most 3 queries early on.
//Consider using better names for your variables.
//I get that 'p' means "primary", and 'c' means "child", but come on. :-) 

$pqueryMain = getPqueryMainData($db);
$pquery     = getPqueryData($db);
$cquery1    = getCquery1Data($db);
$cquery2    = null;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

PHP:如何使用 MySQLi 显示每个 HTML 表行的多个 MySQL 表记录 的相关文章

  • 在 WooCommerce 中添加到购物车之前清空购物车

    我正在使用 WP 作业管理器和 Woo Subscriptions Now 最初 我选择了一个套餐 Woo Subscription 然后我添加了所有细节 但没有提交 回到网站 所以要再次购买 我需要选择一个套餐 于是我选择了套餐并填写了详
  • 重写 URL,将 ID 替换为查询字符串中的标题

    我对 mod rewrite 很陌生 但我做了一些搜索 但找不到这个问题的答案 我有一个网站 它只有一个 PHP 页面 根据查询字符串中传递给它的 ID 提供数十页内容 我想重写 URL 以便此 ID消失并替换为从数据库中提取的页面标题 例
  • Facebook 应用程序无法获取会话

    我正在 Heroku 上为 Facebook 开发一个非常基本的 PHP 应用程序 它显示非常基本的用户信息 如姓名 个人资料图片 但该应用程序在 getToken 方法中停止 我在登录我的个人资料后尝试了该应用程序 但仍然出现相同的消息
  • 如何使用canvas.toDataURL()将画布保存为图像?

    我目前正在构建一个 HTML5 Web 应用程序 Phonegap 本机应用程序 我似乎不知道如何将画布保存为图像canvas toDataURL 有人可以帮我吗 这是代码 有什么问题吗 我的画布被命名为 canvasSignature J
  • Mysqli 更新抛出 Call to a member function bind_param() 错误[重复]

    这个问题在这里已经有答案了 我有一个 70 80 字段表单 需要插入到表中 因此我首先根据表单中的输入名称在数据库中创建了一个表 而不是手动创建一个巨大的插入语句 这是我使用的代码创建 更改表 function createTable ar
  • 在 Yii 的标准中如何获得计数 (*)

    我正在尝试构建一个具有以下内容的查询group by属性 我正在尝试得到id和count它一直告诉我count is invalid列名 我怎样才能得到count来自group by询问 工作有别名 伊伊 1 1 11 其他不及格 crit
  • PHP 扩展开发入门 [关闭]

    Closed 这个问题正在寻求书籍 工具 软件库等的推荐 不满足堆栈溢出指南 help closed questions 目前不接受答案 请推荐有关 PHP 低 级 modules 编程接口的帮助文章或教程 搜索我的书签 我发现的唯一链接是
  • 按百分比设置 bootstrap 模态身高

    我正在尝试制作一个带有主体的模态 当内容变得太大时 该主体会滚动 但是 我希望模式能够响应屏幕尺寸 当我将最大高度设置为 40 时 它没有任何效果 但是 如果我将最大高度设置为 400px 它会按预期工作 但不会响应 我确信我只是错过了一些
  • PHP print_r() 中 _r 的含义是什么?

    我见过这个答案 https stackoverflow com questions 13103410 what does r suffix mean就这样 但我不确定它对于 PHP 是否相同 如果是 可重入的含义是什么 From PHP n
  • 使用 json_encode() 函数在 PHP 数组中生成 JSON 键值对

    我正在尝试以特定语法获取 JSON 输出 这是我的代码 ss array 1 jpg 2 jpg dates array eu gt 59 99 us gt 39 99 array1 array name gt game1 publishe
  • Codeigniter - 出现 404 Not Found 错误

    我们在 godaddy 有两个托管套餐 我们的实时网站使用以下 htaccess 文件运行良好 无需在 url 中使用 index php 即可访问网站 RewriteEngine On RewriteCond REQUEST FILENA
  • JavaScript 中数组的 HTML 数据列表值

    我有一个简单的程序 它必须从服务器上的文本文件中获取值 然后将数据列表填充为输入文本字段中的选择 为此 我想要采取的第一步是我想知道如何动态地将 JavaScript 数组用作数据列表选项 我的代码是
  • PHP 中的引用

    我正在编写一个自定义博客引擎 并且希望拥有类似于 Wordpress 的引用 我可以查看 WordPress 源代码 但我真的更喜欢某种教程 但到目前为止我还没有找到 有没有关于在 PHP5 中实现 trackbacks 或 pingbac
  • Google Chrome 106 可拖动导致元素消失

    使用拖放元素时 绝对定位元素中包含的大多数其他元素都会从屏幕上消失 如果我调整窗口大小 这些元素会出现 但在开始拖动时会再次消失 我在最新版本的 Google Chrome 106 和 Beta 版本 107 0 5304 18 以及现在的
  • 如何在背景剪辑中包含文本装饰:文本;影响?

    我在用 webkit background clip text border and color transparent在锚标记上 下划线似乎永远不可见 我想要的是将文本装饰包含在背景剪辑中 这是我的CSS background clip
  • 如何使用 php 在 sql 查询中转义引号?

    我有一个疑问 sql SELECT CustomerID FROM tblCustomer WHERE EmailAddress addslashes POST username AND Password addslashes POST p
  • ZF3/2 - 如何捕获 EVENT_DISPATCH 侦听器中引发的异常?

    有什么方法可以在 EVENT DISPATCH 监听器中抛出异常吗 class Module public function onBootstrap EventInterface event application event gt get
  • 如何使用 php 将 *.xlsb 转换为数组或 *.csv

    我正在尝试转换 xlsb文件到php array or csv文件 或至少 xls 我尝试使用PHPExcel 但看起来它无法识别该文件中的内容 我注意到 你可以重命名 xlsb文件到 zip文件 然后使用命令行解压缩unzip zip 之
  • 迭代 pandas 数据框的最快方法?

    如何运行数据框并仅返回满足特定条件的行 必须在之前的行和列上测试此条件 例如 1 2 3 4 1 1 1999 4 2 4 5 1 2 1999 5 2 3 3 1 3 1999 5 2 3 8 1 4 1999 6 4 2 6 1 5 1
  • 如果产品重量超过1000克,如何以公斤为单位显示

    在 Storefront 主题中 我使用下面的代码将格式化重量从 1000g 更改为 1kg add action woocommerce after shop loop item title show weight 10 function

随机推荐

  • 将 log4j 1.x 和 log4j 2 与依赖于 log4j 1.x 的第三方库混合

    我正在维护一个使用 log4j 1 x 和大型代码库的 Maven 项目 log4j 1 x不仅在现有代码中使用 项目所依赖的一些第三方库也使用它 我现在想开始使用 log4j 2 但我想知道是否值得这么麻烦 我知道可以将两者混合使用 参见
  • 在WPF中,我可以在2个按钮之间共享相同的图像资源吗

    我想在 WPF 中创建一个开 关按钮 并且希望它在用户单击它时使用图像更改其外观 如果它是打开的 则切换为关闭 如果它是关闭的 则切换为打开 我将要使用的图像添加到资源中
  • 无法获取店铺名称

    在以前的版本中我用来获取当前商店名称是这样的 router get api app async ctx gt let shop ctx session shop 但是 在新版本中 我无法使用 ctx session shop 获取当前商店名
  • 将实体框架与历史数据结合使用

    我正在 Net 4 0 中构建一个 Windows 应用程序来创建和组织电子项目 该应用程序的主要目的是记录电子元件的供应商信息 零件号 描述 价格等 并将它们组织 关联 到项目 成品 中 要求之一是跟踪任何给定供应商项目 主要是价格 的更
  • Discord“on_member_join”功能不起作用

    我的 on member join 似乎不起作用 我希望我的机器人说出加入服务器的成员的姓名 但它无法检测是否有人加入或离开 import discord from discord ext import commands client co
  • SQL 从“自定义”post_type 中获取 X 个最后条目,计算用户自定义 post_type 的个数

    如果可能的话 我想进入一个查询 最后 4 个不同的用户 排除 ID 1 与 post type custom 订购date or ID DESC 计算每个用户的 自定义 post type 总数 数数 这是一个数据示例 Table Name
  • srand 函数返回相同的值

    嘿伙计们看看这个程序 The craps game KN king page 218 include
  • sysconf(_SC_CLK_TCK) 与 CLOCKS_PER_SEC

    我想知道上述常量的返回值有什么区别 sysconf SC CLK TCK 回报100 CLOCKS PER SEC回报1 000 000 所以 假设我有这个 start clock Process starts here does some
  • 向 RSpec 的默认失败消息添加更多信息?

    我在验证中测试了很多错误的字符串 如下所示 0 3 a xx 11 1 3 00 h h2 h2h m m10 m10m 2hm h2m hm2 2m10h 2m10m 2h10h each do input FactoryGirl bui
  • 测试 celery 任务是否仍在处理中

    如何测试任务 task id 是否仍在处理中celery http celeryproject org 我有以下场景 在 Django 视图中启动任务 将 BaseAsyncResult 存储在会话中 关闭 celery 守护进程 硬 以便
  • 在替换之前对正则表达式中捕获的数字进行计算

    使用正则表达式 我可以找到一堆我想要替换的数字 但是 我想将该数字替换为使用原始捕获数字计算得出的另一个数字 在记事本 中使用替换部分中的一种表达式可能吗 Edit 也许是一个奇怪的想法 但是计算可以在搜索部分完成 生成第二个捕获的数字 该
  • 防止子视图在 UIScrollView 中滚动

    我有一个UIScrollView我想阻止具有某个子视图的子类滚动 而所有其他子视图正常滚动 我能想到的最接近的例子是UITableView右侧的 索引条 在 通讯录 应用程序中查看示例 我猜这是表的子视图 滚动视图 但它不会随着用户滚动而移
  • 如何使用sql server获取一周中的上一个工作日与当前工作日

    我有一个在工作日 周一至周五 运行的 ssis 套餐 如果我在星期二收到文件 后台 DB 它需要前一个工作日的日期并进行一些交易 如果我在周五运行该作业 它必须获取周一的日期并处理交易 我使用以下查询来获取之前的营业日期 Select Co
  • 错误:任务“:app:packageDebug”执行失败。 > !zip.isFile()

    UPDATE 非常感谢 现在至少没有错误了 但它与以前的工作方式 它应该如何工作 仍然相去甚远 现在 数据库看起来 很奇怪 我认为这个 gradle 还是有问题 It should not look like According to th
  • 浏览器不会读取更新的 CSS

    编辑 我真诚的道歉 除了我自己之外 这不是任何问题 我有一个 global css 文件 其中包含正确的内容 但在该文件下面 我包含了另一个包含旧 CSS 的文件 在我的 HTML 的一些内容 捂脸 我有一个正在开发的网站 我正在使用 LE
  • 使用 Python 解析 ping 输出

    您将如何解析 ping 输出 如下所示 root m2m probe1 M2M src ping c 20 q google es PING google es 173 194 34 247 56 84 bytes of data goog
  • 在 Ajax 启动时禁用 div click 并在 Ajax 完成时重新启用它

    我需要在 Ajax 请求开始时禁用一个 div 以便它不再接收点击 并在 Ajax 完成时重新启用它 我还希望在此过程中显示加载 gif 我认为这可以通过使用来完成ajaxStart and ajaxStop 但是 如果我是正确的 这些将触
  • 当我们有 new/delete 时,为什么还要使用 malloc/free?

    有什么用malloc and free当我们有new and delete在C 中 我猜两者的功能free and delete是一样的 他们不一样 new调用构造函数 malloc只是分配内存 还有 它是未定义的行为将两者混合 即使用ne
  • 使用 SCM 从 Xcode 中的 SVN 中排除文件/目录

    我想从我的 SVN 中排除一个目录 我正在使用 Xcode 的内置 SCM 它尚未签入 但我只是厌倦了从签入中取消选择它 我的大部分 SVN 经验都是在 Windows 上使用 TortoiseSVN 进行的 它具有 忽略 功能 我认为 S
  • PHP:如何使用 MySQLi 显示每个 HTML 表行的多个 MySQL 表记录

    我想在 php 中从 mysql 数据库连续显示一组元素 我已经这样做了 但我的数据出现在一长列中 我希望每个新元素都一个挨一个地出现 这是我得到的屏幕截图 我希望第一个位于第二个旁边 https www dropbox com s 2y3