Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please help me understand this code snippet?

Status
Not open for further replies.

BobMCT

IS-IT--Management
Sep 11, 2000
756
US
I've been charged with updating an existing program and I am confused on exactly how a piece of code is being handled by php. Perhaps someone can shed some light for me?

This snippet represents a function and is written as follows:

define("LATEST", 1);
function _get_something($from=LATEST, $limit=10) {
$where = "field_termcode_value >= (%d - %d)";
.
.
.
then this code goes on to generate a sql statement which the above $where variable is used in a WHERE clause.

My question is: What does the field $where look like after execution? In my own trial testing I only get the literal value including the %d characters.

Any responses/pointers greatly appreciated. Thanks


 
I agree. There must be something else later on, that takes the %d placeholders and replaces them with the actual data. The data being integers. %d refers to an integer.

As guess it might look like:

field_termcode_value >= (5 - 4)

finally being

field_termcode_value >= 1

The definition of the LATEST constant doesn't look like it has anything to do with the where clause.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top