You are here: Re: [PHP] Database problem? « PHP « IT news, forums, messages
Re: [PHP] Database problem?

Posted by Curt Zirzow on 11/28/05 21:01

On Mon, Nov 28, 2005 at 08:37:36PM +0200, William Stokes wrote:
....
> I have this in my page and it doesn't work:
> $sql = "select jouk_nimi from x_jun_jouk where jouk_id='$team' ";
> $kysely = mysql_query($sql);
> $tulos = mysql_fetch_row($kysely);
> $jouk_nimi = $tulos[0];
>
> $jouk_nimi -variable will be empty.
....
>
> So I think that somehow the $team variable is not passed from the address
> line. Is there something in PHP ar Apache that needs to be configured

You'll notice if you compare the output of phpinfo() from both
server, the other server has register_globals on.

You can fix this by explicitly defining where the variable $team is
comming from.

$team = mysql_real_escape_string($_GET['team']);
$sql = "select jouk_nimi from x_jun_jouk where jouk_id='$team' ";

Also note the escaping of the string; you should be sure to
properly escape the string to avoid sql injection.

Curt.
--
cat .signature: No such file or directory

 

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

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