473,406 Members | 2,847 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

"Late" variable substitution

Hi...

I want to know if this is possible.

I have a database with an attribute which has in it a SQL statement,
e.g.

select blah from table where key = $x

In a PHP function, I read in the above string into $v.
In that routine, $x is defined.

However, if I print out the string I get the original string, with $x
not being substituted.

What I want to happen is the local value of $x to get substituted into
$v.

Is this possible? If so, how do you do it?

TIA,
Joe

Nov 10 '06 #1
2 1729
>I want to know if this is possible.
>
I have a database with an attribute which has in it a SQL statement,
e.g.

select blah from table where key = $x

In a PHP function, I read in the above string into $v.
In that routine, $x is defined.

However, if I print out the string I get the original string, with $x
not being substituted.
Show code. In particular:

echo 'key = $x';
and echo "key = $x';

are *NOT* the same thing.
>What I want to happen is the local value of $x to get substituted into
$v.
Um, what does this mean?

Do you mean you have something like:
$v = 'Up your $x with a $x';
(note: no substitution is done here)

and later you do:

$x = 'Hose';
echo $v;

and you want it to print
Up your Hose with a Hose
?
>Is this possible? If so, how do you do it?
It might be possible with 'eval', if I have interpreted the
question correctly.

Nov 10 '06 #2
That did the trick!

Thanks much!

Joe
Gordon Burditt wrote:
I want to know if this is possible.

I have a database with an attribute which has in it a SQL statement,
e.g.

select blah from table where key = $x

In a PHP function, I read in the above string into $v.
In that routine, $x is defined.

However, if I print out the string I get the original string, with $x
not being substituted.

Show code. In particular:

echo 'key = $x';
and echo "key = $x';

are *NOT* the same thing.
What I want to happen is the local value of $x to get substituted into
$v.

Um, what does this mean?

Do you mean you have something like:
$v = 'Up your $x with a $x';
(note: no substitution is done here)

and later you do:

$x = 'Hose';
echo $v;

and you want it to print
Up your Hose with a Hose
?
Is this possible? If so, how do you do it?

It might be possible with 'eval', if I have interpreted the
question correctly.
Nov 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
by: Ron Adam | last post by:
There seems to be a fair amount of discussion concerning flow control enhancements lately. with, do and dowhile, case, etc... So here's my flow control suggestion. ;-) It occurred to me (a...
134
by: James A. Donald | last post by:
I am contemplating getting into Python, which is used by engineers I admire - google and Bram Cohen, but was horrified to read "no variable or argument declarations are necessary." Surely that...
4
by: Barry Edmund Wright | last post by:
Hi All, I am using the code below to assign a form name to a form variable (vFrm). Is there a way to assign the Openargs string directly to vFrm, i.e. vFrm = Openargs ? Private Sub...
388
by: maniac | last post by:
Hey guys, I'm new here, just a simple question. I'm learning to Program in C, and I was recommended a book called, "Mastering C Pointers", just asking if any of you have read it, and if it's...
14
by: MuZZy | last post by:
Hi, Lately i've been (and still am) fixing some memory leaks problems in the project i just took over when i got this new job. Among the other issues i've noticed that for localy created objects...
4
by: Bill Coan | last post by:
NOTE: This was posted earlier to vsnet.vstools.office under a different subject line but received no response. I'm having a problem automating Word's Find object from a .NET application, using...
49
by: matty | last post by:
Hi, I recently got very confused (well that's my life) about the "undefined" value. I looked in the FAQ and didn't see anything about it. On...
2
by: Katit | last post by:
Hello, I searched archives and all pointing to use of VB6 objects from C# I want something different. 1. How can I build expandable platform? Let's say DLL's will have common set of methods...
0
by: Armin Zingler | last post by:
<Just_a_fan@home.netschrieb After having longer discussions about a similar issue, I ask you to provide an example of the source and destination value(s) and their data types. Thanks. Example...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.