require 'database.php';
$t_02 = subnets;
$sql_subs = mysql_query(SELECT * FROM $t_02,$db)or
die(mysql_error()); while(list($id,$sub,$msk,$dns01,$dns02,$rtrs,$rnge)
= mysql_fetch_array($sql_subs)) {
$num = mysql_num_rows($sql_subs);
for($z = 0; $z $num; $z++) {
$vlans[] = subnet
On Tue, 2004-01-06 at 15:04, Jas wrote:
require 'database.php';
$t_02 = subnets;
$sql_subs = mysql_query(SELECT * FROM $t_02,$db)or
die(mysql_error());while(list($id,$sub,$msk,$dns01,$dns02,$rtrs,$rnge)
= mysql_fetch_array($sql_subs)) {
$num = mysql_num_rows($sql_subs);
++)
echo $vlans[$z]br /\n;
Martin
-Original Message-
From: Jas [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 7 January 2004 9:05 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Looping problem?
require 'database.php';
$t_02 = subnets;
$sql_subs = mysql_query(SELECT * FROM $t_02,$db
On Wed, Jan 07, 2004 at 09:17:35AM +1100, Martin Towell wrote:
This is probably more like what you need.
I can't see why you'd need to loop through your results using two different
methods (while and for)
require 'database.php';
$t_02 = subnets;
$sql_subs = mysql_query(SELECT * FROM
On Tue, Jan 06, 2004 at 05:33:41PM -0500, joel boonstra wrote:
snip
I would recommend not simply doing a select *, but rather specifying
which columns you want. That way, if your database schema changes
(e.g., you add two more columns), your code won't break.
And, responding to myself,
Problem with looping over a CSV file (3 results for each line)? Here is
the CSV file contents...
MTPC-01,00:02:B3:A2:9D:ED,155.97.15.11
MTPC-02,00:02:B3:A2:B6:F4,155.97.15.12
MTPC-03,00:02:B3:A2:A1:A7,155.97.15.13
MTPC-04,00:02:B3:A2:07:F2,155.97.15.14
MTPC-05,00:02:B3:A2:B8:4D,155.97.15.15
Problem with looping over a CSV file (3 results for each line)?
Here is the script...
?php
$row = 1;
$file = fa.csv;
$id = fopen($file,r);
while($data = fgetcsv($id,100,,)) {
$num = count($data);
$row++;
for($c = 0; $c $num; $c++) {
echo host $data[0] {br /\nhardware
Shorter version of the script:
?
$line = file(fa.csv);
for($i=0;$icount($line);$i++){
$data = explode(,, $line[$i]);
echo host $data[0] {br /\nhardware ethernet $data[1];br
/\nfixed-address $data[2];br /\n}br /\n;
}
?
At 08:10 AM 12/30/2003, Jas wrote:
Problem with looping over a
8 matches
Mail list logo