i have a feeling that your database doesnt commit by default. you may have 
to explicitly call commit from ur PHP scripts or set auto_commit in ur sql 
server.  Ofcourse if other update statements of yours are working without 
an explicit commit then i cant find anything wrong with ur code.
Mathew

At 08:55 AM 7/9/2002 -0500, you wrote:

>I have put together this script to read a row of data from SQL Server,
>perform a calculation and write back the results.  the read and
>calculation are working but it doesn't write the data to SQL
>Server...what am I doing wrong here?
>
><?
>
>$host="---.---.---.---";
>$DB="database";
>$user="sa";
>$pass="";
>
>$connect = mssql_connect($host,$user,$pass) or die ($host." not
>accessible.");
>if ($DB) mssql_select_db($DB)or die('USE '.$DB.' failed!');
>
>
>$query = "SELECT * FROM zipcodes where city = 'ADAMSVILLE'";
>$result = mssql_query($query);
>
>$numRows = mssql_num_rows($result);
>
>echo "<table
>border=1><tr><td>City</td><td>State</td><td>Zip</td><td>Longitude</td><td>Latitude</td><td>Longitude
> 
>Radians</td><td>Latitude
>Radians</td></tr>";
>
>for($i=0; $i<$numRows; $i++){
>echo "<tr>";
>$row = mssql_fetch_array($result);
>$latitude = $row['latitude'];
>$longitude = $row['longitude'];
>$longitude = $longitude * -1;
>
>echo
>"<td>$row[city]</td><td>$row[state]</td><td>$row[zipcode]</td><td>$longitude</td><td>$latitude</td>";
> 
>
>
>$pi = 3.1415926;
>$latitude_radians = ($pi/180.0) * $latitude;
>$longitude_radians = ($pi/180.0) * $longitude;
>
>echo "<td>$longitude_radians</td><td>$latitude_radians</td>";
>
>$writeQuery = "INSERT INTO
>zipcodes(longitude,latitude_radians,longitude_radians) 
>VALUES('$longitude','$latitude_radians','$longitude_radians')";
>
>$writeResult = mssql_query($writeQuery);
>
>echo "</tr>";
>}
>
>
>
>?>
>
>--
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to