Need help urgent!

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
Goofan
Forum Contributor
Posts: 305
Joined: Wed Nov 04, 2009 2:11 pm
Location: Sweden

Need help urgent!

Post 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.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Need help urgent!

Post 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.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Need help urgent!

Post 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
User avatar
Goofan
Forum Contributor
Posts: 305
Joined: Wed Nov 04, 2009 2:11 pm
Location: Sweden

Re: Need help urgent!

Post by Goofan »

well abra dont really nkow what u mean? please explain abit further. what do i need to alter?
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Need help urgent!

Post 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;
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
User avatar
Goofan
Forum Contributor
Posts: 305
Joined: Wed Nov 04, 2009 2:11 pm
Location: Sweden

Re: Need help urgent!

Post by Goofan »

Ohh yea now I see it thanks :D Missed it thats all :D
Well thanks a bunch
Post Reply