Re: Retrieving Image Location in PHP from MySQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Worked perfectly. Thank you very much.

-Sashi

Dollah Ihsan wrote:
Hi,

you are using single quotes like this?
echo ' <img src="imgtest.php?id=$building" />';

single quotes will ignore that "$building" variable.

Just concatenate it:
echo '<img src="imgtest.php?id=' . $building . '"';

or use double quotes:
echo "<img src=\"imgtest.php?id=$building\">";


It should work I think, sorry if it does not.

On Tue, Mar 10, 2009 at 8:14 AM, Sashikanth Gurram <sashi34u@xxxxxx> wrote:

Hello everyone,

Is there any way in which I can assign a variable to a query string?
Like for example, Let us say that there are two php files a.php and b.php. I
am currently using a image tag like <img src="imgtest.php?id=Williams Hall"
/> in a.php and am passing the value to another variable using
$build=$_GET['id']; in b.php. Now for this purpose, I am using the img tag
in the html part of my first file which makes it kind of static. Now if I
want to assign a variable (say $building) to 'id' in my first file, and
retrieve it using the  variable $build in the second file what is the best
way to do it?
Will the command (written  inside the PHP tags) echo ' <img
src="imgtest.php?id=$building />'; be of any help in performing the task. I
have actually tried this out, but it did not work for me (May be my syntax
is wrong although I have tried various combinations). So, is there a better
way or correct way of doing this (If what I have done is wrong). I have
tried to use $_session() command, but it is kind of yielding me a header
error.

Thanks,
Sashi

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sashikanth Gurram
Graduate Research Assistant
Department of Civil and Environmental Engineering
Virginia Tech
Blacksburg, VA 24060, USA


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sashikanth Gurram
Graduate Research Assistant
Department of Civil and Environmental Engineering
Virginia Tech
Blacksburg, VA 24060, USA


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux