no element found - SQL statement looks good though
anyone see what is wrong with this line of code? using php/mysql
$sqlInsert="INSERT INTO sched_trades_proposed (id,originalDate,originalUserid,originalRot,original_sched_main_id,proposedDate,proposedUserid,propo sedRot,proposed_sched_main_id,timeStampedProposal,randomHash) VALUES('','".$originalDate."',".$_SESSION[userid].",$originalRotation,$original_sched_main_id,'".$proposedDate."',$proposedRad,$proposedRotation,$pro posed_sched_main_id,UNIX_TIMESTAMP(),'".$randomHash."')";
firebug says "no element found" and points to this INSERT statement. I dont see anything wrong with the insert statement. I realize firebug isn't server side. I am still trying to solve the error though. If I comment out this line of code I get no error.
You don't do anything to detect errors from the mysql_query call.
You have a space in one of your property names. You must enclose it in backticks if you intend to use spaces or reserved words (I wouldn't recommend you use either).
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
First of all, you can't use FireBug to debug PHP code.
It will only find errors in the HTML/JavaScript code *PRODUCED* by PHP.
So all FireBug is saying is that your PHP code produced something incorrectly. Nearly useless information.
Secondly,
Quote:
the original id is auto incremented, so I insert a '' as the first column which is kosher.
Well, no, it's really not. It's kind of like a Reformed Jew eating bacon. It's allowed even if frowned upon. The Orthodox answer is that you *MUST* use the keyword NULL there. Or, better, just omit the id field and its value from the INSERT completely.
*************
I don't see the space-in-a-field name that FouLu is referring to. I think it's just because your text lines are too long.
But in any case, what FouLu is saying is do this:
Code:
$resultInsert=mysql_query($sqlInsert) or die( mysql_error() );
and then presumably you will see the error message your are getting from the query.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
I missed that it said firebug there too. Yep, useless on server side code, for that you need to use a debugger.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Oh I see what you mean. That's certainly possible then yes.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php