Jump to content

Bazzaah

Members
  • Posts

    49
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Bazzaah's Achievements

Member

Member (2/5)

0

Reputation

  1. Indeed - I'd seen you give this answer in another thread. I thought it was there to separate the results into rows so that the $list['word'] would work. I'd been deleting some superfluous code and notes from the script and should have kept trimming! Thanks, though - all sorted!
  2. Hi I have this code to echo th econtents of a table, which contains 100 rows. I want to be able to display all 100 rows. The problem is that it displays 99 (it excludes the first). I've tried to backtrack to reconstruct the code to find out where the error is but no joy. Any ideas? Thanks in advance! .... // get all entries from table $sql = "SELECT * FROM 100words ORDER BY word_id"; $result = mysqli_query($dbc, $sql); $r = mysqli_fetch_row($result); //print table entries to screen in columns echo '<div id="container">'; // results presented in html table 5 columns, 20 rows per page echo '<div id="outerbox">'; echo '<div class="innerbox">'; echo '<table class="centerresults" border="0">' . "\n"; echo '<td>'; $i = 0; $max_columns = 5; while ($list = mysqli_fetch_assoc($result)) { extract($list); // open row if counter is zero if($i == 0) echo '<tr>' . "\n"; echo '<td width="150px"><a href="word.php?w=' . $list['word'] . '">' . $list['word'] . "</a></td> \n "; // increment counter - if counter = max columns, reset counter and close row if(++$i == $max_columns) { echo '</td>' . "\n"; $i=0; } // END if(++$i == $max_columns) { } // END while (!empty($myArray)) { //} END while ($list = mysql_fetch_array($result)) { //END if($i < $max_columns) { echo '</tr>' . "\n"; echo '</table>' . "\n"; echo '</div>'; echo '</div>';
  3. Thanks Scot, I got it all sorted in the end.
  4. have a look at this thread http://www.phpfreaks.com/forums/index.php?topic=348868.msg1646003#msg1646003 I read the other day that you can semantically associate tags with images in HTML5 so have a hunt around on Google and see what you can find.
  5. http://www.phpfreaks.com/forums/index.php?topic=347607.msg1640455#msg1640455 have a look at this thread.
  6. ScotDiddle Thanks so much for that, it's really appreciated. One further question if I may about using an array; the table is built from a search which I've set up like this; $sql = "SELECT * FROM words WHERE word LIKE '%{$searchTermDB}%' ORDER BY word LIMIT $offset, $rowsperpage"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); (I should update to mysqli functions.) If the results are expressed through the variable $result, how do I use an array?
  7. Hi there I followed this post http://www.phpfreaks.com/forums/index.php?topic=95426.0 to get a multi-column layout of search results. All's well but I seem to have an extra blank row at the bottom of the table. This is my code for the table echo '<table width="800px" class="center" border="1">'; echo '<td>'; if($result && mysql_num_rows($result) > 0) { $i = 0; $max_columns = 3; while ($list = mysql_fetch_array($result)) { // make the variables easy to deal with extract($list); // open row if counter is zero if($i == 0) echo "<tr>"; echo '<td><a href="word.php?w=' . $list['word'] . '">' . $list['word'] . '</a></td>'; // increment counter - if counter = max columns, reset counter and close row if(++$i == $max_columns) { echo "</tr>"; $i=0; } // end if } // end while } // end if results // clean up table - makes your code valid! if($i < $max_columns) { for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; } echo '</tr>'; echo '</table>'; Any ideas on how not to have it there? Thanks in advance.
  8. Thanks - I really appreciate your help. I'll read the manual.
  9. The script worked just fine thanks - the entries were all surrounded by quotes though. Any ideas how to avoid this?
  10. changed position to relative on #frontpagecentered and that seems to have sorted it.
  11. I'm a bit confused with some CSS I've been doing and wondered if someone could help me out please. I have my header and footer in place; html, body { background: #2c539e; font-size: 100%; margin:0; padding:0; height:100%; } /* container */ #centered { min-height:100%; position:relative; margin: 20px auto; } /* header and footer*/ #header { background:#ff0; margin-top: 10px; } #footer { position:absolute; bottom:0; width:100%; height: 60px; margin-bottom: 10px; } The content is contained in a couple of (nested?) boxes. #frontpagecentered{ margin-top: 240px; position: absolute; width: 950px; left: 50%; margin-left: -475px; margin-right:auto; background-color: #9abdde; padding-top: 30px; padding-bottom: 30px; -moz-border-radius: 15px; border-radius: 15px; } #box { padding:10px 10px 10px 10px; padding-bottom:60px; /* Height of the footer */ width: 900px; background-color: #F0F2F7; font-size: 1.1em; font-family: Century Gothic,Myriad Pro,Arial,Helvetica,sans-serif; -moz-border-radius: 15px; border-radius: 15px; margin-left: 10px; margin-right: 10px; } Is there a layout I can use so that I can add a new box in the relevant file and have the boxes automatically one beneath the other? Thanks in advance for any help
  12. Ok thanks for the ideas there. I'll give the .csv a go. The db has an auto_increment to number each row - would that be covered or would I need to number each entry within the spread?
  13. Not sure if this is the right forum, but I have a database that I will need to populate with a large number of rows (2000+). I have written a PHP script that uploads individual entries. Is it possible to use something like a spreadsheet where I can set out the rows/columns as they will appear in the database, and then upload in one go rather than uploading each row individually? Thanks for any observations and/or help.
×
×
  • 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.