1.

Solve : php - mysql script?

Answer» HEJ All

I am rather new to PHP and MySQL. I got task I do not know how to accomplish, therefore I hope you can help

I was asked to prepare few "chosing" fields which will be taking data from MySQL database with button add records.

Actually I have no clue how to start so I really hope you can help.

Here is what fields are needed:

Country
Town
School

from school new windog have to be open and class name should be listed.

In this sence, first we have to choose Country.
Country will be related for example when choosing USA, we will have LIST wit towns: NY, Chicago.....
town will be connected to school, unfortunatelly we have to remember that some schools are named:
school nr.1
school nr.2
that same names in different towns.

We also need buttom Add in that sence is easy to add records as countries, towns,schools, students


Please help to accomplish that task. I am new to PHP and MySQl, but I have to accomplish that task. If possible please DESCRIBE code in ..."more simple way"... so it make it easier to understand for beginners

Please help.

Many thanks in advance.

BR
Michal


First you need to create the database...

IN MYSQL:
Code: [Select]CREATE DATABASE db_name
Then Create the table...

IN MYSQL:
Code: [Select]CREATE TABLE table_name
(
School varchar(255),
Town varchar(255),
Country varchar(255),
)
Then you would use PHP to connect to the database.

IN PHP:
Code: [Select]<?php
$con = mysql_connect("localhost","username","password");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
?&GT;
I would need more detailed info to take this further... Also, after re-reading your question it looks like you might need to make three tables (Country, Town, School) and use the options for those as fields.



Discussion

No Comment Found