Reply to database, *_fetch_array(),while() issue.

Your name:

Reply:


Posted by gmac63 on 05/09/06 23:16

To be brief, I have never encountered this where I make a database
query:

<?php

$db = sqlite_open('tc.db');
$result = sqlite_query($db,"select dir,app,protocol,sport,dport,mark
from iptmarkView");

$row = sqlite_fetch_array($result);

while ($row = sqlite_fetch_array($result)){
print "Direction: $row[dir]\n<br>";
print "Application: $row[app]\n<br>";
print "\n<br>";
};

// No problem so far ... but if I want to print the rest (I have a
reason)...

while ($row = sqlite_fetch_array($result)){
print "Protocol: $row[protocol]\n<br>";
print "Source Port: $row[sport]\n<br>";
print "Destination Port: $row[dport]\n<br>";
print "Mark: $row[mark]\n<br>";
print "\n<br>";
};

?>

.... it doesn't want to print the second while() loop unless I do the
query again:

<?php

$db = sqlite_open('tc.db');
$result = sqlite_query($db,"select dir,app,protocol,sport,dport,mark
from iptmarkView");

$row = sqlite_fetch_array($result);

while ($row = sqlite_fetch_array($result)){
print "Direction: $row[dir]\n<br>";
print "Application: $row[app]\n<br>";
print "\n<br>";
};

$db = sqlite_open('tc.db');
$result = sqlite_query($db,"select dir,app,protocol,sport,dport,mark
from iptmarkView");

$row = sqlite_fetch_array($result);

while ($row = sqlite_fetch_array($result)){
print "Protocol: $row[protocol]\n<br>";
print "Source Port: $row[sport]\n<br>";
print "Destination Port: $row[dport]\n<br>";
print "Mark: $row[mark]\n<br>";
print "\n<br>";
};

?>

Why? It has to be quite simple, just never run into this before.

thx

-Wes Yates

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация