PHP Classes

Possible Insert Bug with version 2.4

Recommend this page to a friend!

      Ultimate MySQL  >  All threads  >  Possible Insert Bug with version 2.4  >  (Un) Subscribe thread alerts  
Subject:Possible Insert Bug with version 2.4
Summary:Insert Statement breaks when using "BuildSQLInsert"
Messages:5
Author:artbuilders
Date:2007-11-01 04:00:46
Update:2007-11-30 17:57:56
 

  1. Possible Insert Bug with version 2.4   Reply   Report abuse  
Picture of artbuilders artbuilders - 2007-11-01 04:00:47
When testing your example:

$values["Name"] = MySQL::SQLValue("Violet");
$values["Age"] = MySQL::SQLValue(777, MySQL::SQLVALUE_NUMBER);
echo MySQL::BuildSQLInsert("MyTable", $values);

It spawns the results:

"INSERT INTO `MyTable` (`Name`, `Age`) VALUES ('Violet' AS "Name", 777 AS "Age")" instead of "...VALUES ('Violet',777)" The former fails to insert into MySQL db

Check out the MySQL Class, specifically in the "BuildSQLInsert" function.
Shouldn't the line "$values = self::BuildSQLColumns($valuesArray, false)" instead read "$values = self::BuildSQLColumns($valuesArray, false, false);"? - added second "false"

  2. Re: Possible Insert Bug with version 2.4   Reply   Report abuse  
Picture of Jeff Williams Jeff Williams - 2007-11-27 09:15:00 - In reply to message 1 from artbuilders
THANK YOU for finding this! I will try to update the class with your change in the next day or so.

  3. Re: Possible Insert Bug with version 2.4   Reply   Report abuse  
Picture of Jeff Williams Jeff Williams - 2007-11-28 05:27:06 - In reply to message 1 from artbuilders
You were absolutely correct and I have now updated the file.

I also updated the help file with more examples (in color).

Thank you so much for your support. If you'll post or e-mail your name, I'll add you to the credits.

  4. Re: Possible Insert Bug with version 2.4   Reply   Report abuse  
Picture of artbuilders artbuilders - 2007-11-28 18:14:14 - In reply to message 3 from Jeff Williams
Douglas Gintz

  5. Re: Possible Insert Bug with version 2.4   Reply   Report abuse  
Picture of Jeff Williams Jeff Williams - 2007-11-30 17:57:56 - In reply to message 4 from artbuilders
I added your name to the top. Again, thanks!