Re: Retrieving Image Location in PHP from MySQL
| From: | Sashikanth Gurram | Date: | Tue, 10 Mar 2009 15:14:11 +0000 |
| Subject: | Re: Retrieving Image Location in PHP from MySQL | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-289775@lists.php.net to get a copy of this message | ||
haliphax wrote:
On Mon, Mar 9, 2009 at 8:43 PM, Sashikanth Gurram <sashi34u@vt.edu> wrote:-Sashi -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Sashikanth Gurram Graduate Research Assistant Department of Civil and Environmental Engineering Virginia Tech Blacksburg, VA 24060, USAI'm not sure if this has been addressed in any of the other replies, but I felt it was worth mentioning: Be careful and pay attention to whether you are using single quotes ( ' ) or double quotes ( " ) in your echo statements! $var = 'asdf'; echo 'hey, $var'; // "hey, $var" echo "hey, $var"; // "hey, asdf" ...and if you're using single or double quotes elsewhere (i.e., assignment operations)... $var = 'asdf'; $othervar = 'blah$var'; // "blah$var" $anothervar = "blah$var"; // "blahasdf" $yetanothervar = "blah{$var}blah"; // "blahasdfblah" Double quotes, when not using "echo", can still parse variables for you. Thanks, Haliphax. I knew this stuff from janet valede's PHP for dummies.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.