<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
The mysql_query function returns a 'resource' handler, which you can not store in memcache. <div><br class="webkit-block-placeholder"></div><div>Try this:</div><div><br class="webkit-block-placeholder"></div><div>$query = mysql_query("SELECT * FROM ....");</div><div>$result = mysql_fetch_assoc($query);</div><div>$memcache_obj->set($key,$result);</div><div><br><div contenteditable="false"> <span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><br class="Apple-interchange-newline"><div><br class="khtml-block-placeholder"></div><div>Chris Goffinet</div><div><a href="mailto:goffinet@yahoo-inc.com">goffinet@yahoo-inc.com</a></div><div><br class="khtml-block-placeholder"></div><br class="Apple-interchange-newline"></span> </div><br><div><div>On Sep 3, 2007, at 11:05 PM, Ajinkya Nahar wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div lang="EN-US" link="blue" vlink="purple"><div class="Section1"><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 12pt; font-family: Times New Roman; "><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; ">Hi,<o:p></o:p></span></font></div><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 12pt; font-family: Times New Roman; "><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; "><o:p> </o:p></span></font></div><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 12pt; font-family: Times New Roman; "><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; ">I am working on a PHP – Mysql application.<o:p></o:p></span></font></div><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 12pt; font-family: Times New Roman; "><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; ">I wanted to ask that can we cache the result set returned by a particular query into memcached?<o:p></o:p></span></font></div><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 12pt; font-family: Times New Roman; "><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; ">If yes, can we fetch the same result set from memcached and use it without database connection?<o:p></o:p></span></font></div><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 12pt; font-family: Times New Roman; "><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; "><o:p> </o:p></span></font></div><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 12pt; font-family: Times New Roman; "><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; ">E.g.<o:p></o:p></span></font></div><div style="text-indent: 0.5in; margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 12pt; font-family: Times New Roman; "><font size="2" color="#7f9fbf" face="Courier New"><span style="font-size: 11pt; font-family: Courier New; color: rgb(127, 159, 191); ">$query</span></font><font size="2" color="black" face="Courier New"><span style="font-size: 11pt; font-family: Courier New; color: black; "><span class="Apple-converted-space"> </span>= “</span></font><font size="2" color="#2a00ff" face="Courier New"><span style="font-size: 11pt; font-family: Courier New; color: rgb(42, 0, 255); ">SELECT * from ……”;</span></font><font size="2" face="Courier New"><span style="font-size: 11pt; font-family: Courier New; "><o:p></o:p></span></font></div><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 12pt; font-family: Times New Roman; "><font size="2" color="black" face="Courier New"><span style="font-size: 11pt; font-family: Courier New; color: black; "> <span class="Apple-converted-space"> </span></span></font><font size="2" color="#7f9fbf" face="Courier New"><span style="font-size: 11pt; font-family: Courier New; color: rgb(127, 159, 191); ">$result</span></font><font size="2" color="black" face="Courier New"><span style="font-size: 11pt; font-family: Courier New; color: black; "><span class="Apple-converted-space"> </span>=<span class="Apple-converted-space"> </span></span></font><font size="2" color="#7f7f9f" face="Courier New"><span style="font-size: 11pt; font-family: Courier New; color: rgb(127, 127, 159); ">mysql_query</span></font><font size="2" color="black" face="Courier New"><span style="font-size: 11pt; font-family: Courier New; color: black; ">(</span></font><font size="2" color="#7f9fbf" face="Courier New"><span style="font-size: 11pt; font-family: Courier New; color: rgb(127, 159, 191); ">$query</span></font><font size="2" color="black" face="Courier New"><span style="font-size: 11pt; font-family: Courier New; color: black; ">);<o:p></o:p></span></font></div><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 12pt; font-family: Times New Roman; "><font size="2" color="black" face="Courier New"><span style="font-size: 11pt; font-family: Courier New; color: black; "> $memcache_obj->set($key, $result);<o:p></o:p></span></font></div><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 12pt; font-family: Times New Roman; "><font size="2" color="black" face="Courier New"><span style="font-size: 11pt; font-family: Courier New; color: black; "><o:p> </o:p></span></font></div><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 12pt; font-family: Times New Roman; "><font size="2" color="black" face="Courier New"><span style="font-size: 11pt; font-family: Courier New; color: black; ">Will this work??<o:p></o:p></span></font></div><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 12pt; font-family: Times New Roman; "><font size="2" color="black" face="Courier New"><span style="font-size: 11pt; font-family: Courier New; color: black; "><o:p> </o:p></span></font></div><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 12pt; font-family: Times New Roman; "><font size="2" color="black" face="Courier New"><span style="font-size: 11pt; font-family: Courier New; color: black; ">Please let me know your comments.<o:p></o:p></span></font></div><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 12pt; font-family: Times New Roman; "><font size="2" color="black" face="Courier New"><span style="font-size: 11pt; font-family: Courier New; color: black; "><o:p> </o:p></span></font></div><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 12pt; font-family: Times New Roman; "><font size="2" color="black" face="Courier New"><span style="font-size: 11pt; font-family: Courier New; color: black; ">Regards,<o:p></o:p></span></font></div><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 12pt; font-family: Times New Roman; "><font size="2" color="black" face="Courier New"><span style="font-size: 11pt; font-family: Courier New; color: black; ">Ajinkya</span></font><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; "><o:p></o:p></span></font></div></div></div></span></blockquote></div><br></div></body></html>