<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>http://vwiki.co.uk/index.php?action=history&amp;feed=atom&amp;title=PHP</id>
	<title>PHP - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://vwiki.co.uk/index.php?action=history&amp;feed=atom&amp;title=PHP"/>
	<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=PHP&amp;action=history"/>
	<updated>2026-04-03T19:05:14Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=PHP&amp;diff=1971&amp;oldid=prev</id>
		<title>Sstrutt: Added NOINDEX</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=PHP&amp;diff=1971&amp;oldid=prev"/>
		<updated>2012-05-31T15:44:25Z</updated>

		<summary type="html">&lt;p&gt;Added NOINDEX&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:44, 31 May 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;__NOINDEX__&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== MySQL ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== MySQL ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Handle NULLs in INSERT/UPDATE ===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Handle NULLs in INSERT/UPDATE ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
	<entry>
		<id>http://vwiki.co.uk/index.php?title=PHP&amp;diff=712&amp;oldid=prev</id>
		<title>Sstrutt: Added &quot;Handle NULLs in INSERT/UPDATE&quot;</title>
		<link rel="alternate" type="text/html" href="http://vwiki.co.uk/index.php?title=PHP&amp;diff=712&amp;oldid=prev"/>
		<updated>2010-02-16T09:28:08Z</updated>

		<summary type="html">&lt;p&gt;Added &amp;quot;Handle NULLs in INSERT/UPDATE&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== MySQL ==&lt;br /&gt;
=== Handle NULLs in INSERT/UPDATE ===&lt;br /&gt;
Thieved from http://php.net/manual/en/function.mysql-query.php&lt;br /&gt;
&lt;br /&gt;
This is a small function I wrote for handling NULL values in MySQL. (See examples below)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
function parseNull($data)&lt;br /&gt;
{&lt;br /&gt;
        // Be sure your data is escaped before you use this function&lt;br /&gt;
    if (chop($data) != &amp;quot;&amp;quot;)&lt;br /&gt;
        if (strtolower(chop($data)) == &amp;quot;null&amp;quot;)&lt;br /&gt;
            return &amp;quot;NULL&amp;quot;;&lt;br /&gt;
        else&lt;br /&gt;
            return &amp;quot;&amp;#039;&amp;quot; . $data . &amp;quot;&amp;#039;&amp;quot;;&lt;br /&gt;
    else&lt;br /&gt;
        return &amp;quot;NULL&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you pass it a value, it checks if it is a blank string or the string &amp;#039;null&amp;#039;. If so, it returns NULL. If not, it wraps your data in single quotes. &lt;br /&gt;
This allows you to more easily default a field to null when you insert or update data into your database. To use it, set up a mysql insert or update query for a text field without the single quotes, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// Escape your data before using it with parseNull()&lt;br /&gt;
$my_data = mysql_escape_string($my_data);&lt;br /&gt;
&lt;br /&gt;
mysql_query(&amp;quot;INSERT INTO `my_table` VALUES (1,&amp;quot; . parseNull($my_data). &amp;quot;)&amp;quot;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When $my_data contains the string &amp;quot;null&amp;quot; or a blank string, the value NULL is inserted. When it is not, the value is wrapped in single quotes and this string is inserted.&lt;br /&gt;
&lt;br /&gt;
Warning: Escape the data before passing it to parseNull! parseNull does not escape the data. If you escape after using the parseNull function, the single quotes that parseNull generates will be escaped.&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
When passed the ALREADY ESCAPED string &amp;quot;mydata&amp;quot;, parseNull returns:&lt;br /&gt;
&amp;#039;mydata&amp;#039;&lt;br /&gt;
The resulting mysql query, using the code above, is:&lt;br /&gt;
&lt;br /&gt;
INSERT INTO `my_table` VALUES (1, &amp;#039;mydata&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
When passed the ALREADY ESCAPED string &amp;quot;null&amp;quot;, parseNull returns:&lt;br /&gt;
NULL&lt;br /&gt;
The resulting query is:&lt;br /&gt;
INSERT INTO `my_table` VALUES (1, NULL)&lt;br /&gt;
&lt;br /&gt;
When passed the ALREADY ESCAPED blank string &amp;quot;&amp;quot;, parseNull returns:&lt;br /&gt;
NULL&lt;br /&gt;
The resulting query is:&lt;br /&gt;
INSERT INTO `my_table` VALUES (1, NULL)&lt;/div&gt;</summary>
		<author><name>Sstrutt</name></author>
	</entry>
</feed>