On Sunday 19 January 2003 03:50, jennifer wrote:
> hi, i'm hoping someone can help me out here - im trying to pass a variable
> from a string in the href tag, however my sql breaks when i put a var in
> the statment. when i replace $foo with a number, the page works fine. can
> someone please tell me what im doing wrong?
Do you mean $foo or $foobar? In the URL below it seems as if you really mean
$foobar?
And please give an example of where $foo (or $foobar) passed in the URL
doesn't work.
> here is the error i get:
>
> Warning: Supplied argument is not a valid MySQL result resource in
Search the archives to find out the common causes of this error (it's an
__extremely__ FAQ).
Read up on the uses of mysql_error().
> here is my code:
>
> <?php
> $hostName="localhost";
> $userName="xxxx";
> $password="xxxx";
> $database= "projects";
> $tableName="project_descrip";
>
> $descripQuery = "SELECT descrip from project_descrip where rowid=$foo";
> mysql_connect($hostName, $userName, $password);
> $descripResult = mysql_db_query($database,$descripQuery);
> while($row = mysql_fetch_object($descripResult)){
>
> $foo = $row->descrip;
>
> echo("<font face=verdana size=1>");
> echo("<a href='projects_descrip.php?rowid=$foobar'>" . "$foo</a>" . " | ");
> echo("</font>");
>
> }
>
>
> ?>
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
There is something in the pang of change
More than the heart can bear,
Unhappiness remembering happiness.
-- Euripides
*/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php