Sorry for the delayed response.

Not sure I quite understand your problem here. When you say:

>But   when I  turned register_globals On in  PHP.ini and don't  use
> $_GET['id'],
> echo $querystring in show.php file display empty:
> SELECT * FROM news_tb WHERE id=''

If you have indeed turned register_globals ON in PHP and you DON'T use
$_GET['id'], of course your query string is going to have an empty value
when you reference $id because PHP doesn't know to what value you're
referring.

A reference to $_GET['id'] would refer to a variable $id passed in through a
URL. If the variable $id to which you are referring is actually set locally
and is not passed in via GET or POST then you should find the spot in your
code where $id is set and echo it out to the browser to make sure it's set
to what you expect. It may be a case where a local variable is not set
properly.

I hope I have not misunderstood your question. If I have, please provide a
little more detail and I'll do my best to help.

> -----Original Message-----
> From: linton [mailto:[EMAIL PROTECTED]
> Sent: Sunday, June 15, 2003 9:45 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] PHP transfer variable question?????
> 
> 
> thanks!
> The show.php file is ok when I use $_GET['id'].
> But   when I  turned register_globals On in  PHP.ini and don't  use
> $_GET['id'],
> echo $querystring in show.php file display empty:
> SELECT * FROM news_tb WHERE id=''
>                                                              ---???
> why?
> 
> "Rich Hutchins" <[EMAIL PROTECTED]>
> news:[EMAIL PROTECTED]
> > The default installation of PHP 4.2.x+ now ships with 
> register_globals set
> > to OFF in PHP.ini. You have two choices:
> >
> > 1. Change all of your variable references to $_POST['varname'] (or
> > $_GET['varname']). In your case it looks like you'd need 
> $_GET['id'].
> >
> > 2. Turn register_globals ON in your PHP.ini.
> >
> > The first option is the recommended way. The "why" is 
> explained in the
> > configuration notes in php.ini. I'd recommend you take the 
> time to scan
> the
> > notes at the top of the php.ini file. Lots of important 
> stuff in there
> that,
> > if you're aware of it, will help you handle future issues as well.
> >
> > Hope this helps.
> >
> > Rich
> >
> > -----Original Message-----
> > From: linton [mailto:[EMAIL PROTECTED]
> > Sent: Friday, June 13, 2003 11:32 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] PHP transfer variable question?????
> >
> >
> > PHP  transfer variable question?????
> >
> > My program is ok in apache_1.3.19 and php-4.1.2??but when I 
> change over to
> > php_4.3.2
> >
> > and apache_1.3.27,I can't get variable!?
> > 
> --------------------------------------------------------------
> ----------
> > code:
> >
> > //newsList.php:
> >
> > $querystring = "SELECT id,title FROM $nTable ORDER BY id 
> DESC LIMIT 3";
> > $result = mysql_query($querystring) or die ("can't query?!?!?!");
> > while ($row = mysql_fetch_row($result))    {
> >     echo "<a href='news/show.php?id=$row[0]' >$row[1]</a><br>";
> > }
> > 
> --------------------------------------------------------------
> ----------
> > code:
> >
> > //show.php
> >
> > $querystring = "SELECT  * FROM $nTable WHERE id='$id'";
> > $result = mysql_query($querystring) or die ("can't query?!?!?!");
> >
> > echo $querystring;  //test
> >
> > while ($row = mysql_fetch_row($result))
> > 
> --------------------------------------------------------------
> ----------
> >
> > echo display?o
> > SELECT * FROM news_tb WHERE id=''
> >                                ----??  why is empty???
> > $id can't receive!
> >
> > How to resolve it??
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to