You are here: Re: [PHP] Product details not being displayed, based on passed id « PHP « IT news, forums, messages
Re: [PHP] Product details not being displayed, based on passed id

Posted by Mark Sargent on 04/28/05 08:39

Richard Lynch wrote:

>http://php.net/register_globals
>
>On Wed, April 27, 2005 12:20 am, Mark Sargent said:
>
>
>>Petar Nedyalkov wrote:
>>
>>
>>
>>>On Wednesday 27 April 2005 08:54, Mark Sargent wrote:
>>>
>>>
>>>
>>>
>>>>Hi All,
>>>>
>>>>this page,
>>>>
>>>>http://webmonkey.wired.com/webmonkey/99/21/index3a_page3.html?tw=programmin
>>>>g
>>>>
>>>>has code that is supposed to pass an id via the url string to the same
>>>>page, and display info of a particular product, based on the id being
>>>>passed. Everything works fine, until I click the link, and instead of
>>>>the proudct's details being displayed, based on that id, I get the
>>>>original page, with the lnks. I've right clicked the links, and viewed
>>>>properties, where I see that the id=n is set. Why doesn't it pull the
>>>>record based on the id being passed..? Cheers.
>>>>
>>>>
>>>>
>>>>
>>>Are you sure your webserver handles it's rewrite rules correctly? Maybe
>>>you
>>>use apache - check the mod_rewrite settings, rules, etc.
>>>
>>>Have in mind that the rewrite engine is being enabled using the
>>>"RewriteEngine
>>>on" directive.
>>>
>>>
>>>
>>>
>>>
>>>>Mark Sargent.
>>>>
>>>>P.S. I've inserted, echo $id && to display the id value. Nothing
>>>>appears.
>>>>
>>>>
>>>><html>
>>>>
>>>><body>
>>>>
>>>><?php
>>>>
>>>>
>>>>
>>>>$db = mysql_connect("localhost", "root", "grunger");
>>>>
>>>>mysql_select_db("status",$db);
>>>>
>>>>// display individual record
>>>>
>>>>if ($id) {
>>>>echo $id &&
>>>> $result = mysql_query("SELECT * FROM Products WHERE
>>>>product_id=$id",$db);
>>>>
>>>> $myrow = mysql_fetch_array($result);
>>>>
>>>> printf("Product Name: %s\n<br>", $myrow["product_name"]);
>>>>
>>>> printf("Product Model Number: %s\n<br>",
>>>>$myrow["product_model_number"]);
>>>>
>>>> printf("Product Serial Number: %s\n<br>",
>>>>$myrow["product_serial_number"]);
>>>>
>>>> printf("Product Price: %s\n<br>", $myrow["product_price"]);
>>>>
>>>>} else {
>>>>
>>>> // show employee list
>>>>
>>>> $result = mysql_query("SELECT * FROM Products",$db);
>>>>
>>>> if ($myrow = mysql_fetch_array($result)) {
>>>>
>>>> // display list if there are records to display
>>>>
>>>> do {
>>>>
>>>> printf("<a href=\"%s?id=%s\">%s</a><br>\n", $PHP_SELF,
>>>>$myrow["product_id"], $myrow["product_name"]);
>>>>
>>>> } while ($myrow = mysql_fetch_array($result));
>>>>
>>>> } else {
>>>>
>>>> // no records to display
>>>>
>>>> echo "Sorry, no records were found!";
>>>>
>>>> }
>>>>
>>>>}
>>>>
>>>>
>>>>
>>>>?>
>>>>
>>>>
>>>>
>>>></body>
>>>>
>>>>
>>>>
>>>></html>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>Hi All,
>>
>>yes, using Apache2 as my test web server. I'm even more a novice with
>>it. I'm not too sure I understand what you are asking me to check. I
>>looked in apache2/conf/httpd.conf for somethig related to RewriteEngine,
>>but found nothing. Could you explain a little more..? Cheers.
>>
>>Mark Sargent.
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>>
>
>
>
>
Hi All,

ok, so let me understand this. To be able to use GET/POST and some
others, I need this turned on, yes..? Do you all have it set to on..? If
no, how do you get around this..? Cheers.

Mark Sargent.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация