wickedawsome Posted February 11, 2007 Share Posted February 11, 2007 alright, I am pretty new to php, so bare with me... I am making a link to self with the id of a row in the mysql table ie: test.php?id=1 is how it looks in the URL now obviously I am trying to set id=1 so that when the page reloads, an isset function catches it and deletes that ID from the table... now the problem is...that the isset is coming back false...and I have no idea why. here is the code echo ($id);//to see the value of id, it does not show anything if (isset($id)) //obviously skips this part as said { $conn = mysql_connect($host, $user, $password) or die(mysql_error()); $db = mysql_select_db($dbName, $conn) or die(mysql_error()); $sql = 'DELETE FROM names WHERE id = $id '; if (mysql_query($sql)) { echo("<P>The ID has been deleted.</P>"); } else { echo("<P>Error deleting ID: " . mysql_error() . "</P>"); } } else //goes thru fine. echo "failed"; so...I would asume that the var is not carying thru to the code... here is how I am sending it to the code if that is relevant <A HREF="test.php?id=<?php echo $id; ?>">Delete this id</A> another recomendation as to how to do this is more than welcome, I just need it to work. Thank you very much Link to comment https://forums.phpfreaks.com/topic/38066-solved-i-am-having-alot-of-trouble-changing-a-variable-thru-the-url-please-help/ Share on other sites More sharing options...
papaface Posted February 11, 2007 Share Posted February 11, 2007 You should be using $_GET['id'] not $id Link to comment https://forums.phpfreaks.com/topic/38066-solved-i-am-having-alot-of-trouble-changing-a-variable-thru-the-url-please-help/#findComment-182204 Share on other sites More sharing options...
wickedawsome Posted February 11, 2007 Author Share Posted February 11, 2007 thank you, it was that easy, lol, im a noob Link to comment https://forums.phpfreaks.com/topic/38066-solved-i-am-having-alot-of-trouble-changing-a-variable-thru-the-url-please-help/#findComment-182209 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.