[mapserver-users] php-dbase replace error

Stepan Kafka stepan.kafka@centrum.cz
Tue, 9 Apr 2002 08:25:46 +0200


This is a multi-part message in MIME format.

------=_NextPart_000_0005_01C1DFA0.25E57280
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

It is known error in the php-dbase modul. You have two possibilities:

1. patch the current dbase.c code according to attached document and
recompile php.
2. use newer version of PHP where this error has been already fixed (PHP >=
4.1.)


Stepan Kafka

> -----Původní zpráva-----
> Od: owner-mapserver-users@lists.gis.umn.edu
> [mailto:owner-mapserver-users@lists.gis.umn.edu]za uživatele Shaik Anwar
> Hussain
> Odesláno: 8. dubna 2002 21:03
> Komu: Mapserver-Users (E-mail)
> Kopie: Ben Lewis
> Předmět: [mapserver-users] php-dbase replace error
>
>
> Hello List,
>
>             I am trying to replace the dbase records using php_mapscript.
> Here is my php code. Its rewriting the records with null values. i want to
> replace with different values. does any one can help me whats wrong in my
> code.
>
>  Where photo is my shapefile name, it has 4 fields. i am using php4.06,
> mapserver3.5, apache,windows 2000.
>
> <?php
>
> 	dl('php_mapscript.dll');
> 	dl("php_dbase.dll");
> 	dl("php_proj.dll");
>
>
>    function delete_photo($shpfname, $pamcode)
>     {
>         $shapef = ms_newShapefileObj($shpfname,-2);
> 		$dbfile = dbase_open($shpfname, 2);
>
> 		$numrec = dbase_numrecords($dbfile);
> 		$nf = dbase_numfields($dbfile);
>
> 	     echo $numrec,"  ",$nf,$pamcode,"<BR>";
>
> 		$pamscode = "1";
>
> 	    for($k=0; $k<$numrec; $k++)
> 		{
> 		   $rec = dbase_get_record($dbfile,$k);
>
> 	       //echo $rec[0],$rec[1],$rec[2],$rec[3],"<BR>";
>
> 		   if (strtoupper(trim($rec[2])) == strtoupper($pamcode) )
> 		   {
> 			   $f1 = $rec[0];
> 			   $f2 = $rec[1];
> 			   $f3 = $rec[3];
> 		       //echo $f1,$f2,"<br>",$rec[0].$rec[1].$rec[2]."<br>";
> 		    dbase_replace_record($dbfile,
> array($f1,$f2,$pamscode,$f3),$k);
> 	       }
>
> 	     }
>
> 	     $shapef->free();
>          dbase_close($dbfile);
>
>        }  // End of the function photo delete
>
>
>
> # Begining of main program
>
>
>
>     $shpfname1 = "E:/Program Files/Apache
> Group/Apache/htdocs/php406/data/photo";
>     $num='170A';
>
>     delete_photo($shpfname1,$num);
>
>     exit;
> ?>
>
>
> Thanks,
> Anwar
> www.atsincorp.com
>
>

------=_NextPart_000_0005_01C1DFA0.25E57280
Content-Type: text/html;
	name="PHP BugsBug Reporting.htm"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="PHP BugsBug Reporting.htm"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=3D(0036)http://bugs.php.net/bug.php?id=3D11928 -->
<HTML><HEAD><TITLE>PHP Bugs:Bug Reporting</TITLE>
<META content=3D"text/html; charset=3Dwindows-1250" =
http-equiv=3DContent-Type><LINK=20
href=3D"PHP BugsBug Reporting_soubory/style.css" rel=3Dstylesheet>
<META content=3D"MSHTML 5.00.2920.0" name=3DGENERATOR></HEAD>
<BODY aLink=3D#0099ff bgColor=3D#ffffff leftMargin=3D0 link=3D#000033 =
text=3D#000000=20
topMargin=3D0 vLink=3D#000033 marginwidth=3D"0" marginheight=3D"0"><A =
name=3DTOP></A>
<TABLE border=3D0 cellPadding=3D0 cellSpacing=3D0 height=3D48 =
width=3D"100%">
  <TBODY>
  <TR class=3Dheadertop>
    <TD align=3Dleft rowSpan=3D2><A href=3D"http://bugs.php.net/"><IMG=20
      alt=3D"PHP Bugs" border=3D0 hspace=3D2=20
      src=3D"PHP BugsBug Reporting_soubory/logo-bug.gif" =
