Re: Passing Variables
| From: | David Robley | Date: | Fri, 30 Jun 2000 07:31:39 +0000 |
| Subject: | Re: Passing Variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-3972@lists.php.net to get a copy of this message | ||
On 30 Jun, Ben Ocean wrote:
> Hi;
> I have a script where I successfully call variables like this:
>
> $result = mysql_query("SELECT id, gender, color, name, birth, price,
> performance_one, performance_more, height, description FROM horse ORDER BY
> price");
>
> I want to be able to send them to a dynamically generated page like this:
>
> echo "<a href=\"your_horse.php3?name=<? $name?>&color=<?
> $color?>&gender=<? $gender?>&price=<? $price?>&birth=<?
> $birth?>&performance_one=<? $performance_one?>&performance_more=<?
> $performance_more?>&height=<? $height?>&description=<?
> $description?>\">";
> echo mysql_result($result,$counter,"name");
> echo "</a><br>";
>
> But for some reason, when I try to call the variables in the dynamically
> generated page like this:
>
> <?php echo $name?>
>
> Nothing is generated. Can you tell me what I'm doing wrong?
> TIA,
> BenO
In addition to what Rasmus has already told you, it seems you are not
extracting the information you want from the result returned by your
query. Or at least you haven't put the code in your message.
You'll need to use sometihing like mysql_fetch_array to grab the data
from the query and assign it to variables that you can then use. The
example in the docs for mysql_fetch_array should point you in the right
direction.
Cheers
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA