[UPHPU] Unexpected variable

Matthew Frederico mfrederico at gmail.com
Mon Nov 1 11:53:07 MST 2004


Check whatever you are sending to the function get_dbf_header .. make
sure it has a value?

-- Matt


On Fri, 29 Oct 2004 12:58:26 -0600, OgdenNights.com
<lists at ogdennights.com> wrote:
> Here... That's easier to read.
> 
> <?
> function get_dbf_header($dbfname)  {
>     $fdbf = fopen($dbfname,'r');
> 
>     $dbfhdrarr = array();
>     $buff32 = array();
>     $i = 1;
>     $goon = true;
> 
>     while ($goon) {
>         if (!feof($fdbf)) {
>             $buff32 = fread($fdbf,32);
>                 if ($i > 1) {
>                     if (substr($buff32,0,1) == chr(13)) {
>                         $goon = false;
>                     } else {
>                         $pos = strpos(substr($buff32,0,10),chr(0));
>                         $pos = ($pos == 0?10:$pos);
> 
>                         $fieldname = substr($buff32,0,$pos);
>                         $fieldtype = substr($buff32,11,1);
>                         $fieldlen = ord(substr($buff32,16,1));
>                         $fielddec = ord(substr($buff32,17,1));
> 
> array_push($dbfhdrarr, array($fieldname,$fieldtype,$fieldlen,$fielddec));
> 
>                     }
>                 }
>                 $i++;
>             } else {
>                 $goon = false;
>             }
>         }
> 
>         fclose($fdbf);
> 
> 
>         return($dbfhdrarr);
>  }
> 
> ?>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> <title>Untitled Document</title>
> </head>
> <body>
> <?
> $arr = get_dbf_header('test.dbf');
> print_r($arr);
> ?>
> </body>
> </html>
> 
> _______________________________________________
> 
> UPHPU mailing list
> UPHPU at uphpu.org
> http://uphpu.org/mailman/listinfo/uphpu
> IRC: #uphpu on irc.freenode.net
> 
> Sponsored by hostinginferno.com!
> 


-- 
-- Matthew Frederico
http://www.ultrize.com



More information about the UPHPU mailing list