Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #7663

Re: Manually create array that matches mysql_fetch_array

From "Peter H. Coffin" <hellsop@ninehells.com>
Newsgroups comp.lang.php
Subject Re: Manually create array that matches mysql_fetch_array
Date 2012-11-29 08:24 -0600
Organization A noiseless patient Spider
Message-ID <slrnkbes0a.4ja.hellsop@nibelheim.ninehells.com> (permalink)
References <0fc98fc4-0d67-4e62-a598-200eefcec965@googlegroups.com>

Show all headers | View raw


On Thu, 29 Nov 2012 00:51:04 -0800 (PST), Jason C wrote:

> In my script, I'm potentially creating information to insert in
> to MySQL (based on a few variables), then later in the script I'm
> SELECTing the same data back out of MySQL. Like this:

Stop a moment, back up, and start by describing what you want to
ACCOMPLISH, not what you want to do. Because it sounds like you have
Some Data (A + B), some of which (may) exist in a database (B + U), and
you want to have access to the most current of all of it (A + B + U)
efficiently. If that's the case, then it's not really redundant at all;
REPLACE INTO... (or, depending on your design, INSERT ... ON DUPLICATE
... ) is the proper path, because something else could change part of
the data you thought "correct" between the time that you do the insert
and the time you get to pulling your result set (which should be right
before you want to use it).

-- 
23. I will keep a special cache of low-tech weapons and train my troops
   in their use. That way--even if the heroes manage to neutralize my 
   standard-issue energy weapons useless--my troops will not be overrun
   by a handful of savages armed with spears.

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Manually create array that matches mysql_fetch_array Jason C <jwcarlton@gmail.com> - 2012-11-29 00:51 -0800
  Re: Manually create array that matches mysql_fetch_array Captain Paralytic <paul_lautman@yahoo.com> - 2012-11-29 02:07 -0800
  Re: Manually create array that matches mysql_fetch_array Norman Peelman <npeelmandog@cfl.rr.com> - 2012-11-29 08:35 -0500
  Re: Manually create array that matches mysql_fetch_array "Peter H. Coffin" <hellsop@ninehells.com> - 2012-11-29 08:24 -0600
  Re: Manually create array that matches mysql_fetch_array Denis McMahon <denismfmcmahon@gmail.com> - 2012-11-29 20:26 +0000
    Re: Manually create array that matches mysql_fetch_array Denis McMahon <denismfmcmahon@gmail.com> - 2012-11-30 00:23 +0000

csiph-web