小编Joc*_*lyn的帖子

自定义错误处理程序,用于处理对象代码内外的错误

我知道Stackoverflow上有很多与自定义错误处理程序相关的问题.但是,在阅读了其中许多内容以及PHP手册之后,我仍然无法解决我的问题.因此我发布了这个问题.

我的脚本目前以这种方式构建:

require 'file.php';
require 'anotherFile.php';
// several more "require" here. These files contain many functions

function myErrorHandler($errno, $errstr, $errfile, $errline, $errcontext){
    // some code to handle errors here

}

class myObject {
    function __construct() {
        // set the values here
    }

    function computeSomething() {
        ...
        doFunction2();
        ...
    }

    function SomethingBadHappened()
    {
    }
}

function doFunction1() {
    // for some reason, an error happens here
    // it is properly handled by the current error handler
}

function doFunction2() {
    // …
Run Code Online (Sandbox Code Playgroud)

php oop error-handling procedural-programming

1
推荐指数
1
解决办法
1659
查看次数

phpmyadmin存储过程错误

我试图在phpmyadmin网络托管服务器中运行SP,但总是得到以下错误

1064 - 您的SQL语法出错; 检查与MySQL服务器版本对应的手册,以便在第4行的''附近使用正确的语法

我试图运行的SP是:

CREATE PROCEDURE Authenticate_UserByEmailID(strUsername VARCHAR(45), strPassword VARCHAR(45))
BEGIN
    SELECT * FROM users 
    WHERE users.Username = strUsername AND users.Password = strPassword;
END $$
Run Code Online (Sandbox Code Playgroud)

我尝试在SP名称,表名列名称和不同的其他组合引号中添加单引号但没有结果然后我遇到此链接并尝试更改分隔符但没有结果.你能帮忙吗?

解:

对不起伙计我的坏人.我添加了分隔符,为我解决了这个问题.

DELIMITER ;;

CREATE PROCEDURE `Authenticate_UserByEmailID`(strUsername VARCHAR(45), strPassword VARCHAR(45))
BEGIN
    SELECT * FROM DBCompany_samsonusac517644.users 
    WHERE Username = strUsername AND Password = strPassword;
END ;;
Run Code Online (Sandbox Code Playgroud)

mysql

1
推荐指数
1
解决办法
1658
查看次数

如何进行条件SQL插入语句?

我是MySQL的新手.我正在尝试编写一个在表中插入行的查询,但前提是在5分钟前插入了上一行.另外,我希望我的PHP代码能够知道是否插入了数据.这是我的尝试:

IF (SELECT max(EntryDate) from MyTable) < DATE_SUB(CURRENT_DATE() INTERVAL 5 MINUTE) THEN
   INSERT INTO MyTable (...) values (...)
ELSE
   Select false
END IF
Run Code Online (Sandbox Code Playgroud)

不幸的是,但并不奇怪,这会产生语法错误(错误对于问题的位置非常模糊).

我做了些蠢事吗?

php mysql

0
推荐指数
1
解决办法
1327
查看次数

在mysql中创建表时出错(1064)

我正在使用mysql db(版本5.5)并使用mysql查询浏览器(v 1.1.5).但是当我尝试使用查询浏览器创建一个简单的表时出现以下错误:

CREATE TABLE `tstaks`.`employee` (
  `empid` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(45) NOT NULL,
  PRIMARY KEY(`empid`)
)
TYPE = InnoDB;


mysql error no 1064
you have an error in your sql sytax,check the manual that corresponds to your mysqlserver version for right syntax to use
near type ='innoDB
Run Code Online (Sandbox Code Playgroud)

mysql

0
推荐指数
1
解决办法
5022
查看次数

MySQL语法错误"附近'描述)"

我在这个查询中找不到错误:

INSERT INTO realestate ( 
type, offer, seller, area, build_area, price, is_negotiable, fur, floor_num, rooms, baths, year_built, phone, title, describe 
) VALUES ( 
'2', '1', '1', '98', '99887', '3242839', 'true', 'true', '1', '1', '1', '2010', '97854984576', 'lksehjfsed', 'alidjaopdhkljhdfkedfhwekdfhwseldfk' )
Run Code Online (Sandbox Code Playgroud)

这是我得到的错误消息:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'describe ) VALUES ( '2', '1', '1', '98', '99887', '324' at line 2
Run Code Online (Sandbox Code Playgroud)

mysql

0
推荐指数
1
解决办法
712
查看次数

#1064 - 您的SQL语法有错误

我正在尝试根据我的软件中的说明设置表.这就是我输入的内容:

CREATE TABLE `swd_account` (
`pk_account` int(11) NOT NULL auto_increment,
`name` char(16) NOT NULL default '',
`isact` tinyint(4) NOT NULL default '1',
PRIMARY KEY (`pk_account`)
) TYPE=MyISAM;

CREATE TABLE `swd_user` (
`pk_user` int(11) NOT NULL auto_increment,
`fk_account` int(11) NOT NULL default '0',
`email` varchar(40) NOT NULL default '',
`name` varchar(40) default NULL,
`isact` tinyint(4) NOT NULL default '1',
`datereg` date default NULL,
`days` tinyint(4) default '0',
`datelastsend` date default NULL,
`messlastsend` int(11) default NULL,
`countsend` int(11) NOT NULL default '0', …
Run Code Online (Sandbox Code Playgroud)

mysql

0
推荐指数
1
解决办法
5万
查看次数

javascript获取php变量不起作用

<div id="div01">01</div>
<div id="div02">02</div>
<img src="../img/logo.png" onclick="blueSky()"/>
Run Code Online (Sandbox Code Playgroud)

JS

function blueSky() {
$.ajax({
type:'GET',
url: 'test.php',
success: function(respond) { 
  document.getElementById("div02").innerHTML=respond;  // works
}
});
$("#div01").html("<?php echo $target;?>"); }   // should be "abc" - doesn't work
Run Code Online (Sandbox Code Playgroud)

test.php的

...    
$target = "abc";
Run Code Online (Sandbox Code Playgroud)

javascript php jquery

0
推荐指数
1
解决办法
160
查看次数

超过了锁定等待超时;尝试重新启动事务

我发生锁定等待超时超出错误。以下是例外:

org.springframework.dao.CannotAcquireLockException: 
### Error updating database.  Cause: java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
### The error may involve commManager.updateOrderHotelInfo-Inline
### The error occurred while setting parameters
### Cause: java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
; SQL []; Lock wait timeout exceeded; try restarting transaction; nested exception is java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
 at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:261)
 at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
 at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:71)
 at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358)
 at $Proxy21.update(Unknown Source)
 at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:246)
