Git Product home page Git Product logo

Comments (4)

mygoodboy avatar mygoodboy commented on June 27, 2024 1

echo $records->getString(ColumnName)

from php-xbase.

nebojsac avatar nebojsac commented on June 27, 2024

What error do you get? Do you know at which point it fails exactly? Sample code would help people help you.

from php-xbase.

ghopretz avatar ghopretz commented on June 27, 2024

it can read column count and column name, but it can not read while($record = $table->nextRecord()){}
i don't get error, but can not read record.
this is my code:

<?php
require 'DBFReader/XBase/Table.php';
require 'DBFReader/XBase/Column.php';
require 'DBFReader/XBase/Record.php';
require 'DBFReader/XBase/Memo.php';
require 'DBFReader/XBase/Exception/InvalidColumnException.php';
require 'DBFReader/XBase/Exception/TableException.php';

use XBase\Table;

$file = addslashes($_GET['file']);
/* buka koneksi database kita */
$user_name = "root";
$password = "";
$database = "db_sbh";
$host_name = "localhost";
	 
$koneksi=mysqli_connect($host_name, $user_name, $password, $database);
//$disable_full_group = mysqli_query($koneksi, "SET sql_mode = ''");

$table = new Table("file/$file.dbf");
//$table = new Table("tes2.dbf");
$columns = $table->getColumns();

$jmlkolom = count($columns);
/*
echo "<table border=1>";
echo "<thead><tr>";
foreach ($columns as $column) {
    echo "<td>".$column->name."</td>";//ambil nama semua kolom
}
echo "</tr></thead><tbody></table>";
*/

$row = 0;
while($record = $table->nextRecord()){
    //$idprop = $record->prop;//ambil isi kolom id prop
    
    $val = "";
    
    for($i=0; $i<$jmlkolom; $i++){
        if($i == $jmlkolom - 1){
            $val .= "'$record[$i]'";
        }else {
            $val .= "'$record[$i]', ";
        }
    }
    
    $sql = "INSERT INTO $file VALUES ($val)";
    mysqli_query($koneksi, $sql);
    echo "sql= ".$sql;
    
    $row++;
}
echo $row;

?>

from php-xbase.

ghopretz avatar ghopretz commented on June 27, 2024

@luads

from php-xbase.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.