Jump to content

[SOLVED] variable not passing via URL anymore


CincoPistolero

Recommended Posts

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.

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.

 

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";

 

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.