Using cycling through input variables in PHP using foreach
This snippet prints out all the variables in the $_GET variable (the query string) .
foreach ($_GET as $key => $value) { print "$key has a value of $value"; }
11381 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Rob Lang http://www.maison-de-stuff.net/rob/
foreach ($_GET as $key => $value) { print "$key has a value of $value"; }
// Create the DataColumn list for holding the columns of the primary keys. In this case, we are using only one primary key DataColumn[] primaryKeyColumns = new DataColumn[1]; // Set the first primary key to the column 'id' in the datatable primaryKeyColumns[0] = myDataTable.Columns["id"]; // Now apply the primary key to the datatable myDataTable.PrimaryKey = primaryKeyColumns;
// Dont forget this one: using System.Xml; // First, get some documents together XmlDocument DocumentSource = new XmlDocument(); XmlDocument DocumentDestination = new XmlDocument(); // Load the documents with some nodes DocumentSource.LoadXml(""); DocumentDestination.LoadXml(""); // Now to do the conversion XmlNode tempNode = DocumentDestination.ImportNode( DocumentSource.FirstChild ) // Now insert the fragment into the document DocumentDestination.FirsChild.AppendChild(tempNode);
// This is the final document XmlDocument Data = new XmlDocument(); // Create a string writer that will write the Xml to a string StringWriter stringWriter = new StringWriter(); // The Xml Text writer acts as a bridge between the xml stream and the text stream XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter); // Now take the Dataset and extract the Xml from it, it will write to the string writer content.WriteXml(xmlTextWriter, XmlWriteMode.IgnoreSchema); // Write the Xml out to a string string contentAsXmlString = stringWriter.ToString(); // load the string of Xml into the document Data.LoadXml(contentAsXmlString);
XPathDocument xpathDoc = new XPathDocument (new XmlNodeReader(doc));