sorry... new to this.....
the problem i have is using odbc (mysql can do this  but the server i use is
only set for odbc at the moment).....
i have a DB which contains email addresses.... i can connect to the DB...
retrive the  data and print the Email addresses to the browser....

 i want to assign an increasing variable to each Email address for use later
in the script...

eg: $var(first number) = email addrees 1
        $var(second number) = address 2 ... etc...

so i can update the DB and PHP does the rest( that's what it's for ??)
 the script i tried is .....

<?php

// connect to system dsn odbc name login and password or die
$connect = odbc_connect("DB","login","password") or die (" not connected");

// create SQL statement
$sql = "SELECT  Email FROM Table";

// prepare SQL statement
$sql_result = odbc_prepare($connect,$sql)
 or die("Couldn't prepare query.");

// execute SQL statement and get results
odbc_execute($sql_result) or die("Couldn't execute statement.");

// set fields as total email addreses
$Fields = odbc_num_fields($sql_result);

while( odbc_fetch_row( $sql_result ))
{
$item1 = odbc_result( $sql_result, $Fields ); // the 1 could be "fieldname"
$item2 = odbc_result( $sql_result, $Fields );
print " item one is $item1 and item2 is $item2<br>";
}

odbc_free_result($sql_result);
odbc_close($connect);



?>
 this just prints the results and there is where i get stuck... how do i add
an increasing variable to each address
any help or pointers welcome
Jello

""Jello"" <[EMAIL PROTECTED]> wrote in message
95jfbl$63d$[EMAIL PROTECTED]">news:95jfbl$63d$[EMAIL PROTECTED]...
> i use
>
> $Outer=0;
> while( odbc_fetch_row( $sql_result )){
> $Outer++;
> print "<tr>";
> for($i=1; $i <= $Fields; $i++){
> printf("<td>%s</td>", odbc_result( $sql_result, $i ));
> }
> print "</tr>";
> }
>
> which gets and prints the info from my DB.... how can i assign a variable
to
> each of the fields returned
>
> $var1 = row1 data
> $var2 = row2 data  etc....
>
> like the mysql_fetch_array .... please help as this is driving me up the
> wall.
> Thanks
> Jeremy
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to