Page 1 of 1

Need help urgent!

Posted: Wed Jan 20, 2010 12:08 pm
by Goofan
Hi I got a small problem im sending an id to another page and cant $_GET it.

Code is for sending page:

Code: Select all

 
<?php
include "../login/database.php";
 
  $id =(isset($_GET['saved_id'])) ? (int)$_GET['saved_id'] : false;
    if($id !== false)
 {
    $sql="SELECT * FROM konto";      
 }
    else
 {
    echo "NO saved_id!";
 }
$result = mysql_query($sql) or die("Kunde inte lägga till ny text:<br />" . mysql_error());
                 
while($row = mysql_fetch_array( $result ))      
{
        $user=$row['user'];
        $saved_ids=$row['saved_id'];
        echo "<a href='Users.php?users=".$saved_ids."'>" .$user ."<br>" ."</a>";    
}
 
 
?> 
 

Code is for receiving page:

Code: Select all

 
<?php
include "../login/database.php";
 
  $users =(isset($_GET['saved_ids'])) ? (int)$_GET['saved_id'] : false;
    if($users !== false)
 {
    $sqls="SELECT * FROM konto WHERE saved_id=$users";     
 }
    else
 {
    echo "NO saved_id!"."<br>"; 
    echo $users;
 
 }
$results = mysql_query($sqls) or die("Kunde inte lägga till ny text:<br />" . mysql_error());
                 
while($rows = mysql_fetch_array( $results ))     
{
        echo $sqls;
}
 
 
?> 
 
in recieving page I am not GETing the saved_ids...
please tell me what I am doing wrong so that i can fix it and its very urgent.

Re: Need help urgent!

Posted: Wed Jan 20, 2010 12:22 pm
by AbraCadaver
That's because you're using the variable 'users' in the query string ?users=$saved_ids and then you're trying to use $_GET['saved_ids']. Either use 'saved_ids' in the query string or use $_GET['users'] to retrieve the value.

Re: Need help urgent!

Posted: Wed Jan 20, 2010 12:26 pm
by Jonah Bron
Forum Rules wrote:2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.
...using my handy dandy new forum rule inserter userscript :D

Re: Need help urgent!

Posted: Thu Jan 21, 2010 9:14 am
by Goofan
well abra dont really nkow what u mean? please explain abit further. what do i need to alter?

Re: Need help urgent!

Posted: Thu Jan 21, 2010 10:37 am
by AbraCadaver
Goofan wrote:well abra dont really nkow what u mean? please explain abit further. what do i need to alter?
I thought it was obvious, but:

Code: Select all

$users =(isset($_GET['users'])) ? (int)$_GET['users'] : false;

Re: Need help urgent!

Posted: Thu Jan 21, 2010 10:54 am
by Goofan
Ohh yea now I see it thanks :D Missed it thats all :D
Well thanks a bunch