smilesmita Posted August 10, 2007 Share Posted August 10, 2007 removing one key=>value element from array: hi there: I have an array of this sort: array( [#document]=> <?xml version ="1.0"?> [finemae]=>2344ddd [subscriptionstatus]=>unread [trackingnumber]=>45566 } I wanted to get rid of the first Key=>value element which is #document=> <?....?> because my insert statement then gets stuck at this point because of this unwanted element: insert into table (#document,filename,subscriptionstatus,trackingnumber) value ('"<?...?>','..',...); Link to comment https://forums.phpfreaks.com/topic/64290-solved-removing-one-keyvalue-element-from-array/ Share on other sites More sharing options...
lemmin Posted August 10, 2007 Share Posted August 10, 2007 The array_shift() function will pop the first element off. http://www.php.net/manual/en/function.array-shift.php Link to comment https://forums.phpfreaks.com/topic/64290-solved-removing-one-keyvalue-element-from-array/#findComment-320495 Share on other sites More sharing options...
MadTechie Posted August 10, 2007 Share Posted August 10, 2007 how is the array causing problems with an sql insert ? ??? Link to comment https://forums.phpfreaks.com/topic/64290-solved-removing-one-keyvalue-element-from-array/#findComment-320499 Share on other sites More sharing options...
lemmin Posted August 10, 2007 Share Posted August 10, 2007 The number sign may be the issue. If you just wanted to remove the number sign, you can use ltrim(): ltrim($string, "#"); Link to comment https://forums.phpfreaks.com/topic/64290-solved-removing-one-keyvalue-element-from-array/#findComment-320504 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.