Re: Stuck trying to upload and grab file name

Karl DeSaulniers <[email protected]>
Newsgroups gmane.comp.php.database
Message-ID <[email protected]>
On Jul 25, 2012, at 5:21 AM, Tamara Temple wrote:

> Brad <[email protected]> wrote:
>> Here is where everything stands..   L
>>
>> http://pastie.org/4317155
>
> I feel strange bottom posting, somehow, BUT THAT'S THE RULE
>
> You have never actually shown what your SQL statement is, because:
>
> line 33: echo '$sql';
>
> This will NOT interpolate the sql string. This is why you keep  
> getting:
>
> line 57: array(1) { ["file"]=> array(5) { ["name"]=> string(14)  
> "emailsTest.txt" ["type"]=> string(10) "text/plain" ["tmp_name"]=>  
> string(14) "/tmp/phpcLtE6W" ["error"]=> int(0) ["size"]=>  
> int(61) } } $sqlYou have an error in your SQL syntax; check the  
> manual that corresponds to your MySQL server version for the right  
> syntax to use near ''\' LINES TERMINATED BY "\r\n" IGNORE 1 LINES'  
> at line 3
>
> See where it says "$sqlYou have" after your vardump of $_FILES?
>
> Change:
> Line 33 to:
>    echo $sql.PHP_EOL;
>
> then give it a go.
>
> (The actual source of your problem is elsewhere, but I'll let you go
> from there.)
>
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


$sql = "BLAH BLAH BLAH var='".mysql_real_escape_string($var)."' LINES  
TERMINATED BY '\r\n' IGNORE 1 LINES";

Strings for SQL are wrapped in single quotes and dont escape your  
single quotes, the php $sql string is wrapped in double quotes.

HTH,

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.