FAQ
Please be gentle, I'm new to PHP and mysql...

The url I'm passing is: http://url.com/?product=TVR3314DC

This retrieves the value from the url when imbedded in the html code:
<?php echo pageParameter("product", "0")?>

Now when I try to make the pageParameter work in the code that selects the
record, it doesn't work. This code works fine:

<?php // GoLive Content Source $product3 =
WrapMySQLDatabaseResults("multi","select * from table1 WHERE
prod_id='TVR3314DC'","block=1","product3");?>

But when I change the value TVR3314DC with echo pageParameter("product",
"0"), it doesn't work!

Here's the line of code:

<?php // GoLive Content Source $product3 =
WrapMySQLDatabaseResults("multi","select * from table1 WHERE prod_id='echo
pageParameter("product", "0")'","block=1","product3");?>

The error message I get is:

Parse error: parse error, unexpected T_STRING in
/home/shalabin/public_html/dynamic.php on line 9


Does anyone know what the problem is? I've tried quite a few
variations...keep in mind I'm a php beginner...

Thanks,
Michael

Search Discussions

  • Jon Wagoner at Apr 15, 2003 at 8:36 pm
    This would better go on the PHP mailing list.

    The problem is you are trying to embed a function within a string, which won't work. Change the line to:

    <?php // GoLive Content Source $product3 =
    WrapMySQLDatabaseResults("multi","select * from table1 WHERE prod_id='echo".
    pageParameter("product", "0") ."'","block=1","product3");?>

    -----Original Message-----
    From: Michael Sorbera
    Sent: Tuesday, April 15, 2003 3:34 PM
    To: mysql
    Subject: Please help...can't pass variable from url...


    Please be gentle, I'm new to PHP and mysql...

    The url I'm passing is: http://url.com/?product=TVR3314DC

    This retrieves the value from the url when imbedded in the html code:
    <?php echo pageParameter("product", "0")?>

    Now when I try to make the pageParameter work in the code that selects the
    record, it doesn't work. This code works fine:

    <?php // GoLive Content Source $product3 =
    WrapMySQLDatabaseResults("multi","select * from table1 WHERE
    prod_id='TVR3314DC'","block=1","product3");?>

    But when I change the value TVR3314DC with echo pageParameter("product",
    "0"), it doesn't work!

    Here's the line of code:

    <?php // GoLive Content Source $product3 =
    WrapMySQLDatabaseResults("multi","select * from table1 WHERE prod_id='echo
    pageParameter("product", "0")'","block=1","product3");?>

    The error message I get is:

    Parse error: parse error, unexpected T_STRING in
    /home/shalabin/public_html/dynamic.php on line 9


    Does anyone know what the problem is? I've tried quite a few
    variations...keep in mind I'm a php beginner...

    Thanks,
    Michael


    --
    MySQL General Mailing List
    For list archives: http://lists.mysql.com/mysql
    To unsubscribe: http://lists.mysql.com/mysql?unsub=jwagoner@wlion.com
  • Román Sánchez at Apr 15, 2003 at 8:44 pm

    <?php // GoLive Content Source $product3 =
    WrapMySQLDatabaseResults("multi","select * from table1 WHERE prod_id='echo
    pageParameter("product", "0")'","block=1","product3");?>
    The double quotes around product are nested within single quotes (started
    right before echo) which are in turned nested inside the double quotes that
    started at select. I believe this is not possible and you have to escape the
    third level quotes.

    Cheers!
  • Jennifer Goodie at Apr 15, 2003 at 8:51 pm
    This is a PHP problem, not a mySQL problem. It has to do with the fact that
    you have nested "s

    "select * from table1 WHERE prod_id='echopageParameter("product", "0")'"

    Try "select * from table1 WHERE prod_id='".echopageParameter("product",
    "0")."'"

    You might want to try to learn to hand code rather than rely on WYSIWYG PHP.
    http://www.php.net
    -----Original Message-----
    From: Michael Sorbera
    Sent: Tuesday, April 15, 2003 1:34 PM
    To: mysql
    Subject: Please help...can't pass variable from url...


    Please be gentle, I'm new to PHP and mysql...

    The url I'm passing is: http://url.com/?product=TVR3314DC

    This retrieves the value from the url when imbedded in the html code:
    <?php echo pageParameter("product", "0")?>

    Now when I try to make the pageParameter work in the code that selects the
    record, it doesn't work. This code works fine:

    <?php // GoLive Content Source $product3 =
    WrapMySQLDatabaseResults("multi","select * from table1 WHERE
    prod_id='TVR3314DC'","block=1","product3");?>

    But when I change the value TVR3314DC with echo pageParameter("product",
    "0"), it doesn't work!

    Here's the line of code:

    <?php // GoLive Content Source $product3 =
    WrapMySQLDatabaseResults("multi","select * from table1 WHERE prod_id='echo
    pageParameter("product", "0")'","block=1","product3");?>

    The error message I get is:

    Parse error: parse error, unexpected T_STRING in
    /home/shalabin/public_html/dynamic.php on line 9


    Does anyone know what the problem is? I've tried quite a few
    variations...keep in mind I'm a php beginner...

    Thanks,
    Michael


    --
    MySQL General Mailing List
    For list archives: http://lists.mysql.com/mysql
    To unsubscribe: http://lists.mysql.com/mysql?unsub=goodie@apolloi.com

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupmysql @
categoriesmysql
postedApr 15, '03 at 8:29p
activeApr 15, '03 at 8:51p
posts4
users4
websitemysql.com
irc#mysql

People

Translate

site design / logo © 2021 Grokbase