Jump to content

bluewaves

Members
  • Posts

    32
  • Joined

  • Last visited

    Never

Posts posted by bluewaves

  1. I am unfortunately using an old version of phpmyadmin and mysql. What is really very easy to do in current versions

    is making me pull my hair out with this old version.

     

    MySQL - 3.23.58

    phpMyAdmin - 2.8.2.4

     

    When I try to use the import feature, I get this error message when using CSV LOAD Data

    '/tmp/phpkloqCK' must be in the database directory or be readable by all

     

    I haven't a clue where that file is located or how to change permissions on it.

     

    Can anyone help?

     

    Thanks.

  2. When I use this code, I get error messages in w3 validator that says - required attribute "alt" not specified

    What would I need to change to get it to recognize the alt tag?

     

     

    <td width='200'><div class='imageBox'><a href='". $list['link'] . "' rel='nofollow' title='" . $list['name'] . "' >
        <img src=" . $list['image'] . " alt='" . $list['name'] . "' border='0' />
        <a href='". $list['link'] . "' rel='nofollow' title='" . $list['name'] . "'>
        <center><font size='1'><strong>" . $list['name'] . "</a></strong></font></center></td>\n";    ?>

  3. How can I get this to work with this code:

     

    <?php
    
    include('bbbb.php');
    
      $database = "cxxxxx";
    
      $cxn = mysql_connect($host,$user,$password)
    
             or die ("couldn't connect to server");
    
      mysql_select_db($database);
    $conn = mysql_connect('localhost','x','x') or trigger_error("SQL", E_USER_ERROR);   
    $db = mysql_select_db('coolchec_checks',$conn) or trigger_error("SQL", E_USER_ERROR); 
    
    // find out how many rows are in the table 
    $sql = "SELECT COUNT(*) FROM table WHERE Type='movie' ORDER BY ProductID DESC";
    $result = mysql_query($sql, $cxn) or trigger_error("SQL", E_USER_ERROR);
    $r = mysql_fetch_row($result);
    $numrows = $r[0];
    
    // number of rows to show per page
    $rowsperpage = 30;
    // find out total pages
    $totalpages = ceil($numrows / $rowsperpage);
    
    // get the current page or set a default
    if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) {
       // cast var as int
       $currentpage = (int) $_GET['currentpage'];
    } else {
       // default page num
       $currentpage = 1;
    } // end if
    
    // if current page is greater than total pages...
    if ($currentpage > $totalpages) {
       // set current page to last page
       $currentpage = $totalpages;
    } // end if
    // if current page is less than first page...
    if ($currentpage < 1) {
       // set current page to first page
       $currentpage = 1;
    } // end if
    
    // the offset of the list, based on current page 
    $offset = ($currentpage - 1) * $rowsperpage;
    
    // get the info from the db 
    $sql = "SELECT  BigImage, Thumbnail, Link, Name, Description, Price FROM table WHERE Type='Movie' ORDER BY ProductID DESC LIMIT $offset, $rowsperpage";
    $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR);
    
    define ("NUMCOLS", 1);
    
    
    $res = mysql_query("SELECT BigImage, Thumbnail, Link, Name, Description, Price FROM gobble WHERE Type='Movie' ORDER BY ProductID DESC");
    
    
    $count = 0;
    
    echo "<table cellpadding='10'>";
    
    while ($list = mysql_fetch_assoc($result)) 
    
    {
    
    
    
        if ($count % NUMCOLS == 0) echo "<tr>\n";  # new row
    
    
    
         echo "<td><a href='". $list['Link'] . "' rel='nofollow' title='" . $list['Name'] . "' target='_blank'>
    <span class='floatleft'><img src=" . $list['BigImage'] . " alt='" . $list['Name'] . "' border='0' /><br />
    <font face='arial' size='1'>" . $list['Name'] . "</a><br />" . $list['Description'] . "</font></span></td>\n"; 
         $count++;
    
    
    
        if ($count % NUMCOLS == 0) echo "</tr>\n";  # end row
    
    }
    
    
    
    # end row if not already ended
    
    
    
    if ($count % NUMCOLS != 0) {
    
       while ($count++ % NUMCOLS) echo "<td> </td>";
    
       echo "</tr>\n";
    
    }
    
    echo "</table>";
    
    
    /******  build the pagination links ******/
    // range of num links to show
    $range = 4;
    
    // if not on page 1, don't show back links
    if ($currentpage > 1) {
       // show << link to go back to page 1
       echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=1'><<</a> ";
       // get previous page num
       $prevpage = $currentpage - 1;
       // show < link to go back to 1 page
       echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'><</a> ";
    } // end if 
    
    // loop to show links to range of pages around current page
    for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) {
       // if it's a valid page number...
       if (($x > 0) && ($x <= $totalpages)) {
          // if we're on current page...
          if ($x == $currentpage) {
             // 'highlight' it but don't make a link
             echo " [<b>$x</b>] ";
          // if not current page...
          } else {
             // make it a link
     echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> ";
          } // end else
       } // end if 
    } // end for
    
    // if not on last page, show forward and last page links	
    if ($currentpage != $totalpages) {
       // get next page
       $nextpage = $currentpage + 1;
        // echo forward link for next page 
       echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage'>></a> ";
       // echo forward link for lastpage
       echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages'>>></a> ";
    } // end if
    /****** end build pagination links ******/
    ?>
    

  4. I need to add a function to a php script that calls on a mysql database and displays product images from a datafeed on a web page.

     

    I have a variety of image sizes. For example, one image is 400 x 212. When I display it I want it to be a maximum width of 250, then I want the height to be whatever it needs to be to keep it in a similar proportion to the original.

     

    Can someone tell me how I would write that into my php script?

     

    Thanks.

     

  5. I developed a site that uses 4 php include files (header, footer, leftside, rightside)

     

    What I want to be able to do is to have the right side column read from the

    header file the topic the page is about and then run a query to display

    results.

     

    For example, say I set a variable on each individual page that is the

    topic of the page - like "cats"

     

    My right side include should put the word cats into it's query so that

    I can display discounts for cat products.

     

    Please let me know if I need to provide other information. Because I don't

    have experience declaring a variable, I need to know exact code and where

    on the page it would need to be.

     

    My guess is that I could declare the title as a variable, but it would have so many

    words in it that I wouldn't know how to effective use it.

     

    Thanks.

  6. I am using this mysql code on a php webpage:

     

    ...WHERE Name LIKE '%hello kitty%' ORDER BY Category

     

    What I want to know is this:

     

    The field category - is there a way to specify the order in which you want the categories to show up?

    Right now, all I know how to do is to alphabetize them ASC or DESC. I would like to be able to

    choose the categories display order without it being alphabetized.

     

    Thanks.

     

  7. How do I set up a redirect?  I have some pages on my site that have two pages with essentially the same stuff on it.

    I really should do a redirect on one of them. If people have bookmarked that url, will the redirect to the other page work without any harm?

     

    I also have some html pages that I'd like to redirect to .php extensions.  I don't want to suffer any Google penalties for it though.

     

    Does anyone feel confident in directing me?

     

    Thanks!

  8. would you mind taking a look at the rest of the call. I think my quotes are wrong there too.

     

    echo "<td><a href='". $list['Link'] . "' rel='nofollow' title='" . $list['Name'] . "' target='_blank'>
    <span class='floatleft'><img src=" . $list['BigImage'] . " alt='" . $list['Name'] . "' border='0' /><br />
    <font face='arial' size='1'>" . $list['Name'] . "</a><br />" . $list['Description'] . "<br />Price: $" . $list['Price'] . "</font></span></td>\n"; 

  9. <span class='floatleft'><img src=" . $list['BigImage'] . " alt= 'Girly Checks - ". $list['Name'] . "'  border='0' /><br />

     

    I can't figure out how I can get the alt tag to read girly checks and then the name of the item.

     

    Can anyone help?  I've tried all kinds of variations with the " and the ', but I don't understand the rules that

    govern their usage.

     

    Thanks.  ;)

  10. Can one of you experts tell me if this script would be difficult to write?  Perhaps you can tell me

    how much you might charge to do this:

     

    The present data in my database will be referred to as file 1.

    The new data is the file we get from an outside source is referred to as file 2.

     

    These are the things that need to be done with the new data.

     

    1. Replace YOURUSERID with (my#)  in file #2 only.

    2. Compare file 1 ProductID #'s with file 2 ProductID #'s.

    3. If there is no ProductID matching in file 1, then add the product to the database and record the number somewhere

    so I can receive this number through email. That way, I'll know which where the new products added and I can go in

    and check their structure and see if the manufacturer made mistakes - which they do all the time.

    4. If there is a matching ProductID #, then update the price field.

    5. If there are ProductID #'s in File 1, that are not in File 2 anymore, that means they have been deleted so they need

    to be deleted from file 1 and recorded somewhere so I can see a list of what's been deleted.

    6. The email I need generated should have a list of 1) productID#'s that have been deleted and 2) productID#'s that have

    been added.

     

  11. Hi,

     

    I am barely functional with php. I know just enough to get by. 

     

    Are you saying that I set a variable in each script? If so, I need an example because of my lack of knowledge.

     

    In the script I am using over and over,  This is what determines the columns:  define ("NUMCOLS", 3);

     

    If there is just one script running on the page, all I do is change the number and that will change the column numbers, but not when several are running on the page.

     

    Here are the names of the scripts I just separated out:

     

    ../php/hummingbird-checks1.php

    ../php/hummingbird-col.php

    ../php/hummingbird-calendars.php

     

    Two of them are in the same area so I can call on them like this:

     

     

    <?php

     

    include('../php/hummingbird-calendars.php');

    include('../php/hummingbird-col.php');

     

    ?>

     

    Now if I follow your first layout would the new call look like this?

    This would have 2 columns:

     

    <?php

    $col_num_var = 2;

    include('../php/hummingbird-checks1.php');

    ?>

     

    Then lower in the page, these would have 4 columns:

     

    <?php

    $col_num_var = 4;

    include('../php/hummingbird-calendars.php');

    $col_num_var = 4;

    include('../php/hummingbird-col.php');

    ?>

     

    Is that the right logic? Even though my original call on columns looks like this: 

     

    define ("NUMCOLS", 3);

     

    Thank you for your help.

     

     

     

     

     

     

     

     

  12. I'm running actually three different php scripts on one page. Everything works as far as display products,

    but what happens is that you can designate the number of columns that the products display on each

    individual script. So theoretically I should be able to show products in one table and select say 2 columns

    wide and then use another script for another table and indicate a different column number.

     

    The poor result is that the first declaration of the number of columns is what is shown in all three areas

    where the script runs. It seems to inherit the call from the first script to the next script.  Is there any way

    to stop this from happening?

     

    I thought that if I enclosed the script within a table that would stop it, but it doesn't.

     

    Any help would be appreciated.

     

    Thanks,

     

  13. I have two scripts that each work fine by themselves. One is a search script with a variable that depends on what people search for. That will display results, but they are in a single column. I want to be able to paginate the results and have 4 columns across. I have a script that will do the pagination and it works by itself.  What I want is the search results to be displayed in the 4 columns across with the pagination.  I'm not familiar enough with programming to merge these two.  Can anyone help me out? 

     

    Script 1 is the search form.

     

    <?php
    
    include 'myconnectinfo.php';
    
    
      $cxn = mysql_connect($host,$user,$password)
             or die ("couldn't connect to server");
      mysql_select_db($database);
    //  $database = "mydatabase_name";
    
      $keyword= $_POST['keyword'];
      $upperKeyword = strtoupper($keyword);    
       
      $query = "(SELECT * FROM cjstores WHERE upper(NAME) like '%$upperKeyword%' ORDER BY NAME)";
         $result = mysql_query($query)
                or die ("Couldn't execute query.");
      if(! $result){
      $message = "no results";
    }
      $message = "Sorry, no matching results.";
      $found = mysql_num_rows($result);
      if($found == 0){
       echo "No products were found with that name. Please try another name.";
      }
    
    /* Display results in a table */
         echo "<table cellspacing='10'>";
      echo "<tr><td colspan='3'><hr /></td></tr>";
      while($row = mysql_fetch_assoc($result))
      {
         extract($row);
         echo "<TABLE cellpadding='10' width='40%'><tr>\n
                <td width='200'><img src='$IMAGEURL' border ='0' alt='$NAME'><br clear='all'><P><font size='2'>
                <a href='$BUYURL'>$NAME</a></td>\n
                <td width='100'></td>\n
                           </tr>\n";
         echo "<tr><td colspan='2'><hr /></td></tr>\n";
      }
      echo "</table>\n";
    
    ?>
    

    SCRIPT 2 displays based on my sql query - I want this to be base on the user input?

    <?php
    
    include('myconnectinfo.php');
    
      $database = "giftidea_gifts";
    
      $cxn = mysql_connect($host,$user,$password)
    
             or die ("couldn't connect to server");
    
      mysql_select_db($database);
    $conn = mysql_connect('localhost','user','pass') or trigger_error("SQL", E_USER_ERROR);   
    $db = mysql_select_db('databasename',$conn) or trigger_error("SQL", E_USER_ERROR);
    
    // find out how many rows are in the table 
    $sql = "SELECT COUNT(*) FROM cjstores WHERE ADVERTISERCATEGORY LIKE '%Necklaces & Pendants%'";
    $result = mysql_query($sql, $cxn) or trigger_error("SQL", E_USER_ERROR);
    $r = mysql_fetch_row($result);
    $numrows = $r[0];
    
    // number of rows to show per page
    $rowsperpage = 4;
    // find out total pages
    $totalpages = ceil($numrows / $rowsperpage);
    
    // get the current page or set a default
    if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) {
       // cast var as int
       $currentpage = (int) $_GET['currentpage'];
    } else {
       // default page num
       $currentpage = 1;
    } // end if
    
    // if current page is greater than total pages...
    if ($currentpage > $totalpages) {
       // set current page to last page
       $currentpage = $totalpages;
    } // end if
    // if current page is less than first page...
    if ($currentpage < 1) {
       // set current page to first page
       $currentpage = 1;
    } // end if
    
    // the offset of the list, based on current page 
    $offset = ($currentpage - 1) * $rowsperpage;
    
    // get the info from the db 
    $sql = "SELECT BUYURL, IMAGEURL, NAME, DESCRIPTION FROM cjstores WHERE ADVERTISERCATEGORY LIKE '%Necklaces & Pendants%' LIMIT $offset, $rowsperpage";
    $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR);
    
    define ("NUMCOLS", 4);
    
    
    $res = mysql_query("SELECT BUYURL, IMAGEURL, NAME, DESCRIPTION FROM cjstores WHERE ADVERTISERCATEGORY LIKE '%Necklaces & Pendants%'");
    
    
    $count = 0;
    
    
    
    echo "<table class='mytable' width='60%' cellpadding='0' cellspacing='0'>";
    
    while ($list = mysql_fetch_assoc($result)) 
    
    {
    
    
    
        if ($count % NUMCOLS == 0) echo "<tr>\n";  # new row
    
    
    
        echo " <td align='center' valign='top' class='mytable'><a href=". $list['BUYURL'] . " class='mypage'><img src=" . $list['IMAGEURL'] . " border='0' alt='NAME'><br><font face='arial' size='1'>" . $list['NAME'] . "</a><br><table><tr><td><font size='1'></td><tr></table></td>"; 
    
        $count++;
    
    
    
        if ($count % NUMCOLS == 0) echo "</tr>\n";  # end row
    
    }
    
    
    
    # end row if not already ended
    
    
    
    if ($count % NUMCOLS != 0) {
    
       while ($count++ % NUMCOLS) echo "<td> </td>";
    
       echo "</tr>\n";
    
    }
    
    echo "</table>";
    
    
    /******  build the pagination links ******/
    // range of num links to show
    $range = 4;
    
    // if not on page 1, don't show back links
    if ($currentpage > 1) {
       // show << link to go back to page 1
       echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=1'><<</a> ";
       // get previous page num
       $prevpage = $currentpage - 1;
       // show < link to go back to 1 page
       echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'><</a> ";
    } // end if 
    
    // loop to show links to range of pages around current page
    for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) {
       // if it's a valid page number...
       if (($x > 0) && ($x <= $totalpages)) {
          // if we're on current page...
          if ($x == $currentpage) {
             // 'highlight' it but don't make a link
             echo " [<b>$x</b>] ";
          // if not current page...
          } else {
             // make it a link
     echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> ";
          } // end else
       } // end if 
    } // end for
    
    // if not on last page, show forward and last page links	
    if ($currentpage != $totalpages) {
       // get next page
       $nextpage = $currentpage + 1;
        // echo forward link for next page 
       echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage'>></a> ";
       // echo forward link for lastpage
       echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages'>>></a> ";
    } // end if
    /****** end build pagination links ******/
    ?>
    
    
    

     

    Thank you,

  14. I want to update hundreds of records each being unique.

     

    UPDATE table SET  Custom3='10' WHERE ProductID='459969168'

     

    Each will have a different custom3 name and a different product number.

     

    How would I do this for hundreds of updates at once?

     

  15. I have an email form at http://www.spiritofvolunteerism.com/forms.html that inserts the user input into a database and sends the website owner an email with the submitted information.

     

    It works fine, but I don't know how to make fields required.

     

    I'm using a php script to insert the data into the database and process the information.

     

    Part of the PHP script:

     

      $query = "INSERT INTO contacts (first_name, last_name, email, phone, fax, address, city, state, zipcode, country, sponsorship, authorization, comments) " .
        "VALUES ('$first_name', '$last_name', '$email', '$phone', '$fax', '$address', '$city', '$state', '$zipcode', '$country', '$sponsorship', '$authorization', '$comments')";
    
      $result = mysql_query($query)
        or die('Error querying database.');
    
    
      mysql_close($cxn);
    
    
      $to = 'nobody@norealaddress.here';
      $subject = 'Form Results From Spirit of Volunteerism';
      $msg = "Contact From: The Spirit of Volunteerism website. \n".
         "\n".
         "Contact Information: \n".
     "\n".
     "Name:            $first_name $last_name \n".
     "Address:         $address \n".
     "City, State Zip: $city, $state  $zipcode \n".
     "Country:         $country \n".
     "\n".
     "Email:           $email \n".
     "Phone:           $phone \n".
     "Fax:             $fax \n".
     "\n".
     "Sponsorship Level: $sponsorship \n".
     "\n".
     "Authorization:     $authorization \n".
     "\n".
     "Comments:          $comments";
    
      mail($to, $subject, $msg, 'From:' . $email);

     

    Part of the html form that doesn't work:

     

    <tr>
        <td align="right"><label for="first_name" class="required">First Name:</label></td><td> <input
        type="text" name="first_name" / size="20"><br />
        </td>
      </tr>

     

    I've tried that, but the form goes through anyway.

     

    What else to I need to do to my script to make the fields required?  Thanks in advance.

     

    (edited by kenrbnsn to remove real email address)

  16. This is what I've tried.  This actually produces pagination at the bottom of the page and the three columns, but it displays all of the products instead of limiting them to say 9 or whatever.

     

    If you could help me get this script working, I'd be very appreciative. 

     

    <?php

     

     

    // Number of records to show per page:

    $display_number = 15;

     

    // Connect to MySQL:

     

      include('../misc.inc');

      $database = "voipvide_checks";

      $cxn = mysql_connect($host,$user,$password)

            or die ("couldn't connect to server");

      mysql_select_db($database);

     

    // Determine how many records there are:

    if (isset($_GET['np'])) {

     

    $num_pages = (int) $_GET['np'];

     

    } else {

     

    // Find out how many records there are.

    $q = "SELECT COUNT(*) FROM trendy WHERE PRICE > 10 AND PRICE < 50";

     

    // Get the number.

    $r = mysql_query($q);

    list($num_records) = mysql_fetch_array($r, MYSQL_NUM);

    mysql_free_result($r);

     

    // Calculate the number of pages:

    if ($num_records > $display_number) {

    $num_pages = ceil ($num_records/$display_number);

    } else {

    $num_pages = 1;

    }

     

    }

     

    // Determine where in the database to start returning results:

    if (isset($_GET['s'])) {

    $start = (int) $_GET['s'];

    } else {

    $start = 0;

    }

     

     

     

    //Defined 3 columns:

     

    define ("NUMCOLS", 3);

     

    $q = mysql_query("SELECT Thumbnail, Link, Name, Price FROM trendy WHERE PRICE > 10 AND PRICE < 50 ORDER BY Price");

    $start = $_GET['page'];

    if(!is_numeric($start) || $start <= 0) {

    $start = 0;

    }

     

     

    $count = 0;

    echo "<center><TABLE border=0 cellpadding='10'>";

    while (list($Thumbnail, $Link, $Name, $Price) = mysql_fetch_row($q))

    {

     

        if ($count % NUMCOLS == 0) echo "<TR>\n";  # new row

     

        echo "<TD width='150' valign='top'><a href='$Link'><img src='$Thumbnail' border='0'>'$Name'[/url]

        \$$Price</TD>\n";

        $count++;

     

        if ($count % NUMCOLS == 0) echo "</TR>\n";  # end row

    }

     

    # end row if not already ended

     

    if ($count % NUMCOLS != 0) {

      while ($count++ % NUMCOLS) echo "<td> </td>";

      echo "</TR>\n";

    }

    echo "</TABLE>";

     

     

    // Clean up:

    mysql_close($cxn);

     

    // Make the links to other pages, if necessary:

    if ($num_pages > 1) {

     

    echo '<hr width="50%" align="center" />';

     

    // Determine what page the script is on:

    $current_page = ($start/$display_number) + 1;

     

    // If it's not the first page, make a Previous button:

    if ($current_page != 1) {

    echo '<center><a href="paginationtrendy1.php?s=' . ($start - $display_number) . '&np=' . $num_pages . '"> Previous</a>';

    }

     

    // Make all the numbered pages:

    for ($i = 1; $i <= $num_pages; $i++) {

     

    // Don't link the current page:

    if ($i != $current_page) {

    echo '<a href="paginationtrendy1.php?s=' . (($display_number * ($i - 1))) . '&np=' . $num_pages . '">' . $i . '</a> ';

    } else {

    echo $i . ' ';

    }

     

    }

     

    // If it's not the last page, make a Next button:

    if ($current_page != $num_pages) {

    echo '<a href="paginationtrendy1.php?s=' . ($start + $display_number) . '&np=' . $num_pages . '"> Next</a> ';

    }

     

    }

     

    ?>

  17. I'm trying to use this as a template for pagination.  I got it working for one product line, but then as I tried another and replaced the variables, the pagination failed to produce a viewable page to click to. It numbers all the pages and counts the records, it just doesn't create the page.  Any clues??? ???

     

     

     

    <?php

     

     

    // Number of records to show per page:

    $display_number = 3;

     

    // Connect to MySQL:

     

      include('../misc.inc');

      $database = "voipvide_checks";

      $cxn = mysql_connect($host,$user,$password)

            or die ("couldn't connect to server");

      mysql_select_db($database);

     

    // Determine how many records there are:

    if (isset($_GET['np'])) {

     

    $num_pages = (int) $_GET['np'];

     

    } else {

     

    // Find out how many records there are.

    $q = "SELECT COUNT(*) FROM trendy";

     

    // Get the number.

    $r = mysql_query($q);

    list($num_records) = mysql_fetch_array($r, MYSQL_NUM);

    mysql_free_result($r);

     

    // Calculate the number of pages:

    if ($num_records > $display_number) {

    $num_pages = ceil ($num_records/$display_number);

    } else {

    $num_pages = 1;

    }

     

    }

     

    // Determine where in the database to start returning results:

    if (isset($_GET['s'])) {

    $start = (int) $_GET['s'];

    } else {

    $start = 0;

    }

     

    // Define the query:

    $q = "SELECT * FROM trendy ORDER BY Price ASC LIMIT $start, $display_number";

     

    // Run the query:

    $r = mysql_query ($q);

     

    // Display all of the records:

      $max_columns = 3;

    while ($row = @mysql_fetch_array ($r, MYSQL_ASSOC)) {

      echo "

     

     

    <table width='600'>

    <tr>

     

    <td colspan='2' bgcolor='#FFFFFF'><B><font face='Arial' size='2'><a href='{$row['Link']}'>{$row['Name']}</B></a> - \${$row['Price']}</font>

      </td>

    </tr>

    <tr>

      <td width='400' valign='left'><P><a href='{$row['Link']}'>

        <font face='Arial' size='2'><img border='0' src='{$row['Thumbnail']}'></a><P><font face='Arial' size='2'>

      </font></td>

     

    </tr>

     

    </table>\n";

      }

     

    // Clean up:

    mysql_close($cxn);

     

    // Make the links to other pages, if necessary:

    if ($num_pages > 1) {

     

    echo '<hr width="50%" align="center" />';

     

    // Determine what page the script is on:

    $current_page = ($start/$display_number) + 1;

     

    // If it's not the first page, make a Previous button:

    if ($current_page != 1) {

    echo '<center><a href="paginationtrendy.php?s=' . ($start - $display_number) . '&np=' . $num_pages . '"> Previous</a>';

    }

     

    // Make all the numbered pages:

    for ($i = 1; $i <= $num_pages; $i++) {

     

    // Don't link the current page:

    if ($i != $current_page) {

    echo '<a href="paginationtrendy?s=' . (($display_number * ($i - 1))) . '&np=' . $num_pages . '">' . $i . '</a> ';

    } else {

    echo $i . ' ';

    }

     

    }

     

    // If it's not the last page, make a Next button:

    if ($current_page != $num_pages) {

    echo '<a href="paginationtrendy?s=' . ($start + $display_number) . '&np=' . $num_pages . '"> Next</a> ';

    }

     

    }

     

    ?>

×
×
  • 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.