Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8179527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:01:10+00:00 2026-06-07T00:01:10+00:00

I am using PHP and MySQL (html and CSS aren’t the big deal) and

  • 0

I am using PHP and MySQL (html and CSS aren’t the big deal) and I want to collect images I uploaded (the paths are in MySQL) and put them in a table. Imagine a table of 5 columns and 6 rows (30 pictures in total). I want the newest picture to be in the first row of the first column — so left and at the top –, I want the oldest picture to be in the last row of the last column — so right and at the bottom –.

index.php

<?php
    //Put all required/included files in here
    require_once('config.php');

    //Connection to database
    $link = mysql_connect(DB_HOST,DB_USER,DB_PASS);
    if(!$link) {
        die('Connection failed: ' . mysql_error());
    }

    //Select which database to use
    $db = mysql_select_database(DB_NAME);

    if(!$db) {
        die("Database selection failed: " . mysql_error());
    }
?>

config.php

<?php
    define('DB_HOST','host');
    define('DB_USER','user');
    define('DB_PASS','pass');
    define('DB_NAME','name');
?>

Now, the SQL layout:

layout.sql

CREATE TABLE 'fotos'(
    id int not null,
    locatie_thumb text not null,
    locatie_middel text not null,
    locatie_groot text not null,
    primary key(id)
);

CREATE TABLE 'tekst'(
    id int not null auto_increment,
    titel text not null,
    bijschrift text not null,
    album text not null,
    datum DATE not null,
    primary key(id)
);

The idea behind the tables is that I upload a pic via the upload form, I enter the titel, bijschrift, album, datum values there and MySQL creates an ID. Then I want to use that ID to link the tekst and fotos together into the table.

How can I collect the 30 newest entries from MySQL and arrange them in a table of 5 columns and 6 rows when I want the newest picture to be left,top and the oldest to be right,bottom?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T00:01:11+00:00Added an answer on June 7, 2026 at 12:01 am

    Have your tried:

    SELECT *
    FROM fotos, tekst
    WHERE fotos.id=tekst.id
    ORDER BY tekst.datum DESC
    LIMIT 30
    

    If this is a 1-to-1 relationship, then why not put it all in the same table

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating my first site from scratch using PHP, MySQL, CSS, HTML, and
Web programmer here - using AJAX (HTML, CSS, JavaScript, AJAX, PHP, MySQL), but for
I've been coding a website for the past 6 months using HTML/CSS/PHP/MySQL/Javascript. I'm coding
I've got a simple website using plain HTML/CSS to display and PHP/MySQL for data
I wrote a web based program using PHP, HTML, CSS and MySQL database. I
I'm making my own website using html and php, and a database using mysql
Using PHP and MySQL, I want to select only 6 rows from table which
I need a simple code to upload images to mySQL using PHP... short! snippet...
I want to grab data from a mysql database by using php. The data
I'm currently working on a quote retrieval system for my employer's website using mysql/php/html.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.