Jump to content

$id = _GET ['id']; Not Working :/ Please Help.... URGENT!


davidfattore

Recommended Posts

  On 11/16/2013 at 11:06 AM, davidfattore said:

The Code is below:

          <?php
				if((isset($_GET['id'])) && (is_numeric($_GET['id']))) { //accessed through viewusers.
					$id = $_GET['id'];
				} elseif ((isset($_POST['id'])) && (is_numeric($_POST['id']))) { //form has been subbed.
					$id = $_POST['id'];
				} else {
					print '<h2> Page Error </h2>';
					print '<p class=error> This page has been accessed in error. </p>';
				}
			?>
It's giving me the page error portion and not recognizing the $id

 

Going back to the initial problem you mentioned in your OP.

 

This problem can easily be solved by adding a $id = null; into your else statement.

That is only one reason though why it is ruining your query.

 

You where statement should be in a separate variable if you intend to collect all records at some point.

instead of, or along with $id, you should have a variable called $where, that contains a string like this

WHERE id = $id

 

and give it a value of null when you don't need it as I explained in the beginning.

 

So you query will look something like this instead

SELECT blah.* FROM someTable $where

Hey guys, thank you immensely for all the support, the problem has been solved! It turns out it was a problem with the hosting provider, in that they had just recently upgraded there MySQL server version and PHP versions (don't ask why, as they clearly didn't provide any notice to any of their customers prior to the upgrade).

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.