vspace=3D2></A><BR></TD>
    <TD align=3Dright noWrap vAlign=3Dtop><FONT =
color=3D#ffffff><B>Wednesday,=20
      October 03, 2001 </B>&nbsp;<BR></FONT></TD></TR>
  <TR class=3Dheadertop>
    <TD align=3Dright noWrap vAlign=3Dbottom><A class=3DmenuWhite=20
      href=3D"http://www.php.net/">php.net</A>&nbsp;|&nbsp;<A =
class=3DmenuWhite=20
      href=3D"http://www.php.net/support.php">support</A>&nbsp;|&nbsp;<A =

      class=3DmenuWhite=20
      =
href=3D"http://www.php.net/manual/en/">documentation</A>&nbsp;|&nbsp;<A=20
      class=3DmenuWhite href=3D"http://bugs.php.net/report.php">report a =

      bug</A>&nbsp;|&nbsp;<A class=3DmenuWhite=20
      href=3D"http://bugs.php.net/search.php">advanced =
search</A>&nbsp;|&nbsp;<A=20
      class=3DmenuWhite =
href=3D"http://bugs.php.net/bugstats.php">statistics</A>=20
      <IMG alt=3D"" border=3D0 height=3D2=20
      src=3D"PHP BugsBug Reporting_soubory/spacer.gif" =
width=3D2><BR></TD></TR>
  <TR class=3Dheadersep>
    <TD colSpan=3D2><IMG alt=3D"" border=3D0 height=3D1=20
      src=3D"PHP BugsBug Reporting_soubory/spacer.gif" =
width=3D1><BR></TD></TR>
  <TR class=3Dheaderbottom>
    <FORM action=3Dsearch.php method=3Dget><INPUT name=3Dcmd =
type=3Dhidden=20
    value=3Ddisplay>=20
    <TD align=3Dright colSpan=3D2 noWrap vAlign=3Dtop><FONT=20
      color=3D#ffffff><SMALL>search bugs for</SMALL> <INPUT =
class=3Dsmall=20
      name=3Dsearch_for size=3D30> <INPUT align=3Dbottom alt=3Dsearch =
border=3D0 cache=20
      height=3D11 src=3D"PHP BugsBug =
Reporting_soubory/small_submit_white.gif"=20
      type=3Dimage width=3D11>&nbsp;<BR></FONT></TD></FORM></TR>
  <TR class=3Dheadersep>
    <TD colSpan=3D2><IMG alt=3D"" border=3D0 height=3D1=20
      src=3D"PHP BugsBug Reporting_soubory/spacer.gif"=20
width=3D1><BR></TD></TR></TBODY></TABLE>
<TABLE cellPadding=3D0 cellSpacing=3D0>
  <TBODY>
  <TR vAlign=3Dtop>
    <TD>
      <TABLE cellPadding=3D10 cellSpacing=3D0 width=3D600>
        <TBODY>
        <TR>
          <TD vAlign=3Dtop><BR>
            <H1>Bug id #11928</H1>
            <TABLE border=3D0>
              <TBODY>
              <TR>
                <TH align=3Dright>Status:</TH>
                <TD>Closed</TD>
                <TD>
                <TD><SMALL><A=20
                  =
href=3D"http://bugs.php.net/bug.php?id=3D11928&amp;edit=3D2"><TT>User=20
                  Modify</TT></A> &nbsp; <A=20
                  =
