16.08.2013 Views

hostel management system - DSpace at CUSAT - Cochin University ...

hostel management system - DSpace at CUSAT - Cochin University ...

hostel management system - DSpace at CUSAT - Cochin University ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Hostel Mangement System<br />

2.3.1.2.2.1 Cre<strong>at</strong>e a connection to a d<strong>at</strong>abase<br />

Before you can access d<strong>at</strong>a in a d<strong>at</strong>abase, you must cre<strong>at</strong>e a connection to the d<strong>at</strong>abase.In PHP, this is<br />

done with the mysql_connect() function.<br />

Syntax<br />

Example<br />

In the following example we store the connection in a variable ($con) for l<strong>at</strong>er use in the script. The “die”<br />

part will be executed if the connection fails:<br />

2.3.1.2.2.2 Closing a Connection<br />

The connection will be closed autom<strong>at</strong>ically when the script ends. To close the connection before, use<br />

the mysql_close() function:<br />

Division of computer Engineering, SOE 14

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!