i've no programming background whatsoever, but i like php+mysql, though i'm very newbie at both.
(i must confess i have a cms but was mostly copy&paste)
i learned how to connect to mysql from php and then wondered how to list the databases i've at mysql.
in the manual i found this:
[tt]<?php
error_reporting(E_ALL);
$db_list = mysql_list_dbs();
$i = 0;
$cnt = mysql_num_rows($db_list);
while ($i < $cnt) {
echo mysql_db_name($db_list, $i) . "\n";
$i++;
}
?>[/tt]
of course this worked, but i want to understand what i'm doing, so:
there i read this:
"mysql_list_dbs() will return a result pointer containing the databases available from the current mysql daemon"
(i guess daemon is my mysql)
As i didnt understand what a pointer is, i googled and found this:
"A pointer is a variable that holds a memory address"
hmm... so now i know that that function returns a kind of a group of variables...
hmm...is this a kind of 'the' RECORDSET used in vb?
well... i made:
[tt]$cnt = mysql_num_rows($db_list);[/tt]
and got how many databases i had.
Next i read this (in the manual):
"The row parameter is an index into the result set"
Now i'm getting more and more confused!
What's the diference between result set and result pointer?
i really feel very confused!
dont get that diference and dont get this last piece of sentence:
"...is an index into the result set"
Can someone help me please?
thanks in advance
(i must confess i have a cms but was mostly copy&paste)
i learned how to connect to mysql from php and then wondered how to list the databases i've at mysql.
in the manual i found this:
[tt]<?php
error_reporting(E_ALL);
$db_list = mysql_list_dbs();
$i = 0;
$cnt = mysql_num_rows($db_list);
while ($i < $cnt) {
echo mysql_db_name($db_list, $i) . "\n";
$i++;
}
?>[/tt]
of course this worked, but i want to understand what i'm doing, so:
there i read this:
"mysql_list_dbs() will return a result pointer containing the databases available from the current mysql daemon"
(i guess daemon is my mysql)
As i didnt understand what a pointer is, i googled and found this:
"A pointer is a variable that holds a memory address"
hmm... so now i know that that function returns a kind of a group of variables...
hmm...is this a kind of 'the' RECORDSET used in vb?
well... i made:
[tt]$cnt = mysql_num_rows($db_list);[/tt]
and got how many databases i had.
Next i read this (in the manual):
"The row parameter is an index into the result set"
Now i'm getting more and more confused!
What's the diference between result set and result pointer?
i really feel very confused!
dont get that diference and dont get this last piece of sentence:
"...is an index into the result set"
Can someone help me please?
thanks in advance