Jump to content

Recommended Posts

I am unsure as to the best way to do this. 
 

I am building a query using the following loop:

 

for($i=0;$i<count($data); $i++) {
	$query .= "'{$fileop[$i]}', ";
}

 

My problem is, at this point in the loop, I do NOT want $fileop to output its contents (it is not even defined yet).

Rather i need $fileop to display exactly as is, so that the variable name is stored in the string rather than its value at this point in time. I do however want the value of $i to output within the brackets. 

 

I suppose what im asking is, is there a way to nullify store $fileop within a string so that I can call it later (within another loop) and have it actually reference the value when the query is called?

 

(or maybe im just ass backwards here and should take a different approach to this whole section)

Link to comment
https://forums.phpfreaks.com/topic/275250-help-building-a-query-string-mysql/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.