Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
apache2 php mysql -> php parameters on web link ignored
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
GoofyHMG
Tux's lil' helper
Tux's lil' helper


Joined: 24 Dec 2004
Posts: 77

PostPosted: Sun Feb 20, 2005 4:34 pm    Post subject: apache2 php mysql -> php parameters on web link ignored Reply with quote

ok I have a running site I want to move to another server everything seems to be working fine on the second (new server) except when I try something like

going from one page to another passing a parameter

for instance
from page one you click on allink that takes you to www.website.com/somepage.php?id=6
the second page doesnt pick up the parameter and causes it to fail unless I hard code an id in the php page on my server.

I have no clue as to what could be causing this everything else is working.

Thanks in advance
Back to top
View user's profile Send private message
lookinin
Guru
Guru


Joined: 21 Jan 2005
Posts: 486

PostPosted: Sun Feb 20, 2005 4:39 pm    Post subject: Reply with quote

Hi there, you need to have something like this on the receiving page:

Code:
$newvar=$_GET['urlvar'];


If you've all ready tried that, or are still having trouble - could you post an example of your code?
Back to top
View user's profile Send private message
GoofyHMG
Tux's lil' helper
Tux's lil' helper


Joined: 24 Dec 2004
Posts: 77

PostPosted: Sun Feb 20, 2005 5:12 pm    Post subject: Reply with quote

ok here is the part of code where it goes bad

<?php
include_once("db_connect.php");

//HERE IT IS $cat_id part
$query = "SELECT * FROM Categories WHERE cat_id = $cat_id";



// this is where it actually fails but only because of the query

$result = mysql_query($query) or die ("Query Failed: " .mysql_error());



while ($rows = mysql_fetch_array($result)) // loop through Category array and assign variables
{
$cat_id = $rows['cat_id'];
$cat_name = $rows['cat_name'];
$cat_desc = $rows['cat_desc'];
};
?>
The thing is it works on the first server so I have no Idea why its not working here. I thought it might be a module or something
Back to top
View user's profile Send private message
lookinin
Guru
Guru


Joined: 21 Jan 2005
Posts: 486

PostPosted: Sun Feb 20, 2005 5:17 pm    Post subject: Reply with quote

GoofyHMG wrote:

//HERE IT IS $cat_id part
$query = "SELECT * FROM Categories WHERE cat_id = $cat_id";


Okay, assuming $cat_id is the variable you're passing from the previous page, try something like this

Code:
$query = "SELECT * FROM Categories WHERE cat_id = ".$_GET['cat_id'];


If cat_id= is not the name of the variable on your url, replace the part in brackets with with what you're using.

Quote:
The thing is it works on the first server so I have no Idea why its not working here. I thought it might be a module or something


I don't think older versions of mod_php required this - is there a version difference between the two servers?
Back to top
View user's profile Send private message
GoofyHMG
Tux's lil' helper
Tux's lil' helper


Joined: 24 Dec 2004
Posts: 77

PostPosted: Mon Feb 21, 2005 10:05 pm    Post subject: IT WORKS! Reply with quote

Hey wanted to thank you. I just tried it and it works great thanks for the advice!!!!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
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