我怎样才能重用功能 [英] How can i reuse function

查看:69
本文介绍了我怎样才能重用功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好先生,


我在插入数据时有一个问题。


我想通过函数cuz重用函数插入数据。

Hello Sir,

I have an one problme when inserting data.

I want to insert data through function cuz of reuse function.

展开 | 选择 | Wrap | 行号

推荐答案

一个函数不能神奇地猜测你的SQL格式,你必须像你一样传递所有的价值观。除了你的例子,你没有传递MySQL链接(通过调用mysql_connect()创建的数据库资源)


传递类似mysql_query(
A function cannot magically guess your SQL format, you have to pass it all the values, like you have. Except in your example you don''t passin the MySQL link (a database resource created by calling mysql_connect())

pass that in like mysql_query(


sql,


dbLink)你会很高兴。


您应该查看DA(数据访问器)类并使用OOP设计您的应用程序。但那是在你对PHP有一个很好的理解之后。



Dan


PS - 你
dbLink) and you''ll be good to go.

You should look into a DA (Data Accessor) class and design your app with OOP. But that''s after you have a good understanding of PHP.



Dan

PS -- You


这篇关于我怎样才能重用功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