href=3D"http://bugs.php.net/bug.php?id=3D11928&amp;edit=3D1"><TT>Dev=20
                  Modify</TT></A></SMALL></TD></TR>
              <TR>
                <TH align=3Dright>From:</TH>
                <TD>robin.marlow@dps-int.com</TD></TR>
              <TR>
                <TH align=3Dright>Reported:</TH>
                <TD>2001-07-06 08:03:27</TD></TR>
              <TR>
                <TH align=3Dright>Type:</TH>
                <TD>dBase related</TD></TR>
              <TR>
                <TH align=3Dright>OS:</TH>
                <TD>Win2k</TD></TR>
              <TR>
                <TH align=3Dright>PHP Version:</TH>
                <TD>4.0.6</TD></TR>
              <TR>
                <TH align=3Dright>Summary:</TH>
                <TD>dbase_replace_record writes (null) in=20
            .dbf</TD></TR></TBODY></TABLE>
            <HR color=3D#000000 noShade SIZE=3D1>
            <B><I>[2001-07-06 08:03:27] =
robin.marlow@dps-int.com</I></B><BR>
            <BLOCKQUOTE>
              <BLOCKQUOTE><PRE>dbase_replace_record writes (null) string =
as field value. Identical bug with
dbase_add_record was fixed in 4.02. See bug #6519 and #10984 (latter =
still open!!).
I need a version where this function worked, or a promise of a fix soon =
or I'm screwed :o)</PRE></BLOCKQUOTE></BLOCKQUOTE><B><I>[2001-08-16=20
            08:52:13] robin.marlow@dps-int.com</I></B><BR>
            <BLOCKQUOTE>
              <BLOCKQUOTE><PRE>Any news on this?
Here is the fix, when can this be implemented?...

312c312
&lt; 	pval *dbh_id, *fields, **field, *recnum;
---
&gt; 	pval *dbh_id, *fields, *field, *recnum;
359,360c359,360
&lt; 		convert_to_string(*field);
&lt; 		sprintf(t_cp, cur_f-&gt;db_format, (*field)-&gt;value.str.val);=20
---
&gt; 		convert_to_string(field);
&gt; 		sprintf(t_cp, cur_f-&gt;db_format, field-&gt;value.str.val);=20
362a363
&gt; </PRE></BLOCKQUOTE></BLOCKQUOTE><B><I>[2001-08-16 19:39:26]=20
            joey@php.net</I></B><BR>
            <BLOCKQUOTE>
              <BLOCKQUOTE><PRE>Fixed in =
CVS.</PRE></BLOCKQUOTE></BLOCKQUOTE><BR></TD></TR></TBODY></TABLE></TD></=
TR></TBODY></TABLE>
<TABLE border=3D0 cellPadding=3D0 cellSpacing=3D0 width=3D"100%">
  <TBODY>
  <TR class=3Dheadersep>
    <TD><IMG alt=3D"" border=3D0 height=3D1=20
      src=3D"PHP BugsBug Reporting_soubory/spacer.gif" =
width=3D1><BR></TD></TR>
  <TR class=3Dheaderbottom>
    <TD align=3Dright vAlign=3Dbottom><A class=3DmenuWhite=20
      href=3D"http://bugs.php.net/source.php?url=3D/bug.php">show=20
      source</A>&nbsp;|&nbsp;<A class=3DmenuWhite=20
      =
href=3D"http://bugs.php.net/credits.php">credits</A>&nbsp;<BR></TD></TR>
  <TR class=3Dheadersep>
    <TD><IMG alt=3D"" border=3D0 height=3D1=20
      src=3D"PHP BugsBug Reporting_soubory/spacer.gif"=20
width=3D1><BR></TD></TR></TBODY></TABLE>
<TABLE border=3D0 cellPadding=3D6 cellSpacing=3D0 width=3D"100%">
  <TBODY>
  <TR bgColor=3D#cccccc vAlign=3Dtop>
    <TD><SMALL><A href=3D"http://www.php.net/"><IMG align=3Dleft =
alt=3DPHP border=3D0=20
      src=3D"PHP BugsBug Reporting_soubory/php-logo.gif"></A> <A=20
      href=3D"http://www.php.net/copyright.php">Copyright =A9 2001 The =
PHP=20
      Group</A><BR>All rights reserved.<BR></SMALL></TD>
    <TD align=3Dright><SMALL>Last updated: Sun Sep 23 19:27:04 2001=20
      EDT<BR></SMALL><BR></TD></TR></TBODY></TABLE></BODY></HTML>

------=_NextPart_000_0005_01C1DFA0.25E57280--