Home > Database > phpMyAdmin > How to create a function in a database in phpmyadmin

How to create a function in a database in phpmyadmin

藏色散人
Release: 2021-06-04 11:49:54
forward
2954 people have browsed it

The following tutorial column of phpmyadmin will introduce to you how phpmyadmin creates functions in a database. I hope it will be helpful to friends in need!

How to create a function in a database in phpmyadmin

Create a function in a certain database on phpmyadmin

Changed the PHP project to add a function, and added a function to the local MYSQL function, now we need to transfer it to the server, and then the MYSQL on the server can only be operated through the PHPMYADMIN web page. Enter the statement to create the function in the SQL on the web page.

The result is an error: this function has none of DETERMINISTIC

After checking, this is the reason: https://www.php.cn/mysql-tutorials-477456.html

above Run again: set global log_bin_trust_function_creators=1; That’s it.

My local MYSQL is connected using SQLYOG. If there are comments like /* in the exported function creation statement, put It needs to be removed when executing on PHPMYADMIN, otherwise it may not be executed, and

DEFINER=`root`@`%` also needs to be removed. . .

The following is my function creation statement:

USE `sql88_aosijue_c`;
DELIMITER $$
CREATE FUNCTION `calc_xjs`(user_id int) RETURNS int(11)
BEGIN 
return (SELECT COUNT(1) FROM tp_users WHERE pid=user_id);
END  $$
DELIMITER ;
Copy after login

Note that if PHPMYADMIN placed on the server is executed, the database name after USE must be consistent with the one on the server.

The above is the detailed content of How to create a function in a database in phpmyadmin. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template