I am using shared hosting and first time trying to read data from Firebird file. I have an interface that allow user to select their .fdb file via below:
HTML
<label class="title">Import by FBD File</label>
<input type="file" class="input-file input-importFDB" name="filefdb" id="filefdb" >
<input class='btn btn-primary' type='submit' id='btnImportFDB' name='btnImportFDB' value='Import'>
PHP file
if (isset($_POST['btnImportFDB'])){
$host = $_FILES["filefdb"]["tmp_name"];
$username = 'SYSDBA';
$password = 'masterkey';
$dbh = ibase_connect($host, $username, $password);
$stmt = 'SELECT * FROM customer;';
$sth = ibase_query($dbh, $stmt);
while ($row = ibase_fetch_object($sth)) {
echo $row->CUST_NO.'<br/>';
}
ibase_free_result($sth);
ibase_close($dbh);
}
The error I am getting is:
[21-Sep-2017 19:36:06 Asia/Singapore] PHP Warning: ibase_connect(): Unable to complete network request to host "localhost". Failed to establish a connection. in /home/mywebproject/demo.mywebsite.com.my/validate/myfile.php on line 56
[21-Sep-2017 19:36:06 Asia/Singapore] PHP Warning: ibase_query(): invalid database handle (no active connection) in /home/mywebproject/demo.mywebsite.com.my/validate/myfile.php on line 58
[21-Sep-2017 19:36:06 Asia/Singapore] PHP Warning: ibase_fetch_object() expects parameter 1 to be resource, boolean given in /home/mywebproject/demo.mywebsite.com.my/validate/myfile.php on line 59
[21-Sep-2017 19:36:06 Asia/Singapore] PHP Warning: ibase_free_result() expects parameter 1 to be resource, boolean given in /home/mywebproject/demo.mywebsite.com.my/validate/myfile.php on line 62
[21-Sep-2017 19:36:06 Asia/Singapore] PHP Warning: ibase_close() expects parameter 1 to be resource, boolean given in /home/mywebproject/demo.mywebsite.com.my/validate/myfile.php on line 63
Update on what I want to achieve:
- I want to allow my user to specify the .fdb path located in their local machine, the path will be capture in my website.
- The user will just click on a button to 'transfer' (upload) the data from the .fdb file to my website.
- So here I am getting the errors as shown above. Mind if I ask what are the other methods to achieve the same objective as mine? Should I just request my users to perform so called data dump/data import/data upload in text/XML/excel(csv) format?