Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

problem with php mysql iis

0 views
Skip to first unread message

Vjeran

unread,
Oct 6, 2006, 1:55:24 AM10/6/06
to
Hi
I have one page: index.php - news portal - with headlines, every headline is
a link to whole news , and the code is like this:
...
$news_id=$row["news_id"];
echo "<a href='news.php?news_id=$news_id'>
...

the other page -news.php- that shows that news looks like this:
...
<?php
$result = mysql_query("select * from news WHERE
news_id='$news_id'") or
die (mysql_error());
while ($row = mysql_fetch_array($result))
....

and this works fine on the Internet (PHP/MySQL/Apache)
but locally, I tried the same thing, and it doesn't work - but on
PHP/MySQL/IIS

it seems like it doesn't bring $news_id to sql query... is this a IIS
problem or what?

thanks for any help
Vyeran


iulian.ilea

unread,
Oct 6, 2006, 3:50:37 AM10/6/06
to

What is the error?

Johnny

unread,
Oct 6, 2006, 4:53:52 AM10/6/06
to

"Vjeran" <vper...@MAKNIfoi.hr> wrote in message
news:eg4r1l$4lv$1...@ss408.t-com.hr...
perhaps: relying on register globals to get $news_id in place of
$news_id = $_GET['news_id']


Pedro Graca

unread,
Oct 6, 2006, 5:17:02 AM10/6/06
to
["Followup-To:" header set to comp.lang.php.]

Vjeran wrote:
> <?php
> $result = mysql_query("select * from news WHERE
> news_id='$news_id'") or
> die (mysql_error());
> while ($row = mysql_fetch_array($result))
> ....

It appears you have register_globals on.
http://php.net/register_globals

*Turn it off!*

And change your code to:

<?php
$result = mysql_query("select * from news WHERE news_id='".$_GET['news_id']."'") or die (mysql_error());
...


Happy Coding :)
--
File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot

0 new messages