$_GET help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

$_GET help

Post 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]
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

show the code where you generate the link
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

Post 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]
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post 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 :?
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

Post 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]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
Post Reply