将div放入MYSQL die

2024-04-17

我有这个 mysql 请求:

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

很简单,但我想改变mysql_error()对于这个div:

<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');
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

将div放入MYSQL die 的相关文章

随机推荐