For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > June 2005 > PHP and MYSQL









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author PHP and MYSQL
Christo

2005-06-10, 3:56 pm

ok i know some basic php

I have done a bit of C++ and it seems very similar, basically what i want
is, someone or somewhere on the net that will give me a very clear guide to
the ways which i can take the contents of a form and then add those contents
into a database (mysql)

also how to construct the database (i have phpmyadmin) i really only want 4
fields in the database they are listed below...

Number
Name
Email Address
Location

and i just want to create a form interface that will add the contents of the
form into the database, for example

Name
Email Address
Location

I want the number to be incremented automatically in the database, so for
example say John Smith was to enter his information

John Smith
john@smith.com
England

his number (John Smith) would be 0001

then if Joe bloggs was to enter his details

Joe Bloggs
joe@bloggs.com
USA

joe bloggs number would be 0002

I want to then display these entries on a page, displaying them like this

0001 John Smith john@smith.com England
0002 Joe Bloggs joe@bloggs.com USA

I would really prefer only displaying about 250 entries per page, so say
there was 500 entries in the database, then I would prefer a button at the
bottom of the first page of 250 names etc that gives the user the option to
go to page 2, or links along the top

<< 1 | 2 | 3 | 4 >>

if you know what i mean.

does this system sound hard to create? I am a bit of a novice with PHP and
would appreciate any help i can get at all, I know the basics of programming
so I should be fine grasping any new concepts, its just getting the stuff
from the form into the database then from the database onto a page/pages

I must emphasize the need for splitting the list up into pages, I am
expecting at least 4000 entries, and having this amount on one page would be
crazy!

Thanks In Advance


--

Christo


Tony

2005-06-10, 8:55 pm

Christo wrote:
> ok i know some basic php
>
> I have done a bit of C++ and it seems very similar, basically what i
> want is, someone or somewhere on the net that will give me a very
> clear guide to the ways which i can take the contents of a form and
> then add those contents into a database (mysql)


How familiar are you with SQL in general?

If you know 'some basic php', as you say, then getting the data from a form
should be no problem. You will need to be able to create SQL queries to put
the data into the database. I believe MySQL has a tutorial on their website,
or check out w3schools.com

Once you have some grasp of that, then refer to the PHP manual on MySQL
functions at http://us3.php.net/manual/en/ref.mysql.php

Of particular note will be mysql_connect, mysql_select_db, and mysql_query.

The x number of entries per page is relatively easy, especially if you use
LIMIT in your SQL query - but concentrate on getting the input & output
first, then work on the formatting.

--
Tony Garcia
http://www.dslextreme.com/~tony23/


Christo

2005-06-11, 8:55 am

"Tony" <tony23.no@dslextreme.com.spam> wrote in message
news:11ajmq47h5nbl55@corp.supernews.com...
> Christo wrote:
>
> How familiar are you with SQL in general?
>
> If you know 'some basic php', as you say, then getting the data from a
> form should be no problem. You will need to be able to create SQL queries
> to put the data into the database. I believe MySQL has a tutorial on their
> website, or check out w3schools.com
>
> Once you have some grasp of that, then refer to the PHP manual on MySQL
> functions at http://us3.php.net/manual/en/ref.mysql.php
>
> Of particular note will be mysql_connect, mysql_select_db, and
> mysql_query.
>
> The x number of entries per page is relatively easy, especially if you use
> LIMIT in your SQL query - but concentrate on getting the input & output
> first, then work on the formatting.
>
> --
> Tony Garcia
> http://www.dslextreme.com/~tony23/
>
>


Thanks, it looks like I am going to have to get to know SQL before i begin
this, I will have a read on the web and perhaps pop down to the library, see
if they have any books on it.

Thanks for the advice, I know where to look now, cheers.

Christo


Dan M

2005-06-11, 3:55 pm

> Thanks, it looks like I am going to have to get to know SQL before i begin
> this, I will have a read on the web and perhaps pop down to the library, see
> if they have any books on it.
>
> Thanks for the advice, I know where to look now, cheers.


w3schools.com also has a good tutorial on SQL. I highly recommend them.
Dan M

2005-06-11, 3:55 pm

> I want the number to be incremented automatically in the database, so for
> example say John Smith was to enter his information


This requirement is simple - define the field as "AUTOINCREMENT".

> I would really prefer only displaying about 250 entries per page, so say
> there was 500 entries in the database, then I would prefer a button at the
> bottom of the first page of 250 names etc that gives the user the option to
> go to page 2, or links along the top


This can be handled using MySQL's "LIMIT" clause.

> does this system sound hard to create? I am a bit of a novice with PHP and
> would appreciate any help i can get at all, I know the basics of programming
> so I should be fine grasping any new concepts, its just getting the stuff
> from the form into the database then from the database onto a page/pages


No, it actually sounds pretty easy. I'm a newcomer to PHP myself (I'm
making the transition to PHP after programming Perl for several years)
but fairly experienced with MySQL. Your description of this project
sounds pretty straightforwardd.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com