Re: Converting Date for mysql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 15 Oct 2004 17:26, Stuart Felenstein wrote:

> See below:
> --- John Holmes <holmes072000@xxxxxxxxxxx> wrote:
> 
>> Are you sure it's the date that's causing the
>> rejection? What does
>> mysql_error() say?
> 
> No, I'm not sure.  At first the date was being
> accepted but "wrong" in the database.  It was setting
> it to 1/1/2000.  Someone suggested I add '' around the
> value. Apparently it didn't like that and started
> saying I had a SQL  error. I've tried a number of
> things, so far without success.
> This is the current error:
> 
> "0: 1064: 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 '', 1, 1, 24,
> 25, 10/28/2004)' at line 5 "
> 
> While this is probably a waste of bandwidth here is my
> statement:
> 
> $query = "INSERT INTO
> CorrectTableName(RecordID,UserID,ProfileName,
> Edu, WorkAuth, WorkExp, CarLev, Secu, Confi, Relo,
> Telecomu,
> City1, State1, City2, State2, TravelPref,
> SalaryAnnual, SalaryHourly, Available)
> VALUES (null, null, '$f1a', $f2a, $f2c, $f2d, $f2e,
> $f2g, '$f5b', '$f3m',
> '$f3n', '$f3e', $f3f, $f3g', $f3h, $f3i, $f3j, $f3k,
> $f3l)";
> 
> Outside of the date I don't see where the error could
> be coming from.  Fields with quotes are string values.
> I have no idea.

You seem to be missing a single quote at the beginning of $f3g

May I suggest that as well as echoing mysql_error() you also echo your
query; that way you can see _exactly_ what is being passed to mysql and you
can resolve problems like this simply and without resorting to the mailing
list.

-- 
David Robley

Terminal glare: A look that kills...

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux