这是一个好主意吗? [英] Is this a good idea?

查看:85
本文介绍了这是一个好主意吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!


我已经编程ASP 5年了,我现在正在学习PHP。

在ASP中,你可以使用GetRows函数返回2乘2的数组

Recordset。

实际上,当你访问数据库时它是ASP中的推荐方法

断开连接DB早些时候。

此外,它很方便,因为你可以直接访问阵列中的任何数据

而无需循环。


据我所知,PHP中没有这样的功能,我可以制作一个。

我的问题是它是否适合PHP。


伪代码:


$ data = get_data(" select * from table1");

$ var = $ data [3] [2]; //第4行,第3列的值


这样,我可以用一个函数包装数据库连接,数据检索和错误处理

(或者一个班级。

这个想法是否可行?


TIA。

Sam

解决方案

data = get_data(" select * from table1");


var =


数据[3] [2]; //第4行,第3列的值


这样,我可以用一个函数包装数据库连接,数据检索和错误处理

(或者一个班级。

这个想法是否可行?


TIA。

Sam


Hi!

I''ve been programming ASP for 5 years and am now learning PHP.
In ASP, you can use GetRows function which returns 2 by 2 array of
Recordset.
Actually, it''s a recommended way in ASP when you access DB as it
disconnects the DB earlier.
Also, it''s handy as you can directly access any data in the array
without looping.

As far as I know, there''s no such function in PHP and I can make one.
My question is whether it''s good in PHP.

pseudo-code:

$data = get_data("select * from table1");
$var = $data[3][2]; //value at 4th row, 3rd column

This way, I can wrap db connection, data retrieval, and error handling
with one function (or maybe a class).
Is the idea workable?

TIA.
Sam

解决方案

data = get_data("select * from table1");


var =


data[3][2]; //value at 4th row, 3rd column

This way, I can wrap db connection, data retrieval, and error handling
with one function (or maybe a class).
Is the idea workable?

TIA.
Sam


这篇关于这是一个好主意吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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