New User of PHp/Mysql..
| From: | Gordon Stewart | Date: | Sun, 07 Apr 2002 11:51:18 +0000 |
| Subject: | New User of PHp/Mysql.. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-91920@lists.php.net to get a copy of this message | ||
Ive been using Mysql/PHP for a short while - I sent this messaghe to a big
PHP group (not enough users though) about a week ago - No reply...
Can anyone help..
PS - Slingshot.co.nz doesnt have PHP - its just a text file.. - Save to your
own SQL server & test, Or just review the code - No viruses or anything..
Thanks.
G.
begin-php-subscribe@yahoogroups.com
---------
http://homepages.slingshot.co.nz/~gordon52/4.txt
Ive been learning MySql for about 1 week now - & joined a MySql
group - but some questions I ask are more PHP related & not directly
involving MySQL..
anyway, for my big test script, Ive got the above URL
Just 'view source' to view the PHP scripting language...
when running, it searches your databases & brings up a list of active
databases.
When selected, it brings up a list of tables within the database..
(those two functions are ok..)
Now - in the script, - near the top, it says :-
if ($action =='tables'){ <<< (start of problem area..)
Now - when you select the table, it displays all the names of each
column, within the table. (that part works..)
it has :- $tot=$i; - $tot now holds the number of columns in that
table - For my example on my PC, it held the number '17' which is
correct.
it now has 2 'loops'...
a) for ($count = 1; $row = mysql_fetch_row ($query_result_handle);
++$count)
b) for ($counta = 1; $tot; ++$counta)
Loop a, loops through the 4 rows of the database.
Loop B, displays all (17) of the colmns for each row...
Now - Problems
1) When my script runs, it is VERY fast - Doing things normally.
- EXCEPT - when it comes to the 2 loops.. - it goes Very slow - I
realise its got to do 2 sets of loops - but its going at a much
slower rate than if i did the same loops, on another programming
language.
2) It only displays the 1st row of my data.. - For the example
database i tested, I knew it had 4 rows.
problem questions :-
a) Is my looping correct - Or can anyone find a loop-hole / problem
in my programming. (Im not telling you if the pun was intentional or
not.)
PS - Ive now realised something, & changed my line from :-
for ($counta = 1; $tot; ++$counta)
to
for ($counta = 1; $row = mysql_fetch_row ($query_result_handle);
++$counta)
- now my script is really fast - However it doesnt show much of the
1st line of data :-(
PS, the uploaded one (URL above) - doesnt show the change - as yet..
Can anyone advise what im doing wrong ?
G.