Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP
Author Message
scorpious
Worker
Worker



Joined: Dec 03, 2005
Posts: 153

PostPosted: Sat Mar 19, 2011 7:31 am Reply with quote

Hi All

I have created a module abit like the members List.

The Pagination part works, it lists everything, how many pages there are with links to Next page and Back a page. Everything is working fine, bar one thing.

I have a link on the players name:

Code:
<a href="modules.php?name=Players&amp;file=viewplayer&amp;user_id='.$user['user_id'].'">'.$user['name'].'</a>


When I click on any players name, it takes me to the viewplayers page.
Within the address bar I see:

Code:
modules.php?name=Players&file=viewplayers&user_id=10


How can I get the user_id info to show.

I have the following Code.
Code:
      echo '<center><b>Ok I am here now show the ID Number';

      echo '<br>ID Number is '.$user_id.'';


I have tried adding diffrent code, but can't seam to get the user_id
Once I get the user_id, I can then do a query on the database to show the information relating to that user_id.

Cheers
Scorp
 
View user's profile Send private message
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Sat Mar 19, 2011 9:23 am Reply with quote

Code:


echo '<center><b>Ok I am here now show the ID Number';
echo '<br>ID Number is ' . $_GET['user_id'];

_________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. 
View user's profile Send private message
scorpious







PostPosted: Sat Mar 19, 2011 6:15 pm Reply with quote

Hi Palbin

Thank you for the reply, it now shows the ID

How can I get the Id number into the query:

Code:
$resultpersons=$db->sql_query("SELECT name, rank, kills, deaths, FROM ".$prefix."_soldiers WHERE user_id = '$user_id'",$db);


Or can I convert the
Code:
' . $_GET['user_id'
into something like
Code:
$uid = ' . $_GET['user_id'
and use the
Code:
$uid
within the the query.

Cheers

Scorp
 
Palbin







PostPosted: Sat Mar 19, 2011 7:43 pm Reply with quote

This would be fine:
Code:


$uid = $_GET['user_id'];

I would do something like this:
Code:


$uid = intval($_GET['user_id']);

Then your query would be like this:
Code:


$resultpersons = $db->sql_query('SELECT `name`, `rank`, `kills`, `deaths` FROM ' `' . $prefix . '_soldiers` WHERE `user_id` = "' . $uid . '"');
 
scorpious







PostPosted: Sun Mar 20, 2011 4:54 am Reply with quote

Hi Palbin

Thanks again, it all works fine, I was using the following:
Code:
$uid = . $_GET['user_id'];


Now I know not to use the .(dot) space

Cheers
Scorp
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©