/ Forside / Teknologi / Udvikling / PHP / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
PHP
#NavnPoint
rfh 3959
natmaden 3372
poul_from 3310
funbreak 2700
stone47 2230
Jin2k 1960
Angband 1743
Bjerner 1249
refi 1185
10  Interkril.. 1146
hente data fra en MS Database
Fra : Martin


Dato : 19-03-01 10:21

kolonne 1, kolonne 2, kolonne 3 osv

Hvordan får man det til at stå

sådan her
VALUE I KOLONNE 1 VALUE I KOLONNE 2 VALUE I KOLONNE 3 ?

Jeps du gættede rigitg... jeg ER newbie
--

\ Bye for now Martin /
/\ http://www.geocities.com/lsvdk/ /\
>=)'> Email: martini@mailme.dk <'(=<
\/ ICQ: 58847459 \/
/ \

 
 
Steinn E. Sigurðarso~ (07-04-2001)
Kommentar
Fra : Steinn E. Sigurðarso~


Dato : 07-04-01 14:33

Hmm.. You should be a little more specific, when you ask for help.

Do you mean that you have a database with fields called column1, column2,
column3 ? and you want to make an SQL statement which returns an array of
"column1 => value1", "column2 => value2", "column2 => value2" ?

If so you must first create the table (done with the simple sql statement
which follows:)
CREATE TABLE test (
column1 TEXT,
column2 TEXT,
column3 TEXT);

then you could insert the values into the table using the INSERT sql
statement:
INSERT INTO test (column1,column2,column3) VALUES
('value1','value2','value3');

And finally you can use the mssql functions in php to extract the data from
your mssql server, and fetch into an array perhaps?
$server = "localhost";
$user = "youruser";
$pass = "yourpassword";
$database = "mydb";
mssql_connect($server,$user,$pass);
mssql_select_db($database);
$result = mssql_query("SELECT * FROM test;");
while($arr = mssql_fetch_array($result))
{
print("column1 = " . $arr["column1"] . "<br>column1 = " .
$arr["column2"] . "<br>column3 = " . $arr["column3"]);
}

Or you could always just print_r it.. ($arr = mssql_fetch_array($result);
print_r($arr);)

well, I hope this was of some help..

"Martin" <martini@mailme.dk> wrote in message
news:eojbbt47ubh5umr1aesriq5eukginobj3b@4ax.com...
> kolonne 1, kolonne 2, kolonne 3 osv
>
> Hvordan får man det til at stå
>
> sådan her
> VALUE I KOLONNE 1 VALUE I KOLONNE 2 VALUE I KOLONNE 3 ?
>
> Jeps du gættede rigitg... jeg ER newbie
> --
>
> \ Bye for now Martin /
> /\ http://www.geocities.com/lsvdk/ /\
> >=)'> Email: martini@mailme.dk <'(=<
> \/ ICQ: 58847459 \/
> / \



Søg
Reklame
Statistik
Spørgsmål : 177557
Tips : 31968
Nyheder : 719565
Indlæg : 6408868
Brugere : 218888

Månedens bedste
Årets bedste
Sidste års bedste