View previous topic :: View next topic |
Author |
Message |
GoofyHMG Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/55326039641ebed741ccb7.gif)
Joined: 24 Dec 2004 Posts: 77
|
Posted: Sun Feb 20, 2005 4:34 pm Post subject: apache2 php mysql -> php parameters on web link ignored |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
lookinin Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 21 Jan 2005 Posts: 486
|
Posted: Sun Feb 20, 2005 4:39 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
GoofyHMG Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/55326039641ebed741ccb7.gif)
Joined: 24 Dec 2004 Posts: 77
|
Posted: Sun Feb 20, 2005 5:12 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
lookinin Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 21 Jan 2005 Posts: 486
|
Posted: Sun Feb 20, 2005 5:17 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
GoofyHMG Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/55326039641ebed741ccb7.gif)
Joined: 24 Dec 2004 Posts: 77
|
Posted: Mon Feb 21, 2005 10:05 pm Post subject: IT WORKS! |
|
|
Hey wanted to thank you. I just tried it and it works great thanks for the advice!!!! |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|