SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 42 of 42
  1. #26
    SitePoint Evangelist
    Join Date
    May 2005
    Location
    Houston, Texas, USA
    Posts
    418
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Chillijam
    OK, back to basics. Is there any programatic link between the two tables? eg - does your "Clay" table contain a reference to the id of the image, or are you relying on blind luck to get the right image?

    Right now, I'm only working with one table. Either Clay or Cake. The ID field is just a number for the product shown. It doesn't need to have any specific meaning. If no one can spamm or do anything detrimental, I can post the username and password for phpmyadmin
    Opportunity favors the prepared mind.

  2. #27
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,015
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by Chri
    I don't see an execute command in phpmyadmin
    paste the SHOW command into the SQL window and push the Go button
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #28
    SitePoint Evangelist
    Join Date
    May 2004
    Location
    New Jersey, USA
    Posts
    567
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Chri
    If no one can spamm or do anything detrimental, I can post the username and password for phpmyadmin
    DON'T DO THAT!!!
    Austin Hastings - Principal Consultant - Longacre, Inc.

    Anything you can do, you can do better.

  4. #29
    SitePoint Evangelist
    Join Date
    May 2004
    Location
    New Jersey, USA
    Posts
    567
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When you work with phpMyAdmin, you start by logging in.

    Then, on the first screen there's a way to select what database to use. (If your hosting provider only gives you one database, you might skip this step.) On the left-hand side is a pull-down listing the databases. Select the database containing this table.

    Once you've chosen a database, you'll see a series of tabs across the top of the right-hand panel. One of those tabs is labeled "SQL".

    Select the SQL tab, then type a SQL statement into the box and click on Go or Run or whatever it's called.

    SHOW CREATE TABLE cake (or clay, or whatever the name was)

    That should give you a description of table. If it doesn't work, try using

    DESCRIBE cake

    and see what that produces.

    =Austin
    Austin Hastings - Principal Consultant - Longacre, Inc.

    Anything you can do, you can do better.

  5. #30
    SitePoint Evangelist
    Join Date
    May 2005
    Location
    Houston, Texas, USA
    Posts
    418
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here it is

    SQL query:
    DESCRIBE Clay
    [ Edit ] [ Create PHP Code ]


    row(s) starting from record #
    in mode and repeat headers after cells

    Full Texts
    Field Type Null Key Default Extra
    MainPic varchar(150) YES NULL
    InsetPic varchar(150) YES NULL
    ID int(11) YES NULL
    Category text YES NULL
    Title text YES NULL
    Size text YES NULL
    Date text YES NULL
    Comments text YES NULL
    Blank text YES NULL
    Blank2 text YES NULL
    Blank3 text YES NULL
    PrimaryKey int(10) unsigned PRI NULL auto_increment
    Opportunity favors the prepared mind.

  6. #31
    SitePoint Evangelist
    Join Date
    May 2005
    Location
    Houston, Texas, USA
    Posts
    418
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I found this while trying to find a remedy:

    'When reading in physical sequential order, FirstRecord may not retrieve the first possible record position if records have been deleted and the space is currently unused.'

    I'm half sure this FirstRecord line is the culprit. But I don't know enough about this to know what it could change to
    Opportunity favors the prepared mind.

  7. #32
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,015
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    okay, that's good -- some of the datatypes are inappropriate (e.g. do you really need the category to be as large as 65K?) but the structure looks workable

    now, i wonder where the thumbnails come from?

    could you please run this query and show the results --
    Code:
    select MainPic
         , InsetPic 
         , ID
         , PrimaryKey
      from Clay
    order
        by PrimaryKey desc limit 7
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  8. #33
    SitePoint Evangelist
    Join Date
    May 2005
    Location
    Houston, Texas, USA
    Posts
    418
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the link that this relates to is http://bchoc.com/sh/Clay_view.php
    HTML Code:
      Full Texts  	  MainPic   	  InsetPic   	  ID   	  PrimaryKey
    	Edit 	Delete 	A3Cupcakes.jpg 	NULL 	       11 	7
    	Edit 	Delete 	Bz632SheptonStreet.jpg 	NULL 	10 	6
    	Edit 	Delete 	C1WideoWomanLeft.jpg 	NULL 	7 	5
    	Edit 	Delete 	E1LucysBlanket.jpg 	NULL 	3 	4
    	Edit 	Delete 	D484BentTreeDrive.jpg 	NULL 	1 	1
    Opportunity favors the prepared mind.

  9. #34
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,015
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    that's excellent

    what were you planning for InsetPic? i would've probably used that for the thumbnail name

    where are the thumbnail names, anyway?

    also, what role do ID and PrimaryKey play, apart or together -- are they related?
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  10. #35
    SitePoint Evangelist
    Join Date
    May 2005
    Location
    Houston, Texas, USA
    Posts
    418
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The thumbnail is not a separate file. It's just a resized version of the MainPic, as the earlier code shows--that bit about "FirstRecord". With me being a beginner, I thought it best to keep things "simple"

    ID and PrimaryKey aren't related at all. Either one could be used to order, but they work about the same (not very well for ordering!)

    The inset is just an optional pic in case it's needed.
    Opportunity favors the prepared mind.

  11. #36
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,015
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    well, that's interesting, the thumbnail image is actually the main image, and the ID and PrimaryKey values are unrelated

    i am completely at a loss to understand, then, how you could possibly get a thumbnail pointing at the wrong main image after one of the rows has been deleted

    i'm sorry to have sidetracked you, the problem has to be in your php code, not your use of the auto_increment
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  12. #37
    SitePoint Evangelist
    Join Date
    May 2005
    Location
    Houston, Texas, USA
    Posts
    418
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937
    well, that's interesting, the thumbnail image is actually the main image, and the ID and PrimaryKey values are unrelated

    i am completely at a loss to understand, then, how you could possibly get a thumbnail pointing at the wrong main image after one of the rows has been deleted

    i'm sorry to have sidetracked you, the problem has to be in your php code, not your use of the auto_increment
    Yes, they kicked me out of mysql forum, but I thought I had to use that field to order with. I think the problem is in that line with "FirstRecord". Is there any other term that could be used to call records in asc order? And also, sidetracked or not, your assistance is greatly appreciated.
    Opportunity favors the prepared mind.

  13. #38
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,015
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    i'm not a php programmer so i don't know what "FirstRecord" is

    if you want a particular sequence of results from mysql, use the ORDER BY clause of the SELECT statement

    are you even using a SELECT statement?
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  14. #39
    SitePoint Evangelist
    Join Date
    May 2005
    Location
    Houston, Texas, USA
    Posts
    418
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    @mysql_select_db($database) or die("Unable to select database");
    $result mysql_query("SELECT * FROM Clay ORDER BY PrimaryKey ASC")
    or die(
    mysql_error());

    $columns 5;

    $i 0;
    echo 
    "<table cellpadding='2'>\n";
    while(
    $row mysql_fetch_array$result )) {
        
    $pic $row['MainPic'];

        if ((
    $i $columns) == 0) { 
            echo 
    "  <tr>\n";
        }

        echo 
    "    <td><a href='./Clay_.php?FirstRecord={$row['PrimaryKey']}'><img src='./images/$pic' width='29' height='29'></a></td>\n";

        if ((
    $i $columns) == ($columns 1)) {
            echo 
    "  </tr>\n";
        } 
    Opportunity favors the prepared mind.

  15. #40
    SitePoint Evangelist
    Join Date
    May 2005
    Location
    Houston, Texas, USA
    Posts
    418
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ...
    PHP Code:
    @mysql_select_db($database) or die("Unable to select database");
    $result mysql_query("SELECT * FROM Clay ORDER BY PrimaryKey ASC")
    or die(
    mysql_error());

    $columns 5;

    $i 0;
    echo 
    "<table cellpadding='2'>\n";
    while(
    $row mysql_fetch_array$result )) {
        
    $pic $row['MainPic'];

        if ((
    $i $columns) == 0) { 
            echo 
    "  <tr>\n";
        }

        echo 
    "    <td><a href='./Clay_.php?FirstRecord={$row['PrimaryKey']}'><img src='./images/$pic' width='29' height='29'></a></td>\n";

        if ((
    $i $columns) == ($columns 1)) {
            echo 
    "  </tr>\n";
        } 
    Opportunity favors the prepared mind.

  16. #41
    SitePoint Evangelist
    Join Date
    May 2004
    Location
    New Jersey, USA
    Posts
    567
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Chri,

    Looking at your site, it seems you've got things displaying. Did the problem get worked out, or are you still having troubles?

    =Austin
    Austin Hastings - Principal Consultant - Longacre, Inc.

    Anything you can do, you can do better.

  17. #42
    SitePoint Evangelist
    Join Date
    May 2005
    Location
    Houston, Texas, USA
    Posts
    418
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, I just rigged it. Thanks for asking, though.
    Opportunity favors the prepared mind.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •