| | |
please help me on creating library system
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Aug 2008
Posts: 11
Reputation:
Solved Threads: 0
You could do this rather simply using a MySQL database by creating a books table, with columns like title, author, checkedout, checkedoutdate, etc.
I would recommend you look for a book on PHP/MySQL to become more familiar with the basics. Or, visit www.php.net/docs.php or www.mysql.com for more in-depth documentation.
If you have any more specific questions, I'd be glad to answer them.
Hope this helps
I would recommend you look for a book on PHP/MySQL to become more familiar with the basics. Or, visit www.php.net/docs.php or www.mysql.com for more in-depth documentation.
If you have any more specific questions, I'd be glad to answer them.
Hope this helps
•
•
Join Date: Aug 2008
Posts: 11
Reputation:
Solved Threads: 0
Alright, say you have a table named booktable with columns named bookid, title, author, and checkedout. Then to get that information out of the database, you need to query your database with mysql_query();. To return a table row that has a book id of 5, you use the SELECT command in PHP. So your code could look something like this...
This is very basic, there's a lot more you can do with MySQL that can make your application much more powerful. Hope this helps.
php Syntax (Toggle Plain Text)
<?php //lets start by connecting to mysql you only have to do this once in your page. $con = mysql_connect('yourhost','yourusername','yourpassword'); if (!$con) { die ('Could not connect: ' . mysql_error()); } //select your database mysql_select_db('yourdatabase', $con); //now query the database $query = "SELECT bookid, title, author, checkedout FROM booktable WHERE bookid=5"; $result = mysql_query($query, $con); //But now the result is in the form of an object. To get information out, we can use mysql_fetch_assoc(). $row = mysql_fetch_assoc($result) $bookid=$row['bookid']; // now $bookid has the bookid for this book. $title=$row['title']; //same here, etc. $author=$row['author']; ?>
This is very basic, there's a lot more you can do with MySQL that can make your application much more powerful. Hope this helps.
![]() |
Similar Threads
- Creating a Class Library (VB.NET)
- Password Storage System. (Python)
- Creating a Library (C++)
- Creating a folder and then move predefined files into it? (C)
- number system conversion (C++)
- creating zip files (ASP.NET)
- Linking errors while creating dll using ATL project (C++)
- i want help about the Simulate a Linux/UNIX shell, called MASH in the C (C)
- Error Creating Folder message during installation (OS X)
Other Threads in the PHP Forum
- Previous Thread: syntax error, unexpected $end in ndex.php on line 127
- Next Thread: Trying to Hyperlink Values in PHP Dynamic List - Getting Blank Page
Views: 1070 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email encode error file files folder form forms function functions google howtowriteathesis href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail menu methods mlm mod_rewrite multiple multipletables mysql oop parse paypal pdf php problem provider query radio random recursion regex remote script search select server sessions sms soap source space speed sql structure syntax system table template tutorial update updates upload url validation validator variable video web xml youtube





