DanielStead Posted January 16, 2006 Share Posted January 16, 2006 [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]$sql_1 = "INSERT INTO SourceDocument (MapRef,Township,Parish,Dimensions,DateOfMap,Surveyor) VALUES('$_SESSION['MapRef']','$_SESSION['Township']','$_SESSION['Parish']' ,'$_SESSION['SizeCM']','$_POST['DateofMap']','$_POST['Surveyor']')"; sorry its probably something really easy but this query works fine [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] $sql_1 = "INSERT INTO SourceDocument (MapRef,Township,Parish,Dimensions,DateOfMap,Surveyor)"; so there seems to be something worng with my quieries but i cant spot it. Quote Link to comment Share on other sites More sharing options...
fenway Posted January 16, 2006 Share Posted January 16, 2006 Sure.. I think you have quoting issues for your column values; the second query just uses the default column values, so there's no problem. '$_SESSION['MapRef']' That's hard to parse -- where does the field value start & end? I see 4 single quotes -- and MySQL doesn't like them very much anyway. I would have broken out each hash key to keep from having to escape your quotes, which just looks horrible: '".$_SESSION['MapRef']."' Hope that helps. Quote Link to comment Share on other sites More sharing options...
obsidian Posted January 16, 2006 Share Posted January 16, 2006 [!--quoteo(post=336976:date=Jan 16 2006, 12:09 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jan 16 2006, 12:09 PM) 336976[/snapback][/div][div class=\'quotemain\'][!--quotec--] Sure.. I think you have quoting issues for your column values; the second query just uses the default column values, so there's no problem. '".$_SESSION['MapRef']."' Hope that helps. the quoting issues is definitely the problem, and there are several ways to fix it... just choose whichever is easiest for you to view: // this way VALUES('{$_SESSION['MapRef']}','{$_SESSION['Township']}','{$_SESSION['Parish']}' ,'{$_SESSION['SizeCM']}','{$_POST['DateofMap']}','{$_POST['Surveyor']}')"; // or this way VALUES('$_SESSION[MapRef]','$_SESSION[Township]','$_SESSION[Parish]' ,'$_SESSION[SizeCM]','$_POST[DateofMap]','$_POST[Surveyor]')"; // or the way mentioned above Quote Link to comment Share on other sites More sharing options...
fenway Posted January 16, 2006 Share Posted January 16, 2006 Just don't use the bareword hash keys (shudder) -- go with the explicit quoting, or the curlies. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.