Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3306886
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:20:29+00:00 2026-05-17T21:20:29+00:00

Say I have this code in PHP : $query = mysql_query(SELECT …); the statement

  • 0

Say I have this code in PHP :

$query = mysql_query("SELECT ...");

the statement returns a resource object. Normally it would get passed to mysql_fetch_array() or one of the mysql_fetch_* functions to populate the data set.

I’m wondering if the resouce object – the $query variable in this case can be cached in memcache and then a while later can be fetched and used just like the moment it’s created.

// cache it
$memcache->set('query', $query);

// restore it later
$query = $memcache->get('query');

// reuse it
while(mysql_fetch_array($query)) { ... }

I have googled the question, didn’t got much luck.

I’m asking this is because it looks way much light-weighted than the manner of “populate the result array first then cache”.

So is it possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T21:20:30+00:00Added an answer on May 17, 2026 at 9:20 pm

    I doubt it. From the serialize manual entry

    serialize() handles all types, except the resource-type.

    Edit: Resources are generally tied to the service that created them. I don’t know if memcached uses serialize however I’d guess it would be subject to the same limitations.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say i have this PHP code: $FooBar = a string; i then need a
Let's say I have some code like this: <html> <head><title>Title</title></head> <body> <?php if (!$someCondition){
say I have this $result = mysql_query('SELECT views FROM post ORDER BY views ASC');
Let's say I have this code: if (md5($_POST[$foo['bar']]) == $somemd5) { doSomethingWith(md5($_POST[$foo['bar']]); } I
Say I have jquery code like this: html += '<div class=index>' + item.index +
Let's say I have some code like this if(isset($_GET['foo'])) //do something if(isset($_GET['bar'])) //do something
Let's say you have the following chunk of code: <div id=container> <someelement>This is any
I have this code, $(function () { $.post(fetch_data.php?url=+$('#url').val(), { }, function(response){ var arrValues =
Lets say I have some code: <?php echo Hello Everybody!; echo <br/> ; $var1
Say I have this given XML file: <root> <node>x</node> <node>y</node> <node>a</node> </root> And I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.