Jump to content

hitman6003

Members
  • Posts

    1,807
  • Joined

  • Last visited

Everything posted by hitman6003

  1. Try here: http://forums.codewalkers.com/showpost.php?p=126309&postcount=2 Or perhaps this: http://www.webbysoft.com/babelkit/
  2. I didn't spell the variable name correctly....there was also another syntax error... <?php $localhost= "localhost"; $user= "root"; $password=""; $database= "dbase"; mysql_connect($localhost,$user,$password) or die(mysql_error()); mysql_select_db($database); $rows_per_page = 10; if (!isset($pagenum) || $pagenum < 1) { $pagenum = 1; } $data = mysql_query("SELECT count(*) FROM linklist") or die(mysql_error()); $rows = mysql_result($data, 0); $total_pages = ceil($rows / $rows_per_page); if ($pagenum > $total_pages) { $pagenum = $total_pages; } $max = 'limit ' . ($pagenum - 1) * $rows_per_page . ',' . $rows_per_page; $data_p = mysql_query("SELECT * FROM linklist $max") or die(mysql_error()); while ($info = mysql_fetch_array( $data_p )) { echo $info['list_title'] . "<br />"; } echo "<p>--Page $pagenum of $total_pages-- <p>"; if ($pagenum != 1) { echo " <a href='shortext.php?pagenum=1'> <<-First</a> <a href='shortext.php?pagenum=" . $pagenum - 1 . "'> <-Previous</a> "; } echo " ---- "; if ($pagenum != $total_pages) { echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=" . $pagenum + 1 . "'>Next -></a> <a href='{$_SERVER['PHP_SELF']}?pagenum=$total_pages'>Last ->></a> "; } ?>
  3. Not sure what you mean. The above will create a single table with each data result on a separate row.
  4. You can't delete your post. Moderators are the only ones with that capability.
  5. This should work: <?php $localhost= "localhost"; $user= "root"; $password=""; $database= "dbase"; mysql_connect($localhost,$user,$password) or die(mysql_error()); mysql_select_db($database); $rows_per_page = 10; if (!isset($pagenum) || $pagenum < 1) { $pagenum = 1; } $data = mysql_query("SELECT count(*) FROM linklist") or die(mysql_error()); $rows = mysql_result($data, 0); $total_pages = ceil($rows/$page_rows); if ($pagenum > $total_pages) { $pagenum = $total_pages; } $max = 'limit ' . ($pagenum - 1) * $rows_per_page . ',' . $rows_per_page; $data_p = mysql_query("SELECT * FROM linklist $max") or die(mysql_error()); while ($info = mysql_fetch_array( $data_p )) { echo $info['list_title'] . "<br />"; } echo "<p>--Page $pagenum of $total_pages-- <p>"; if ($pagenum != 1) { echo " <a href='shortext.php?pagenum=1'> <<-First</a> <a href='shortext.php?pagenum=" . $pagenum - 1 . "'> <-Previous</a> "; } echo " ---- "; if ($pagenum != total_pages) { echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=" . $pagenum + 1 . "'>Next -></a> <a href='{$_SERVER['PHP_SELF']}?pagenum=$total_pages'>Last ->></a> "; } ?> You should never do "SELECT * FROM table" just to get the number of rows. It creates substantial extra work for the database, and if there is a lot of results, they all must be returned to the web server which generates extra network traffic unnecessarily. Bottom line, do like above, use a count query, then get the result.
  6. $sql = "SELECT * FROM Clients ORDER BY CreatedOn DESC LIMIT 50"; $result = mysql_query($sql, $conn) or die (mysql_error()); echo '<table width=\"90%\" border=\"1\">'; while ($list = mysql_fetch_array($result)) { echo '<tr><td>' .$list['CompanyName']. '</td>'; echo '<td>' .$list['CreatedOn']. '</td>'; echo '<td>' .$list[' FName']. '</td>'; echo '<td>' .$list[' LName']. '</td>'; echo '<td>' .$list['Contact']. '</td>'; echo '<td>' .$list['MAddress']. '</td>'; echo '<td>' .$list['MAddress2']. '</td>'; echo '<td>' .$list['MCity']. '</td>'; echo '<td>' .$list['MState']. '</td>'; echo '<td>' .$list['MZip']. '</td>'; echo '<td>' .$list['Phone']. '</td>'; echo '<td>' .$list['Cell']. '</td>'; echo '<td>' .$list['Email']. '</td></tr>'; } echo '</table>';
  7. To supress the warning from a failed include use the @ symbol... @include("some_nonexistant_file.php"); Your second question, either include a different css file, or use the same file, but give the fields on the other page a different class name.
  8. If you want to prevent the search engines from crawling your website use a robots.txt file. http://www.robotstxt.org/wc/exclusion.html
  9. http://gmail-lite.sourceforge.net/wordpress/index.php/about/libgmailer/
  10. Try something like: SELECT * FROM table ORDER BY date_field GROUP BY YEAR(date_field), MONTH(date_field)
  11. Change the foreach loop...I think this will work... foreach ($ids as $key => $id) { if ($id == $photoId) { $next = ($key + 1 > (count($ids) - 1) ? $ids[0] : $ids[$key + 1]); $prev = ($key - 1 < 0 ? $ids[count($ids)] : $ids[$key - 1]); break; } }
  12. $total_pages = $post_count%10; % is the modulus operator, it returns the remainder of the operation of dividing the two numbers As jlp09550 you want to use division... $total_pages = ceil($post_count / 10) < 1 ? 1 : ceil($post_count / 10);
  13. I'm assuming you mean in the img tag...change: <img src="../user_images/<?php echo $foundPhoto; ?>" /> to <img src="../user_images/<?php echo $photo['image_name']; ?>" />
  14. Change your query: $query = "(SELECT DISTINCT name, label " . "FROM manual WHERE name LIKE '%$trimmed%' OR label LIKE '%$trimmed%') " . " UNION " . "(SELECT DISTINCT name, label " . "FROM automatic WHERE name LIKE '%$trimmed%' OR label LIKE '%$trimmed%') " . "ORDER BY name DESC "; If you want better results, use a fulltext index (assuming you are using myisam), then use a MATCH ... AGAINST() query.
  15. Since we use the first query with the first mysql_query call, it becomes useless, and we can reuse that variable name. Same for $result...we get the values out of the first $result with mysql_fetch_assoc, which means we don't need it any more and can reuse the $result variable name. If you aren't getting the expected results be sure to plug the queries into mysql query browser or phpMyAdmin and see if they are simply not matching anything, or if there is an error somewhere
  16. DELETE FROM logbook WHERE date < DATE_SUB(NOW(), INTERVAL 2 DAY);
  17. http://www.phpfreaks.com/tutorials/43/0.php
  18. "if" is probably a reserved word.... change it to something different, "imf" or something like that, then change all of the "if.col_name" to "imf.col_name" as well.
  19. http://www.phpfreaks.com/tutorials/43/0.php
  20. An example: <?php $photoId = $_GET['photoID']; $query = "SELECT if.image_name, if.album, if.photo, if.create_date, if.details, u.first_name, u.last_name " . "FROM image_files if " . " LEFT JOIN users u ON if.user_id = u.user_id " . "WHERE image_id = " . $photoId; $result = mysql_query($query)or die("SQL Error: $query <br>" . mysql_error()); $photo = mysql_fetch_assoc($result); $query = "SELECT image_id " . "FROM image_files " . "WHERE album = '" . $album . "' AND user_id = " . $owner_id . " " . "ORDER BY image_id ASC"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $ids[] = $row['image_id']; } foreach ($ids as $key => $id) { if ($id == $photoId) { $next = $ids[$key + 1]; $prev = $ids[$key - 1]; break; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <div id="outer"> <div id="hdr"> <!--Header--> <?php include('../design/topbanner.php'); ?> </div> <div id="bar"> <!--Subheader--> <h3 style="margin-left:250px; color:#848484; padding-top:10px;"><?php echo $_SESSION['fname'].' '. $_SESSION['lname']; ?></h3> </div> <div id="bodyblock"> <!--body Lock--> <div id="l-col"> <?php include('../searchMembers.php'); ?> </div> <div id="cont"> <div class="imageFull"> <p style="font-size:10px; color:#848484; font-style:italic;"> Create Date: <?php echo $photo['create_date']; ?> </p> <p style="text-align:center"> <img src="../user_images/<?php echo $foundPhoto; ?>" /> </p> <p style="text-align:right; padding-right:20px; margin-top:5px; font-size:10px;"> From the Album:<br /> <?php echo $photo['album']; ?> <span style="color:#000000">by</span> <?php echo $photo['first_name'] . ' ' . $photo['last_name']; ?> </p> <p> <?php echo $photo['details']; ?> </p> <p> <table width="100%"> <tr> <td style="text-align: left; width: 50%;"><a href="<?php echo $_SERVER['PHP_SELF'] . "&?photoID=" . $prev; ?>">Prev</a></td> <td style="text-align: right; width: 50%;"><a href="<?php echo $_SERVER['PHP_SELF'] . "&?photoID=" . $next; ?>">Next</a></td> </tr> </table> </p>
  21. at the top, just below your the opening php tag.
  22. By what query? Your query only returns one row.
  23. You can put your statement in a transaction if you are using Innodb, although this shouldn't be necessary...if you execute the command and it fails, nothing will be affected in the database anyway, then you can alert the user... $sql = "UPDATE workers SET workerStatus = '0' WHERE workerId = '$empno'"; if (mysql_query($sql)) { echo "Success"; } else { mysql_error(); }
  24. Is the next photo the next id? Is it the next id in the album? Is there a date field? If so, would the next photo be the next newest one?
  25. That doesn't help at all. What error are you getting, if any? Is error reporting turned on? What level of errors are displayed? If necessary, turn error reporting on and increase the error reporting level: ini_set("display_errors", 1); error_reporting(E_ALL);
×
×
  • 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.