<a href="\inventory.php?id=" . $id . "\"><?php echo $row_rsAllListings['element_1_1']; ?></a>
Why do you echo$row_rsAllListings['element_1_1'] but you don't echo $id? Check the link href value after the page is loaded. I'm sure you'll spot the problem.
buddylee17
Practically a Master Poster
697 posts since Nov 2007
Reputation Points: 232
Solved Threads: 137
<div class="content">
<table width="600">
<?php $counter = 0; // initialize counter outside loop
do { echo '<tr';
if ($counter++ % 2) {echo 'class="hilite"';}
echo '><td width="162"><img src="'.$row_rsAllListings['element_16'].'"></td>';
echo '<td width="426"><h2><a href="\inventory.php?id="'.$id.'">'.$row_rsAllListings['element_1_1'];
echo '</a> | '.$row_rsAllListings['element_2'].'';
echo $row_rsAllListings['element_3'].'</h2>';
echo $row_rsAllListings['element_4'].'';
echo $row_rsAllListings['element_5'].'Beds / '.$row_rsAllListings['element_6'];
echo $row_rsAllListings['element_7'].'Baths / '.$row_rsAllListings['element_8'].'sf per '.$row_rsAllListings['element_9'].'</td></tr>'; } while ($row_rsAllListings = mysql_fetch_assoc($rsAllListings)); ?>
</table>
</div>
this code is from clicking 'suggestions' devPHP
original code
<div class="content">
<table width="600">
<?php $counter = 0; // initialize counter outside loop ?>
<?php do { ?>
<tr <?php if ($counter++ % 2) {echo 'class="hilite"';} ?>>
<td width="162"><img src="<?php echo $row_rsAllListings['element_16']; ?>></td>
<td width="426">
<h2><a href="\inventory.php?id=" . $id . "\"><?php echo $row_rsAllListings['element_1_1']; ?></a> | <?php echo $row_rsAllListings['element_2']; ?>
<?php echo $row_rsAllListings['element_3']; ?></h2>
<?php echo $row_rsAllListings['element_4']; ?>
<?php echo $row_rsAllListings['element_5']; ?> Beds / <?php echo $row_rsAllListings['element_6']; ?>-<?php echo $row_rsAllListings['element_7']; ?> Baths / <?php echo $row_rsAllListings['element_8']; ?>sf per <?php echo $row_rsAllListings['element_9']; ?>
</td>
</tr>
<?php } while ($row_rsAllListings = mysql_fetch_assoc($rsAllListings)); ?>
</table>
</div>
almostbob
Posting Sensei
3,149 posts since Jan 2009
Reputation Points: 571
Solved Threads: 376
inventory.php
there is no 'select * from database where id='.$id
there is no reference to '$id' in the file
the href calling the inventory script
inventory.php?id=$id
if you don't use it, you lose it, and id is getting lost
almostbob
Posting Sensei
3,149 posts since Jan 2009
Reputation Points: 571
Solved Threads: 376
your link to inventory.php has a parameter ?id=$id
assuming $id is the id link of the record in the database
that id is available in inventory.php as $id
somewhere in the inventory.php file there should be (could be, usually is) an sql query that selects the row defined by that id
something like
"select * from database where id=$id"
I could not find such query in the file
I could find many queries, but none that selected on the basis of $id
it may be as simple as finding the variable used in inventory.php to select and
change that named variable to $id /* or */
change the parameter name passed by the link to that used in inventory.php /* or */
add a sql select with the right format
the sql in the files is convoluted, almost as if written to hide its intent
almostbob
Posting Sensei
3,149 posts since Jan 2009
Reputation Points: 571
Solved Threads: 376
without debugging the code, don't have the db structure, don't know what table refers to what, you have to end up with something like
mysql_select_db($database_rsGunn, $rsGunn);
$query_rsInventory1 = "SELECT ap_form_1.element_1_1, ap_form_1.element_1_2, ap_form_1.element_1_3, ap_form_1.element_1_4, ap_form_1.element_1_5, ap_form_1.element_1_6, ap_form_1.element_2, ap_form_1.element_3, ap_form_1.element_16, ap_form_1.element_4, ap_form_1.element_5, ap_form_1.element_57, ap_form_1.element_6, ap_form_1.element_7, ap_form_1.element_8, ap_form_1.element_9, ap_form_1.id FROM ap_form_1 where id=".$id;
$rsInventory1 = mysql_query($query_rsInventory1, $rsGunn) or die(mysql_error());
horrible data structure ap_form.element_57, not at all intuitive
almostbob
Posting Sensei
3,149 posts since Jan 2009
Reputation Points: 571
Solved Threads: 376