Page 1 of 1

$_GET help

Posted: Mon Mar 14, 2005 1:29 am
by pleigh
i am attaching this code to a link...

Code: Select all

?mode=edit&post=$_GETї'the post id']
but during runtime, when i move the mouse over the link.....this is what i get
editreport.php?mode=edit&post=$_GET['the post id']
under the post id it doesnt display the right post id of the link...
this is my db query

what should i do?

Code: Select all

$query = "SELECT userID, postID FROM posts WHERE userID='$uid' AND postID='$id'";
    $result = @mysql_query($query) or die(mysql_error());

feyd | Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Mon Mar 14, 2005 2:54 am
by JayBird
show the code where you generate the link

Posted: Mon Mar 14, 2005 3:02 am
by pleigh
thanks for the reply pimp...here's my code....

Code: Select all

$uid = $_SESSION['userID'];
    $id = $_GET['pid'];
    $query = "SELECT userID, postID FROM posts WHERE userID='$uid' AND postID='$id'";
    $result = @mysql_query($query) or die(mysql_error());    
    if (mysql_fetch_assoc($result))
    {
        echo '<a href="reportedit.php?eid=$_GET[$id]" class=under>EDIT</a>';
    }
    else
    {
        NULL;
    }

feyd | Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Mon Mar 14, 2005 3:07 am
by JayBird
this line

Code: Select all

echo '<a href="reportedit.php?eid=$_GET[$id]" class=under>EDIT</a>';
should be

Code: Select all

echo '<a href="reportedit.php?eid='.$_GET[$id].'" class=under>EDIT</a>';
shouldn't you have $_GET["id"] and not $_GET[$id] maybe :?

Posted: Mon Mar 14, 2005 3:38 am
by pleigh
thanks pimp...it worked...

Code: Select all

echo '<a href="reportedit.php?eid='.$_GET[$id].'" class=under>EDIT</a>';
i changed the $_GET[$id] to $_GET['pid'] where pid is the post id....


feyd | Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Mon Mar 14, 2005 8:33 am
by feyd
pleigh, you seriously need to read and understand the Posting Code in the Forums thread. A link is provided in all your posts in this thread, along with in my signature.