nead help creating a table / list with info from a msql database

hello every one,
today i’m trying to create a type of interface like in the picture,
and where i’m stuck at is for the yellow squares cause basically each yellow square will correspond to a line in the mysql Data base
so it will fetch the name of the product, a picture of the product and it’s price from the data base ( all taht info on a same line)
but i don’t know how to precede for the coding

may i just add that i would also like the interface to update as add products (every so often and when query the data base)

any help will be much appreciated and if you need any more info just ask

my plan was that when we click on the button (yellow icon) it adds it to a type of basket while it waiting to be brought (the basket will be a list to the right of the buttons)


Hi Glenn,

Would you not be better using a framework that is already set up rather starting to code from scratch? Oscommerce is a good one and there is a huge support community. You need to however understand the basics of php/mysql to get by.

Another good one if your coding experience is limited (don’t take that the wrong way) is wordpress with woocommerce installed.

Writing it all from scratch is extremely time consuming especially if you are not familiar with php/mysql - (I am speaking from my own personal experience!!!).

If you insist on going down the route of coding yourself I use the following code to list values of my MySQL database (some of the PHP senior members will better my code);-

Create a database connection (called “db-connect.php”)
[php]<?php
// edit the below four lines with your database details
define(‘DB_SERVER’, ‘YOUR SERVER NAME’);
define(‘DB_USERNAME’, ‘YOUR DATABASE USERNAME’);
define(‘DB_PASSWORD’, ‘PASSWORD’);
define(‘DB_DATABASE’, ‘DATABASE NAME’);
$db = mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE);
?>[/php]

then a page called “index.php”;-
[php]

	                </tr>
	              </thead>
	              <tbody>
<?php include('db-connect.php'); if (mysqli_connect_errno($db)) { trigger_error('Database connection failed: ' . mysqli_connect_error(), E_USER_ERROR); } // you need to alter the database table below $query = "SELECT * FROM `**YOUR DATABASE TABLE NAME**`"; $result = mysqli_query($db, $query) or trigger_error("Query Failed! SQL: $query - Error: ". mysqli_error($db), E_USER_ERROR); if($result) { while($row = mysqli_fetch_assoc($result)) { echo ''; echo ''; echo ''; echo ''; echo ''; } } mysqli_close($db); ?>
			      </tbody>
            </table>
[/php]

This assumes your MySQL table has columns called id, product name, price, stock. You would need to replace these values with yours along with the database details.

I hope this helps…

id product name price stock
'.$row['id'] . ''.$row['product name'] . ''.$row['price'] . ''.$row['stock'] . '

many thanks for the answer that’s what i was thinking of doing but i wasn’t sure if it would generate the button like i wanted

what i forgot to add if the fact that this interface will is going to be used on a point of sale (like in the super market), but i was unable to find one :frowning: so i thought that it might be easier to create on myself

the way i was planning on creating the web site was to first create the point of sale interface and the data bases then create the admin panel that would control every thing

I’ve just done a quick search and there are a few out there but these are for the store staff to operate and I’m assuming the customer will click the images and checkout?

These are the ones I found;- https://unicenta.com/ & http://keyhut.com/pos.htm

no they will be operated by staff only
what i was planing is when you press one of the buttons (products) it will get added to a list (that would be to the right of the buttons), you would then click on sell and select the client (cause there two different prices depending on the types of client) and it would do it’s stuff with the data bases

What will this being running off of, hardware wise? There are plenty of POS systems available including and not including hardware. You would need this to be an internal system as well, as in not actually web accessible.

I have done a POS system in c#, but not php.

here is the hard ware that it will be running from windows 7 pro will more add likely be installed on it
http://www.ldlc.com/b-842b45d0ddb87490.html

i dessided to do it in php cause i thought that it might be easier (and it’s one of the only codes that i know), the other reason is cause the POS system had to be free and i was hopeing for it to have an interface like the one in the picture

i liked the look of unicenta but is was unable to do the differed price depending on the costumer cause there are two different types of client one with reduced prices and the other not

Sponsor our Newsletter | Privacy Policy | Terms of Service