Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

PHP/MSQL Programming Part2

kokkie123

Novice
Advanced Member
Messages
27
Reaction score
0
Points
26
PART 2 OF PHP/MYSQL PROGRAMMING
CREATING DATABASE

siguro alam na din ninyo gumawa ng database..
Sa Access gumawa na din kayo or sa MSsQL, Oracle and any other DBMS...
ang gagamitin natin dito ay napaka obvious sympre PHP using PhpMyadmin and MySQL script....


So...Start tayo sa phpmyadmin...naka gawa na tayo ng DB..next step ay gumawa ng ROW/COLUMNS...

Meron tayong four Fields in your table from the previous section. Although they are set out in rows in the images, the rows are actually the Columns you saw earlier – the Fields. Each Field needs a name. So go ahead and type the following for your Field names:


mysql9.jpg



So we have given each column in our table a name: ID, First_Name, Surname, and Address. The next thing to set is what type of data will be going in to each field - do you want to store text in this field, numbers, Yes/No value, etc?

ID
A number, used just to identify each record. This needs to be unique for each record
First_Name VARCHAR
SurnameVARCHAR
AddressTINYTEXT


For our fields, then, we'll use the following Types:

ID -SMALLINT
First_Name -VARCHAR
Surname -VARCHAR
Address -TINYTEXT


So select these from your Types drop down list:

mysql11a.jpg


We've only set Lengths for the VARCHAR TYPES. If you leave it blank for VARCHAR, you'll get a default value of 1 character.

The other Field settings we'll take a look at are these:


mysql12.jpg


Null
This is an important field in database terminology. It essentially means, "Should the field contain anything?" If you set a field to NOT NULL, then you can't leave it blank when you come to adding records to your database. Otherwise you'll get errors.

Default
Do you want to add anything to the field, just in case it's left blank when adding a record? If so, type it in here.

Extra

This is where you can set an auto increment value. This means adding one to the previous record number. This is ideal for us, as we have an ID field. Then we don't have to worry about this field. MySQL will take care of updating it for us.

mysql13.jpg


The three icons are Primary Key, Index, and Unique. Primary keys are not terribly important for flat-file databases like ours. But they are important when you have more than one table, and want to link information. They are set to unique values, like our ID field. An index is useful for sorting information in your tables, as they speed things up. Unique is useful for those fields when there can't be any duplicate values.

So, set a primary key for the ID field by selecting the radio button, and choose Auto Increment from the Extra drop down list:

mysql14.jpg


Your field screen then, minus the parts we've ignored, should look like this:
mysql15.jpg


Click the Save button on the fields screen. You'll be taken back to the Structure screen. There should be a lot more information there now. Don't worry if it looks a bit confusing. All we want to do is to add one record to the table. We'll then use PHP code to add some more.

PART I: http://www.symbianize.com/showthread.php?t=323502

-----------------------------------------
END OF PART II
big credits to: homeandlearn:praise:
 
Last edited:
CREATE TWO TABLES NAMELY PRODUCT AND ORDER
PRODUCT FIELDS ARE PRODID, PRODNAME AND PRICE
ORDER FIELDS ARE OID, ORDATE, PRODID
CREATE THE FORM THAT WILL INSERT ORDERED PRODUCT
CREATE THE TABLE THAT WILL VIEW ALL ORDERED PRODUCTS


sir paano po ba gawint o
 
CREATE TWO TABLES NAMELY PRODUCT AND ORDER
PRODUCT FIELDS ARE PRODID, PRODNAME AND PRICE
ORDER FIELDS ARE OID, ORDATE, PRODID
CREATE THE FORM THAT WILL INSERT ORDERED PRODUCT
CREATE THE TABLE THAT WILL VIEW ALL ORDERED PRODUCTS


sir paano po ba gawint o

Google lang bro.. there are lots of resources out there for what you want to do.
 
TS ngayon ko lang ito nabasa kasi kailangan sa work pero salamat! May mga iba ka pa bang tuts jan? Hehe
 
kuya nu gamit mo na database??prang mas madali kesa sa wamp ah?
 
sir pede po patulong pano po magconnect ng php to ms sql server 2008 sir gmit ko po iis7 + php + ms sql server 2008
 
bro kaya mo na bang mag-data manipulations? like mga joins at complicated na queryings sa sql ... post ka naman ng mga mas advance tutorials :thumbsup:
 
sir pede po patulong pano po magconnect ng php to ms sql server 2008 sir gmit ko po iis7 + php + ms sql server 2008

brad kung problema mo ay php ... recommend ko sa iyo gumamit ka ng xampp server (w/ apache, mysql server package) un kasi ang partner talaga ng php

ngayon kung ms sql server gamit mo for database i partner mo diyan ay asp.net ... lagi magkakapartner yan bro

take note:

PHP for mySQL (open source)
ASP.NET for MS SQL (proprietary)
 
Back
Top Bottom