<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WebPaws.com &#187; MySQL</title>
	<atom:link href="http://webpaws.com/blog/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://webpaws.com/blog</link>
	<description>Internet Marketing and Design</description>
	<lastBuildDate>Tue, 15 Jun 2010 11:43:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Proper Date Time format for MySQL from classic ASP code</title>
		<link>http://webpaws.com/blog/163/proper-date-time-format-for-mysql-from-classic-asp-code/</link>
		<comments>http://webpaws.com/blog/163/proper-date-time-format-for-mysql-from-classic-asp-code/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 01:25:47 +0000</pubDate>
		<dc:creator>webpaws</dc:creator>
				<category><![CDATA[ASP]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[Date]]></category>
		<category><![CDATA[Time]]></category>

		<guid isPermaLink="false">http://webpaws.com/blog/?p=163</guid>
		<description><![CDATA[Proper date time format (ISO) for insertion into a MySQL field from classic ASP code<br /><a target="_blank" href="http://www.gdstarrating.com/"><img src="http://webpaws.com/blog/wp-content/plugins/gd-star-rating/gfx/powered.png" border="0" width="80" height="15" /></a><br /><p><a href="http://webpaws.com/blog/163/proper-date-time-format-for-mysql-from-classic-asp-code/">Proper Date Time format for MySQL from classic ASP code</a> is a post from: <a href="http://webpaws.com/blog">WebPaws.com</a></p>
]]></description>
			<content:encoded><![CDATA[<!--S-ButtonZ 1.1.5 Start--><!--S-ButtonZ 1.1.5 End--><p>To properly put the date and time into a MySQL date field, you need to put it into the format of:<br />
<code><br />
yyyy-mm-dd hh:mm:ss<br />
</code></p>
<p>Here is some code to do this in classic ASP for input into a MySQL table:<br />
<code><br />
Dim testdate, testmonth, testday, ISODate<br />
testdate = Request.Form("frmField5")<br />
testmonth = Right(Month(testdate),2)<br />
testday = Right(Day(testdate),2)<br />
ISODate =  Year(testdate) &#038; "-" &#038; testmonth &#038; "-" &#038; testday &#038; " " &#038; hour(testdate) &#038; ":" &#038; minute(testdate) &#038; ":" &#038; second(testdate)<br />
</code></p>
<p>The ISODate variable is in the correct format to insert in a MySQL UPDATE or INSERT SQL statement.  Below is an example SQL string to UPDATE a date field in a MySQL table:<br />
<code><br />
UPDATE myTable SET thisdate = 'ISODate' WHERE myID = 'thisID'<br />
</code></p>
<br /><a target="_blank" href="http://www.gdstarrating.com/"><img src="http://webpaws.com/blog/wp-content/plugins/gd-star-rating/gfx/powered.png" border="0" width="80" height="15" /></a><br /><p><a href="http://webpaws.com/blog/163/proper-date-time-format-for-mysql-from-classic-asp-code/">Proper Date Time format for MySQL from classic ASP code</a> is a post from: <a href="http://webpaws.com/blog">WebPaws.com</a></p>
<div style="clear:both;">&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://webpaws.com/blog/163/proper-date-time-format-for-mysql-from-classic-asp-code/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MySQL &#8211; Replace Select Text within a Database Field</title>
		<link>http://webpaws.com/blog/134/mysql-replace-text-within-database-field/</link>
		<comments>http://webpaws.com/blog/134/mysql-replace-text-within-database-field/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 09:02:17 +0000</pubDate>
		<dc:creator>webpaws</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://webpaws.com/blog/?p=134</guid>
		<description><![CDATA[Update parts of a text string within a field for all records of the table<br /><a target="_blank" href="http://www.gdstarrating.com/"><img src="http://webpaws.com/blog/wp-content/plugins/gd-star-rating/gfx/powered.png" border="0" width="80" height="15" /></a><br /><p><a href="http://webpaws.com/blog/134/mysql-replace-text-within-database-field/">MySQL &#8211; Replace Select Text within a Database Field</a> is a post from: <a href="http://webpaws.com/blog">WebPaws.com</a></p>
]]></description>
			<content:encoded><![CDATA[<!--S-ButtonZ 1.1.5 Start--><!--S-ButtonZ 1.1.5 End--><p>Maintaining databases can be a chore, but knowing the appropriate SQL to do the job can save hours of time.  Here is a tidbit regarding changing a select string of text within a specific field of a table in a MySQL database.  You can edit 1000s of records with this one query:<br />
<code>UPDATE table SET field = REPLACE(field, 'text to be replaced', 'replacement text');</code></p>
<p>In this example, the table name is &#8220;table&#8221;, the field to find the text in is named &#8220;field&#8221;, the rest should be self explanatory.</p>
<br /><a target="_blank" href="http://www.gdstarrating.com/"><img src="http://webpaws.com/blog/wp-content/plugins/gd-star-rating/gfx/powered.png" border="0" width="80" height="15" /></a><br /><p><a href="http://webpaws.com/blog/134/mysql-replace-text-within-database-field/">MySQL &#8211; Replace Select Text within a Database Field</a> is a post from: <a href="http://webpaws.com/blog">WebPaws.com</a></p>
<div style="clear:both;">&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://webpaws.com/blog/134/mysql-replace-text-within-database-field/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Time, comparing time date entries</title>
		<link>http://webpaws.com/blog/81/mysql-time-comparing-time-date-entries/</link>
		<comments>http://webpaws.com/blog/81/mysql-time-comparing-time-date-entries/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 21:49:25 +0000</pubDate>
		<dc:creator>webpaws</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[auction time]]></category>
		<category><![CDATA[comparing time]]></category>
		<category><![CDATA[Date]]></category>
		<category><![CDATA[ending soon]]></category>
		<category><![CDATA[Time]]></category>
		<category><![CDATA[Timestamp]]></category>

		<guid isPermaLink="false">http://webpaws.com/blog/2009/03/11/mysql-time-comparing-time-date-entries/</guid>
		<description><![CDATA[MySQL time and date functions are [...]<br /><a target="_blank" href="http://www.gdstarrating.com/"><img src="http://webpaws.com/blog/wp-content/plugins/gd-star-rating/gfx/powered.png" border="0" width="80" height="15" /></a><br /><p><a href="http://webpaws.com/blog/81/mysql-time-comparing-time-date-entries/">MySQL Time, comparing time date entries</a> is a post from: <a href="http://webpaws.com/blog">WebPaws.com</a></p>
]]></description>
			<content:encoded><![CDATA[<!--S-ButtonZ 1.1.5 Start--><!--S-ButtonZ 1.1.5 End--><p>MySQL time and date functions are well documented (<a title="MySQL Timestamp, date, time manual" href="http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html" target="_blank">http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html</a>), but the applications for specific needs are not.  I would like to share a tidbit about comparing two database date entries, or one entry to the current time and then comparing the difference.</p>
<p>The application is for an auction website, where I am comparing the current time to either the ending time date or the beginning time date to determine how many hours the current time is from either of those timestamps.</p>
<p>My PHP code sets a MySQL variable to insert into the SQL statement to compare the end or beginning timestamp.</p>
<p><code><br />
//In PHP, depending on the search query, I set the SQL to compare the beginning timestamp or the ending timestamp.</code><br />
<code><br />
if($cat==1){$catsql="TIMESTAMPDIFF(HOUR,StartTime,Now()) &lt; '24'";}<br />
elseif($cat==2){$catsql="TIMESTAMPDIFF(HOUR,Now(),EndTime) &lt; '24'";}<br />
else{$catsql="";}<br />
</code><br />
In the SQL code, I am finding the difference in Hours from the current time Now() to either the EndTime or the StartTime timestamps.  If less then 24 hours, it allows a condition to occur in the SQL statement to select specific records meeting that condition.</p>
<p>Keep in mind that the time date format is important and should be in the following format for the above MySQL statements to work:</p>
<p><code><br />
$currenttime = date("Y-m-d H:i:s");  //PHP timestamp consitant with MySQL<br />
</code></p>
<br /><a target="_blank" href="http://www.gdstarrating.com/"><img src="http://webpaws.com/blog/wp-content/plugins/gd-star-rating/gfx/powered.png" border="0" width="80" height="15" /></a><br /><p><a href="http://webpaws.com/blog/81/mysql-time-comparing-time-date-entries/">MySQL Time, comparing time date entries</a> is a post from: <a href="http://webpaws.com/blog">WebPaws.com</a></p>
<div style="clear:both;">&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://webpaws.com/blog/81/mysql-time-comparing-time-date-entries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
