- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
<分区>
我刚刚从论坛下载了一些代码,但是这些代码在 mysql 中运行不正常。它报告以下错误:
Database error: cannot use database mydatabase MySQL Error: 0 ()Session halted.
我已经尝试在错误日志中在google中查找并修复
下面是代码:
<?php
class Database
{
var $Host = "127.0.0.1"; // Hostname of our MySQL server.
var $Database = "mydatabase"; // Logical database name on that server.
var $User = "root"; // User and Password for login.
var $Password = "mypassword";
var $Link_ID = 0; // Result of mysqli_connect().
var $Query_ID = 0; // Result of most recent mysqli_query().
var $Record = array(); // current mysqli_fetch_array()-result.
var $Row; // current row number.
var $LoginError = "";
var $Errno = 0; // error state of query...
var $Error = "";
//-------------------------------------------
// Connects to the database
//-------------------------------------------
function connect()
{
if( 0 == $this->Link_ID )
$this->Link_ID=mysqli_connect( $this->Host, $this->User, $this->Password );
if( !$this->Link_ID )
$this->halt( "Link-ID == false, connect failed" );
if( !mysqli_query( sprintf( "use %s", $this->Database ), $this->Link_ID ) )
$this->halt( "cannot use database ".$this->Database );
}
//-------------------------------------------
// Queries the database
//-------------------------------------------
function query( $Query_String )
{
$this->connect();
$this->Query_ID = mysqli_query( $Query_String,$this->Link_ID );
$this->Row = 0;
$this->Errno = mysqli_errno();
$this->Error = mysqli_error();
if( !$this->Query_ID )
$this->halt( "Invalid SQL: ".$Query_String );
return $this->Query_ID;
}
//-------------------------------------------
// If error, halts the program
//-------------------------------------------
function halt( $msg )
{
printf( "<strong>Database error:</strong> %s", $msg );
printf( "<strong>MySQL Error</strong>: %s (%s)", $this->Errno, $this->Error );
die( "Session halted." );
}
//-------------------------------------------
// Retrieves the next record in a recordset
//-------------------------------------------
function nextRecord()
{
@ $this->Record = mysqli_fetch_array( $this->Query_ID );
$this->Row += 1;
$this->Errno = mysqli_errno();
$this->Error = mysqli_error();
$stat = is_array( $this->Record );
if( !$stat )
{
@ mysqli_free_result( $this->Query_ID );
$this->Query_ID = 0;
}
return $stat;
}
//-------------------------------------------
// Retrieves a single record
//-------------------------------------------
function singleRecord()
{
$this->Record = mysqli_fetch_array( $this->Query_ID );
$stat = is_array( $this->Record );
return $stat;
}
//-------------------------------------------
// Returns the number of rows in a recordset
//-------------------------------------------
function numRows()
{
return mysqli_num_rows( $this->Query_ID );
}
//-------------------------------------------
// Returns the Last Insert Id
//-------------------------------------------
function lastId()
{
return mysqli_insert_id();
}
//-------------------------------------------
// Returns Escaped string
//-------------------------------------------
function mysqli_escape_mimic($inp)
{
if(is_array($inp))
return array_map(__METHOD__, $inp);
if(!empty($inp) && is_string($inp))
{
return str_replace(array('\\', "\0", "\n", "\r", "'", '"', "\x1a"), array('\\\\', '\\0', '\\n', '\\r', "\\'", '\\"', '\\Z'), $inp);
}
return $inp;
}
//-------------------------------------------
// Returns the number of rows in a recordset
//-------------------------------------------
function affectedRows()
{
return mysqli_affected_rows();
}
//-------------------------------------------
// Returns the number of fields in a recordset
//-------------------------------------------
function numFields()
{
return mysqli_num_fields($this->Query_ID);
}
}
?>
我已经尝试过 Stack Overflow 上建议的其他方法。
我在基于某些逻辑的 Controller 中有一个“halt/1”,但不是在插头中。可悲的是,它确实重定向,但也在重定向后运行代码。 if true do conn |> put_flas
在上一篇文章 STM8单片机低功耗—等待(Wait)模式实现 中介绍了低功耗模式中的等待(Wait)模式代码实现方法,这篇文章就来演示一下 停机(Halt)模式的代码实现。 停机(Halt)模式的进入
我正在使用 getYahooData()函数在 TTR 包装相当激烈。 我有这段代码: for(i in 1:nrow(symbol)){ tryCatch(prices getYahooD
问题是,作为我的第一个可执行语句,我想检查是否可以从数据库中读取。如果我不能,我调用 MessageDlg这么解释,那我Halt; . 但是,关闭对话框后,我仍然在 tak 管理器中看到应用程序(如果
我正在查阅Sipser计算理论导论中的“暂停问题”的证明,而我主要关心的是以下证明: 如果TM M不知道何时循环(它不能接受或拒绝,这就是TM对于所有字符串都可识别图灵的原因),那么决策者H将如何确定
我有一个 mixin 模板,它只对某些参数有效。如果参数无效,我想用错误消息停止编译。对于模板,我会使用 assert(false, "Invalid args for Yoo") 但这不适用于 mi
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?将问题更新为 on-topic对于堆栈溢出。 6年前关闭。 Improve this qu
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 关于您编写的代码问题的问题必须在问题本身中描述具体问题 — 并且包括有效代码 以重现它。参见 SSC
我应该绘制与“Movies”数据集有关的数据,并且我必须利用Rmarkdown并将我的工作转换为PDF。当我尝试渲染我的作品时,收到以下错误消息:。它所指的行如下:。我不确定出了什么问题。值得一提的是
所以我有一个遵循此布局的应用程序模块: defmodule Project.Application do use Application def start(_type, _args) do
我正在使用 Vagrant 1.7.4 和 VBox 5.0.0 在 Win7 上设置 Ubuntu 15.04 VM。 在第一个 vagrant up我可以使用 vagrant putty SSH
我对 MONITOR-MWAIT 与 HLT 指令产生了疑问。 两者都停止处理器,都在各种外部触发器(中断等)上唤醒。 在我的实验中,考虑到以下因素,HLT 和 MWAIT 的功能几乎相同: 如果您是
这是一个使用 RMI 的客户端/服务器应用程序。一旦服务器收到 destroy() 的 RMI 请求 - 我需要中止虚拟机。我正在使用 Runtime.getRuntime().halt(0) 来实现
Alonzo Church 使用 lambda 演算创建了一个用过程表示数字的系统。 例如:0 是 x , 1 是 f x , 2 是 f(f x) , 等等 其中数字是多少次 f被称为 x .我在
Slim 的文档阅读了以下关于框架的halt 方法的内容: Halt The Slim application’s halt() method will immediately return an H
在上一篇文章中使用活跃停机模式实现单片机的定时自动唤醒功能。STM8单片机低功耗—活跃停机(Active Halt)模式实现-2 通过这个实验可以看出,自动唤醒功能和定时器定时功能很类似,那么能不能使
前两篇文章介绍了低功耗模式中的 等待(Wait)模式和停机(Halt)模式的实现。这篇文章开始介绍 活跃停机(Active Halt)模式。 STM8单片机低功耗—等待(Wait)模式实现 STM8单
在上一篇文章中 STM8单片机低功耗—活跃停机(Active Halt)模式实现-1 没有使用活跃停机(Active Halt)模式的定时唤醒功能,使用的是外部中断唤醒,这篇文章来演示一下如何使用活跃
我在部署到本地工作的应用程序的 Shinyapps.io 时遇到了问题。应用程序使用 Shiny 和 Shiny 仪表板 .我能够在 RStudio 中运行该应用程序,但是当我单击发布时,它会停止执行
众所周知,停机问题不能有明确的解决方案,a) 返回 true 程序确实停止了,并且 b) 处理任何输入,但我想知道是否有足够好的解决方案来解决这个问题,那些可以完美地处理某些类型的程序流的程序,或者
我是一名优秀的程序员,十分优秀!