User Name
Password

Go Back   Planetarion Forums > Non Planetarion Discussions > Programming and Discussion
Register FAQ Members List Calendar Arcade Today's Posts

Reply
Thread Tools Display Modes
Unread 16 Dec 2004, 16:14   #1
CaShY
Registered User
 
CaShY's Avatar
 
Join Date: Jul 2002
Location: uk
Posts: 50
CaShY is an unknown quantity at this point
More SQL

Ok proper pain in the arse this


anyone see whats up with
Code:
SQL :
LOAD DATA LOCAL INFILE '/home/prize/public_html/admin/data/data1103210151' INTO TABLE `results` FIELDS TERMINATED BY ',' ESCAPED BY '\' LINES TERMINATED BY '\r\n' (`userid` , `network` , `profit`) 

ERROR :
Could not query DB: 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 '\r\n' (`userid` , `network` , `profit`)' at line 1
I have also tryed

Code:
SQL :
LOAD DATA INFILE '/home/prize/public_html/admin/data/data1103210220' INTO TABLE `results` FIELDS TERMINATED BY ',' ESCAPED BY '\' LINES TERMINATED BY '\r\n' (`userid` , `network` , `profit`) 


ERROR :  
Could not query DB: 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 '\r\n' (`userid` , `network` , `profit`)' at line 1
i have been looking at it for about an hr now and can't figure anything out.

The file does exsist and the sql as the same as it is in the manual.

Thanks for any Help
__________________
CaShY

Last edited by CaShY; 16 Dec 2004 at 16:20.
CaShY is offline   Reply With Quote
Unread 16 Dec 2004, 16:29   #2
pablissimo
Henry Kelly
 
pablissimo's Avatar
 
Join Date: Apr 2000
Posts: 7,374
pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.
Re: More SQL

Escape the backslash in the ESCAPED BY clause?

eg
Code:
LOAD DATA LOCAL INFILE '/home/prize/public_html/admin/data/data1103210151' INTO TABLE `results` 
FIELDS TERMINATED BY ',' ESCAPED BY '\\' 
LINES TERMINATED BY '\r\n' (`userid` , `network` , `profit`)
Edit:
Change in bold
__________________
You're now playing ketchup
pablissimo is offline   Reply With Quote
Unread 16 Dec 2004, 16:29   #3
CaShY
Registered User
 
CaShY's Avatar
 
Join Date: Jul 2002
Location: uk
Posts: 50
CaShY is an unknown quantity at this point
Re: More SQL

also the php code is


Code:
<?php

require 'functions.php';
require 'admin_navbar.html';
require 'options.php';

db_open();
	if (is_uploaded_file($_FILES['csv']['tmp_name']))
	{
    	$file = $_FILES['csv']['tmp_name'];
        $name = "data";
        $name .= time();
        if (move_uploaded_file($_FILES['csv']['tmp_name'],'/home/prize/public_html/admin/data/'.$name.".csv")) {
        $file = "/home/prize/public_html/admin/data/".$name.".csv";
		echo 'File Uploaded!<BR><BR>';

        $sql =  "LOAD DATA INFILE '$file' INTO TABLE `results` FIELDS TERMINATED BY ',' ESCAPED BY '\\' LINES TERMINATED BY '\\r\\n' ".
        	 "(`userid` , `network` , `profit`)";
             echo "$sql<br>";
	    $result = db_query($sql);
	    if ($result)
        {
	        $time = time();
            echo "loaded";
	        $datefix = db_query("UPDATE results SET date = '$time' where date = -1");
	    }  else {
        echo "Failed";
        }
        }
        else
        {
        echo "failed";
        }
	}
	else
	{
	?>
	    <form action="admin_results.php" method="post"  enctype="multipart/form-data"><br>
	    CSV File: <input type=file name="csv"><br>
	    <br>
	    <input type=Submit name=Upload value='Upload'>

	<?php
	}
db_close();
?>
The functions all work fine.
__________________
CaShY
CaShY is offline   Reply With Quote
Unread 16 Dec 2004, 16:36   #4
pablissimo
Henry Kelly
 
pablissimo's Avatar
 
Join Date: Apr 2000
Posts: 7,374
pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.
Re: More SQL

Code:
        $sql =  "LOAD DATA INFILE '$file' INTO TABLE `results` FIELDS TERMINATED BY ',' ESCAPED BY '\\' LINES TERMINATED BY '\\r\\n' ".
        	 "(`userid` , `network` , `profit`)";
to

Code:
        $sql =  "LOAD DATA INFILE '$file' INTO TABLE `results` FIELDS TERMINATED BY ',' ESCAPED BY '\\\\' LINES TERMINATED BY '\\r\\n' ".
        	 "(`userid` , `network` , `profit`)";
__________________
You're now playing ketchup
pablissimo is offline   Reply With Quote
Unread 16 Dec 2004, 16:49   #5
CaShY
Registered User
 
CaShY's Avatar
 
Join Date: Jul 2002
Location: uk
Posts: 50
CaShY is an unknown quantity at this point
Re: More SQL

Code:
Could not query DB: Access denied for user: 'prize@localhost' (Using password: YES)
now

is werid cause i am using the top level password that allows me access to all the databases, not just the one which the tables in.

and in phpmyadmin

it allows me to run that query
__________________
CaShY
CaShY is offline   Reply With Quote
Unread 16 Dec 2004, 16:52   #6
CaShY
Registered User
 
CaShY's Avatar
 
Join Date: Jul 2002
Location: uk
Posts: 50
CaShY is an unknown quantity at this point
Re: More SQL

Code:
LOAD DATA LOCAL INFILE '/home/prize/public_html/admin/data/data1103212200.csv' INTO TABLE `results` FIELDS TERMINATED BY ',' ESCAPED BY '\\' LINES TERMINATED BY '\r\n' (`userid` , `network` , `profit`)
Could not query DB: The used command is not allowed with this MySQL version


guess i'll have to write a php phaser and do it the hard way

lol
__________________
CaShY
CaShY is offline   Reply With Quote
Unread 16 Dec 2004, 17:35   #7
pablissimo
Henry Kelly
 
pablissimo's Avatar
 
Join Date: Apr 2000
Posts: 7,374
pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.
Re: More SQL

http://forums.devshed.com/archive/t-1904

Third reply, might be of some use I guess, though it doesn't quite match what's going wrong in yours.
__________________
You're now playing ketchup
pablissimo is offline   Reply With Quote
Reply



Forum Jump


All times are GMT +1. The time now is 23:29.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018