Jump to content

Not getting the variable!


varcxx

Recommended Posts

In the script:

 

if ($_GET[id]) {

$get_item="select * from works where id = '$id' and view = '1' order by id asc";

$result=mysql_query($get_item, $conn) or die (mysql_error());

}

 

When I send:

my_page.php?id=6

 

$id is not catching the number.

 

This is so weird! It stopped working when I moved my site to a new server running PHP version 4.4.8

My previous server was running 4.4.7

 

Could this be the cause of this bug?

How can I make it work?

 

Link to comment
https://forums.phpfreaks.com/topic/110546-not-getting-the-variable/
Share on other sites

your not setting $id to anything

 

if ($_GET[id]) {
$get_item="select * from works where id = '$id' and view = '1' order by id asc";
$result=mysql_query($get_item, $conn) or die (mysql_error());
}

 

should be:

if ($_GET['id']) {
$id = $_GET['id'];
$get_item="select * from works where id = '$id' and view = '1' order by id asc";
$result=mysql_query($get_item, $conn) or die (mysql_error());
}

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.