Jump to content

jaredlui

New Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by jaredlui

  1. I appreciate your help gents. Muddy_Funster that saved me a bunch of coding. Thanks, Jared
  2. MySQL server version: 5.0.92 Okay, I have learned that you cannot simply list a bunch of columns in a SELECT COUNT statement and expect it to work. i.e. SELECT COUNT(images1,images2,images3) FROM members (which I guess really doesn't makes sense anyway) I would think it's a pretty common thing to add the COUNTS of several columns in a table together and have found a plethora of articles on it, all different and none simple enough to makes sense to me. Is there a common model that simply adds the COUNTS of column1 + column2 + column3? This is what I want: row | col1 | col2 | col3 1----| --X--| --X-- | --X 2----| ------| --X --| --X 3----| --X--| ------ | --X ---------------------------- ----------2--+---2--+--3---= 7 If not what is the best practice? I thought about creating a single SELECT COUNT recordset for each column and then using php tp add them all up. However I have 10 columns that need to be added and I think I could do this easier than creating 10 more recordsets. Plus I'm a noob with PHp and MySQL. I've tried using UNION but I soon figured I was doing it wrong. Thanks for your advice.
  3. Thanks for your response. I found the problem which was user error. A typo on a column name that I did not catch the first 30 times.
  4. In a nutshell: I'm having issues trying to create a proper filter using the value from the first recordset in the second recordset. Overview: I have 3 tables (LINES; SERIES; FIGURES). Figures are a child of Series and Series is a child of Lines. I want a detail page with a selected Lines details, a table for each series within the line and in each series table, repeating rows of all the figures within that series. Here are two sets of code from previous tries: Both sets of code have the second recordset within the repeat loop. This is the code within that loop. The first set of code will repeat the tables AND repeat the rows however the results for the rows show all figures within the line rather than filtering them for the series: You can see the result at this link: BTW, I had to hard code the Where statement to get a result to show. It's this Where statement that I think is my issue. http://www.onlinetoyshow.com/admin/lines/figure_lines_Detail.php?Line_Id=1 <?php do { ?> <table width="400px" border="1" cellspacing="0" cellpadding="3"> <tr> <td><img src="../../images/series_thumb/<?php echo $row_WADAfigure_lines['Series_thumbnail']; ?>" alt="" name="Series_Thumbnail" id="Series_Thumbnail" width="50" height="50" /></td> <td><?php echo $row_WADAfigure_lines['Series_Name']; ?></td> <td align="right" nowrap="nowrap" ><a href="../series/series_Detail.php?Series_Id=<?php echo(rawurlencode($row_WADAfigure_lines['Series_Id'])); ?>" title="View"><img border="0" name="View<?php echo(rawurlencode($row_WADAfigure_lines['Series_Id'])); ?>" id="View<?php echo(rawurlencode($row_WADAfigure_lines['Series_Id'])); ?>" alt="View" src="../../WA_DataAssist/images/Pacifica/Traditional_zoom.gif" /></a><a href="../series/series_Update.php?Series_Id=<?php echo(rawurlencode($row_WADAfigure_lines['Series_Id'])); ?>" title="Update"><img border="0" name="Update<?php echo(rawurlencode($row_WADAfigure_lines['Series_Id'])); ?>" id="Update<?php echo(rawurlencode($row_WADAfigure_lines['Series_Id'])); ?>" alt="Update" src="../../WA_DataAssist/images/Pacifica/Traditional_edit.gif" /></a></td> </tr> <tr> <td colspan="3"> </td> </tr> <?php mysql_select_db($database_FIGURES, $FIGURES); $query_rsFigures = "SELECT Figure_Name, Figure_Thumbnail, series.Series_Id FROM figures INNER JOIN series ON figures.Series_Id = series.Series_Id WHERE series.Series_Id = 13 ORDER BY Figure_Name ASC"; $rsFigures = mysql_query($query_rsFigures, $FIGURES) or die(mysql_error()); $row_rsFigures = mysql_fetch_assoc($rsFigures); $totalRows_rsFigures = mysql_num_rows($rsFigures); // RepeatSelectionCounter_1 Begin Loop $RepeatSelectionCounter_1_IterationsRemaining = $RepeatSelectionCounter_1_Iterations; while($RepeatSelectionCounter_1_IterationsRemaining--){ if($RepeatSelectionCounterBasedLooping_1 || $row_rsFigures){ ?> <tr> <td><center><img src="../../images/figure_thumb/<?php echo $row_rsFigures['Figure_Thumbnail']; ?>" alt="" name="Figure_Thumbnail" id="Figure_Thumbnail" width="40" height="40" /></center></td> <td><?php echo $row_rsFigures['Figure_Name']; ?></td> <td align="right"><a href="#">Links</a></td> </tr> <?php } // RepeatSelectionCounter_1 Begin Alternate Content else{ ?> <?php } // RepeatSelectionCounter_1 End Alternate Content if(!$RepeatSelectionCounterBasedLooping_1 && $RepeatSelectionCounter_1_IterationsRemaining != 0){ if(!$row_rsFigures && $RepeatSelectionCounter_1_Iterations == -1){$RepeatSelectionCounter_1_IterationsRemaining = 0;} $row_rsFigures = mysql_fetch_assoc($rsFigures); } $RepeatSelectionCounter_1++; } // RepeatSelectionCounter_1 End Loop ?> </table> <br /> <?php } while ($row_WADAfigure_lines = mysql_fetch_assoc($WADAfigure_lines)); ?> This is another try where I tried the runtime value of the first recordset but this does not return any row value at all for the second recordset. If you were to see this in the browser it would only show three tables with the 3 separate series tables but 3 blank 2nd rows where the repeating figures should be. <?php $_POST['WADAfigure_lines_series.Series_Id'] = $row_WADAfigure_lines['series.Series_Id']; $ParamSeriesID_rsFigures = "-1"; if (isset($_POST['WADAfigure_lines_series.Series_Id'])) { $ParamSeriesID_rsFigures = (get_magic_quotes_gpc()) ? $_POST['WADAfigure_lines_series.Series_Id'] : addslashes($_POST['WADAfigure_lines_series.Series_Id']); } mysql_select_db($database_FIGURES, $FIGURES); $query_rsFigures = sprintf("SELECT Figure_Name, Figure_Thumbnail, series.Series_Id FROM figures INNER JOIN series ON figures.Series_Id = series.Series_Id WHERE series.Series_Id = %s ORDER BY Figure_Name ASC", GetSQLValueString($ParamSeriesID_rsFigures, "int")); $rsFigures = mysql_query($query_rsFigures, $FIGURES) or die(mysql_error()); $row_rsFigures = mysql_fetch_assoc($rsFigures); $totalRows_rsFigures = mysql_num_rows($rsFigures); // RepeatSelectionCounter_1 Begin Loop $RepeatSelectionCounter_1_IterationsRemaining = $RepeatSelectionCounter_1_Iterations; while($RepeatSelectionCounter_1_IterationsRemaining--){ if($RepeatSelectionCounterBasedLooping_1 || $row_rsFigures){ ?> <tr> <td><center><img src="../../images/figure_thumb/<?php echo $row_rsFigures['Figure_Thumbnail']; ?>" alt="" name="Figure_Thumbnail" id="Figure_Thumbnail" width="40" height="40" /></center></td> <td><?php echo $row_rsFigures['Figure_Name']; ?></td> <td align="right"><a href="#">Links</a></td> </tr> <?php } // RepeatSelectionCounter_1 Begin Alternate Content else{ ?> <?php } // RepeatSelectionCounter_1 End Alternate Content if(!$RepeatSelectionCounterBasedLooping_1 && $RepeatSelectionCounter_1_IterationsRemaining != 0){ if(!$row_rsFigures && $RepeatSelectionCounter_1_Iterations == -1){$RepeatSelectionCounter_1_IterationsRemaining = 0;} $row_rsFigures = mysql_fetch_assoc($rsFigures); } $RepeatSelectionCounter_1++; } // RepeatSelectionCounter_1 End Loop ?> </table> <br /> <?php } while ($row_WADAfigure_lines = mysql_fetch_assoc($WADAfigure_lines)); ?> All help is appreciated. I can provide files as needed.
×
×
  • 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.