R
Rcmn 73
what is the equivalent in ruby of that PHP code ?
<?
$sql = "select * from mytable";
$result = mssql_query($sql);
while($row = mssql_fetch_array($result)){
$array[] = $row[0];
}
?>
so far i have :
require 'dbi'
db = DBI.connect("DBI:ADOrovider=SQLOLEDB;Data
Source=myserver;Initial Catalog=mydb;User Id=myuser;Password=;")
sql = db.prepare("select* from mytable")
sql.execute
while row=sql.fetch do
p row
end
I'm just interested in a good practice to store in an array from an SQL
query.
sql.finish
<?
$sql = "select * from mytable";
$result = mssql_query($sql);
while($row = mssql_fetch_array($result)){
$array[] = $row[0];
}
?>
so far i have :
require 'dbi'
db = DBI.connect("DBI:ADOrovider=SQLOLEDB;Data
Source=myserver;Initial Catalog=mydb;User Id=myuser;Password=;")
sql = db.prepare("select* from mytable")
sql.execute
while row=sql.fetch do
p row
end
I'm just interested in a good practice to store in an array from an SQL
query.
sql.finish