Jump to content

Having A Problem Inserting Data


thomasw_lrd

Recommended Posts

I've just run into a really weird error. I'm hoping someone can help. When I run the code with the $rs = myexecute($sql); line commented out, it prints

INSERT INTO tbl_full_text set ft_path = '../intranet/Documents/CPOA 2011/Account Receivable - (Don\'t Touch)/AR 1001-1100 Series/PMI -1 - AR-1001/RE PMI Technologies - Cardio POs (43).msg';

INSERT INTO tbl_full_text set ft_path = '../intranet/Documents/CPOA 2011/Account Receivable - (Don\'t Touch)/AR 1001-1100 Series/PMI -1 - AR-1001/RE PMI Technologies - Cardio POs (44).msg';

INSERT INTO tbl_full_text set ft_path = '../intranet/Documents/CPOA 2011/Account Receivable - (Don\'t Touch)/AR 1001-1100 Series/PMI -1 - AR-1001/RE PMI Technologies - Cardio POs (45).msg';

INSERT INTO tbl_full_text set ft_path = '../intranet/Documents/CPOA 2011/Account Receivable - (Don\'t Touch)/AR 1001-1100 Series/PMI -1 - AR-1001/RE PMI Technologies - Cardio POs.msg';

INSERT INTO tbl_full_text set ft_path = '../intranet/Documents/CPOA 2011/Account Receivable - (Don\'t Touch)/AR 1001-1100 Series/PMI -1 - AR-1001/RE PMI Technologies Account Receivable 4170.msg';

INSERT INTO tbl_full_text set ft_path = '../intranet/Documents/CPOA 2011/Account Receivable - (Don\'t Touch)/AR 1001-1100 Series/PMI -1 - AR-1001/RE PMI.msg';

 

Which is offsets 0-5.

When I uncomment that line I get this. Can anyone help? myexecute is a custom function for inserting data into our database. It handles all the error processing, and credentials.

 

INSERT INTO tbl_full_text set ft_path = '../intranet/Documents/CPOA 2011/Account Receivable - (Don\'t Touch)/AR 1001-1100 Series/PMI -1 - AR-1001/RE PMI Technologies - Cardio POs (43).msg';

Notice: Undefined offset: 1 in /var/www/portal.certifiedpreownedincome.com/www/app/test.php on line 16 Notice: Undefined offset: 1 in /var/www/portal.certifiedpreownedincome.com/www/app/test.php on line 17

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

 

SELECT id, parent, name from folders where id = ;

 

<?php
include (dirname(__FILE__).'/../includes/menuhead.inc');
include ('apptable_functions.inc');
require('includes/html2text.php');
//PHP Error Reporting
ini_set('display_errors',1);
error_reporting(-1);
$sql = "SELECT filename, parent from files where filename like '%.msg';";
$rs = myload($sql);
$count = count($rs);
echo $count; echo "<br>";
for($i = 0; $i < 6; $i++){
$path = $rs[$i]['filename'];
$parent = "SELECT id, parent, name from folders where id = ".$rs[$i]['parent'].";";
$parent_rs = myload($parent);
$folder = $rs[$i]['parent'];
do {
$parent = "SELECT id, parent, name from folders where id = ".$folder.";";
$parent_rs = myload($parent);
$folder = $parent_rs[0]['parent'];
$path = $parent_rs[0]['name'] ."/". $path;

} while ($folder >= 1);
$path = "../intranet/". $path;

$fplog = fopen($path,'r');
$string = fread($fplog, filesize($path));
$string = preg_replace("/[^A-Za-z0-9 ]/", '', $string);
$string = addslashes($string);
$path = addslashes($path);
$sql = "INSERT INTO tbl_full_text set ft_path = '$path';";//, ft_data = '$string';";
echo $sql; echo "<br>";
//$rs = myexecute($sql);
}

Link to comment
https://forums.phpfreaks.com/topic/269502-having-a-problem-inserting-data/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.