Copy of 7raaj_book(Simple Project)

AA
by Abdallah Al-Afghani0 views·Updated Aug 16, 2014
Powered by AI

Need to present on this topic?

Create your own polished presentation in minutes. Just describe what you need.

Free to try, no credit card required

Transcript

FONTS

7raaj_book (simple project)

Connection to database

create database (wampserver)

here we connected the database in wampserver with netbeans through phpcode and java.

Database (color)

This table is used for enter the color of cars with (F.K) with (car table ) so we can enter names so we can choose which one does the user want.

using wampserver it was easy to create database without the need of using coding (sql), it can be created in GUI.

Database(car)

page (PHPmyAdmin(wamp server))

//database name

$server = 'localhost';

//database username

$user = 'root';

//database user password

$pass = '';

//database name

$db = '7raaj_book';

// Connect to Database

$connection = mysql_connect

($server, $user, $pass)

or die ("Could not connect to server\n" .mysql_error ());

mysql_select_db($db, $connection)

We used it because it was easy to deal with, we used it to create a server offline with it we can create a database to connect it with our projects,and can be explored using (eg. google chrom,firefox,torch,explorer....)

This table is responsible for enter the car name and gear model and engine to choose which type does the user want from the database.

wampserver program

we used wampserver program to create database and connect it throught the use of

1- php code

2- netbeans.

Getting started(config)

after creating database and we choose a simple project named "7raaj_book" represents (buying,selling,trading)for cars.

Database(engine)

Database(model)

Database (Admin)

Database(category)

This table is used for enter the engine of cars with (F.K) with (car table ) so we can enter engine name so we can choose which one does the user want.

this table is responsible to enter the class of the car and is connected through foreign key to car table to enter the class of the car.

this table is responsible to enter the car model and is connected through F.K(car country name, and car date,car name).

Database(user)

Getting started(config)

This table is responsible for users and passwords to compare them in the database to allow them to enter if correct if valid will not allow them to enter,(i.e.in the picture..name='ajami' password='098').

example code for php :

$result = mysql_query("SELECT * FROM admin WHERE id=$userid")

This table is used to enter the user registration password and name and e-mail and is connected through F.K so he can access the website the admin database is responsible to allow them to enter.

the project requirements 8 tables (admin,captcha,category,color,engine,model,user) each table used for specific use.

Database (captcha)

This table is used to confirm your log-in as a human being and not a bot trying to log-in in example (facebook).

(Android basics)

Create a Project with Eclipse (android):

Getting started

Distribute

Getting started

Android

Getting started

Develop

Getting started

Design

Application Name is the app name that appears to users. For this project,

use "My First App."

Project Name is the name of your project directory and the name visible in Eclipse.

Now your app is complete. You've built it to support a variety of screen sizes and densities, and tested it on the Android emulator and on real devices. You're ready to ship your app.

i choose what is most compatible to work on my computer and in the same time taking in mind to also be well used on the market.

Once your design is finalized,

all you need are the tools to turn your app ideas into reality.

Android's framework provides you the APIs to build apps that take full advantage of device hardware,

connected accessory devices, the Internet, software features, and more. With the power of Android,

there's no limit to the power of your apps.

Package Name is the package namespace for your app (following the same rules as packages in the Java programming language). Your package name must be unique across all packages installed on the Android syste

Before you write a single line of code, you need to design the user interface and make it fit the Android user experience. Although you may know what a user will do with your app, you should pause to focus on how a user will interact with it. Your design should be sleek, simple, powerful, and tailored to the Android experience.

On the next screen to configure the project, leave the default selections and click Next.

Now you can select an activity template from which to begin building your app.

Now our project is created and is ready for use.

we used this code for the connection

now that database and android is connected, everything was ready. in our case using a simple project called 7araaj_book if we add a car to the application the database will receive it.

Android to databae connection

For this project, select BlankActivity and click Next.

Leave all the details for the activity in their default state and

click Finish.

we connected the database to the application

making sure they both receive and add

to each other .

public void ConnectToDatabase(){

try {

// SET CONNECTIONSTRING

Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance();

String username = "XXXXXXXXX";

String password = "XXXXXX";

Connection DbConn = DriverManager.getConnection("jdbc:jtds:sqlserver://192.188.4.83:1433/DATABASE;user=" + username + ";password=" + password);

Log.w("Connection","open");

Statement stmt = DbConn.createStatement();

ResultSet reset = stmt.executeQuery(" select * from users ");

EditText num = (EditText) findViewById(R.id.displaymessage);

num.setText(reset.getString(1));

DbConn.close();

} catch (Exception e)

{

Log.w("Error connection","" + e.getMessage());

}

}