#native_company# #native_desc#
#native_cta#

PHP, MySQL and images Page 2

By William Samplonius
on July 30, 2000

OK, now that we all know the basics, its time to connect to the server. If you have any
problems email support, they like answering these questions.

shell> mysql -h localhost -u joesauto -p

Enter password: ********

Welcome to the MySQL monitor. Commands end with ; or g.

Your MySQL connection id is 459 to server version: 3.22.20a-log

Type 'help' for help.

mysql>


After successfully connecting to the server we need to access the database (joesauto)
that I got support to create for me. If you don’t have a database yet now is the time to
create one. To see what databases are on this server type show databases; if your database
is there select it by typing use joesauto if you can’t access the database contact
support. This tutorial could take days if your support is slow.

mysql> use joesauto

Database changed

mysql>

OK, after alot of reading
I figured out how to create a table for all the important data
(year, make, model, price and picture), the picture part took alot of time to figure
out, I found out that it was best to just store the picture filename in the database and
store the actual picture in a specified directory on my server. Below is what I used to
create the table. (I am sure there are other ways of creating this table but, this is
what worked for me.)

mysql> CREATE TABLE joesauto(

   -> year INT(4),

   -> make CHAR(20),

   -> model CHAR(20),

   -> price CHAR(15),

   -> picture_name CHAR(25)

   -> );