php - 把div放到MYSQL里死掉

标签 php html mysql css

我有这个 mysql 请求:

mysql_query($query) or die(mysql_error());

这很简单,但我想更改此 div 的 mysql_error():

<div class="ui-widget">
    <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
        <p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
        <strong>Error!</strong></p>
    </div>
</div>

最佳答案

最好做一个显示错误的函数:

function show_error($error_text){
    $var = '<div class="ui-widget">
        <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
        <p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
        <strong>'.$error_text.'</strong></p>
        </div>
        </div>';
    die($var);
}

然后像这样使用它:

mysql_query($query) or show_error('Query execute failed');

关于php - 把div放到MYSQL里死掉,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14413577/

相关文章:

javascript - 将以编程方式生成的音频流传输到浏览器

php - 无法用php在mysql古兰经数据库中搜索阿拉伯语

mysql - 如何将 'id' 从 mysql 查询绑定(bind)到 $_SESSION

html - 边界半径不影响内部元素

mysql - 我想在 MySQL 中连接五个表

php - 使用 PHP 的高性能站点中的 Memcache

java - 从网站上的 PHP 脚本运行 Java 类文件

php - 如何在 Drupal 7 中创建表单并在管理面板中保存数据并在 Excel 中导出数据?

php - Symfony2 自定义表单类型 key 对

html - 将导航栏与文本主体对齐