Run Code Online (Sandbox Code Playgroud)

春季交易配置 <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource" /> …

java mysql spring jdbc

0
推荐指数
1
解决办法
2万
查看次数

创建表时mysql中的1064语法错误

drop table member cascade constraints;
create table member (
    mid varchar2(10) not null,
    email varchar2(40) not null,
    fname varchar2(20) not null,
    lname varchar2(20) not null,
    street varchar2(50) not null,
    city varchar2(30) not null,
    state varchar2(20) not null,
    zip number(5) not null,
    phone varchar2(12),
    password varchar2(20),
    primary key (mid)
);
Run Code Online (Sandbox Code Playgroud)

mysql syntax-error create-table

0
推荐指数
1
解决办法
1674
查看次数

无法在 MYSQL 中创建函数错误 1064 (42000)

你好,我正在使用 MySQL 创建一个函数:

CREATE FUNCTION INSERTGROUP(name VARCHAR(50))
RETURNS INT
NOT DETERMINISTIC
BEGIN
DECLARE 'idGroup' INT;

IF (NOT EXISTS (SELECT groupID FROM groupsTable WHERE groupName = 'name'))
THEN INSERT INTO groupsTable (groupName) VALUES ('name');

SELECT groupID INTO 'idGroup' FROM groupsTable WHERE groupName='name';

RETURN 'idGroup';
END//
Run Code Online (Sandbox Code Playgroud)

但是当我尝试创建它时出现此错误:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
''idGroup' INT;

IF (NOT EXISTS (SELECT groupID …
Run Code Online (Sandbox Code Playgroud)

mysql function

0
推荐指数
1
解决办法
5651
查看次数