CincoPistolero Posted January 12, 2009 Share Posted January 12, 2009 I have a website that was working in November, but isn't now. The only change I know of is that the guy I'm working for forgot to pay his bill, so the site got dropped for a couple of days. He paid and when they brought it back up, he had a different IP, which could mean he is on a different server. So, before all this, I had the simple function of sending a ID from one page to the next via an URL. --> test.php?pricesID=$pricesID The next page would have a select statement that captures this ID and then I'd echo out the results. However, even though the sending pages displays listTest.php?pricesID=10 in its URL and the receiving page lists test.php?pricesID=10 in its URL it seems as if the ID is not being passed to at all. I get this error when clicking the link - First argument should be an array I've run my sql using the id number through SQL on the server and it returns, I've also put the ID that is supposed to be sent directly into the Select statement on the page, and it works. No matter what I do to try and echo out the id supposedly sent does not work. Any hints, I can post the actual code from both pages if necessary. The key is that all this worked before my client forgot to pay his bill. Link to comment https://forums.phpfreaks.com/topic/140551-solved-variable-not-passing-via-url-anymore/ Share on other sites More sharing options...
rhodesa Posted January 12, 2009 Share Posted January 12, 2009 yes, please post the code Link to comment https://forums.phpfreaks.com/topic/140551-solved-variable-not-passing-via-url-anymore/#findComment-735500 Share on other sites More sharing options...
CincoPistolero Posted January 12, 2009 Author Share Posted January 12, 2009 This is the select statement that lists out data. This works. <?php /* Price Information Query */ $query = " SELECT p.pricesID, p.basePrice, d.name, s.size, p.active FROM prices p, drumType d, size s WHERE p.drumTypeID=d.drumTypeID AND s.sizeID=p.sizeID ORDER BY d.name ASC"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); $color1 = "r2"; $color2 = "r3"; ?> This is the code that the link is in. It displays in the URL the proper ID. <?php $i = 1; while ( $row= mysql_fetch_array($result)){extract($row); $row_color = ($row_count % 2) ? $color1 : $color2; if ($row['active'] == 1) { $active_result= 'Yes'; } else { $active_result='No'; } echo " <tr> <td class='$row_color' width='240' align='center'>$name</td> <td class='$row_color' width='160' align='center'>$size</td> <td class='$row_color' width='80' align='center'><a href='modifyprice.php?pricesID=$pricesID'>$$basePrice</a></td> <td class='$row_color' width='60' align='center'>$active_result</td> </tr>"; $i++; $row_count++;}?> here is the modifyprice.php page code that gives and error. The array error happens for both lines that say extract. <?php /* Player Specific Information Query =========================================================================*/ $queryprice = "SELECT * FROM prices WHERE pricesID='pricesID'"; $priceresult = mysql_query($queryprice) or die ("Error in query: $queryprice. " . mysql_error()); $pricerow= mysql_fetch_array($priceresult); extract($pricerow); ?> <?php /*Get drum name and size*/ $query = "SELECT d.name, s.size FROM prices p, drumType d, size s WHERE pricesID='$pricesID' AND p.drumTypeID=d.drumTypeID AND p.sizeID=s.sizeID"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); $row= mysql_fetch_array($result); extract($row); ?> Once again. This code all worked a few months ago. No changes have been made to it. Now it seems as if the ID is not being passed at all. Link to comment https://forums.phpfreaks.com/topic/140551-solved-variable-not-passing-via-url-anymore/#findComment-735577 Share on other sites More sharing options...
revraz Posted January 12, 2009 Share Posted January 12, 2009 Is your WHERE correct? $queryprice = "SELECT * FROM prices WHERE pricesID='pricesID'"; Shouldn't 'pricesID' be an actual ID? Also, where do you set $pricesID here? $query = "SELECT d.name, s.size FROM prices p, drumType d, size s WHERE pricesID='$pricesID' AND p.drumTypeID=d.drumTypeID AND p.sizeID=s.sizeID"; Link to comment https://forums.phpfreaks.com/topic/140551-solved-variable-not-passing-via-url-anymore/#findComment-735581 Share on other sites More sharing options...
CincoPistolero Posted January 12, 2009 Author Share Posted January 12, 2009 its actually pricesID='$pricesID' -- this is what is being sent from listprices.php to modifyprices.php via the url, atleast thats what its supposed to do. Link to comment https://forums.phpfreaks.com/topic/140551-solved-variable-not-passing-via-url-anymore/#findComment-735587 Share on other sites More sharing options...
revraz Posted January 12, 2009 Share Posted January 12, 2009 Then you need to use $_GET to retreive it. Sounds like you were using register globals and now it's turned off. Link to comment https://forums.phpfreaks.com/topic/140551-solved-variable-not-passing-via-url-anymore/#findComment-735600 Share on other sites More sharing options...
CincoPistolero Posted January 12, 2009 Author Share Posted January 12, 2009 That solved it. I placed a $_GET at the top of the page, and now it works. I'll check with the hosting company about getting register globals turned back on. Link to comment https://forums.phpfreaks.com/topic/140551-solved-variable-not-passing-via-url-anymore/#findComment-735629 Share on other sites More sharing options...
kenrbnsn Posted January 12, 2009 Share Posted January 12, 2009 Turning on register_globals is a BIG security problem. Plus, it will be going away in PHP 6, so get used to writing the scripts correctly. Ken Link to comment https://forums.phpfreaks.com/topic/140551-solved-variable-not-passing-via-url-anymore/#findComment-735673 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.