Algorithms Arrays Passwords Uncategorized
Commerce Uncategorized
Databases Abstraction Layers Informix LDAP MS SQL MySQL ODBC PostgreSQL Uncategorized
Date & Time Calculators Conversion Translation Uncategorized
Discussion Chat Forums Guestbooks Polls Uncategorized
Email Validation Uncategorized
External Uncategorized
Files and Directories Uncategorized
Games Uncategorized
Graphics 3-D Graphs Resizing Thumbnails Uncategorized
HTML Forms Menus & Navigation Source Viewers Tables Templates Uncategorized
HTTP Authentication Cookies File Uploading Uncategorized
I18N Uncategorized
Math Uncategorized
Miscellaneous Uncategorized
Searching and Trees Uncategorized
Security Uncategorized
Text Uncategorized
Utilities Calendars Counters Link Checkers Weather Uncategorized
XML Uncategorized
| php sample source codes |
|---|
|
Now with enhanced features - A lean and mean MYSQL Database Manager (only 45 KB) to manage your simple MYSQL databases anywhere on the web. You don't have to have extensive knowledge of SQL to create and manage database for your site.
|
|
This MySQL Class allows an author to easily run SQL queries and catch/log errors in case of failure. While there are other classes that do this, I use my own because it was built for projects of mine that needed it, however it has been adapted for general use. The log functions are good for both debugging and keeping the error msgs away from visitors presenting them with a clean neat error message if there is a problem with MySQL or a query.
|
|
Build an array of associative arrays that can be accessed by $ARRAY[$index]["DB field name"]. Very handy for pulling select fields from a large table.
|
|
BNRS posts user submited data to a specific MySQL table. And is quite user interactive, It says "Thank you John Doe for registering.... An email has been sent to johndoe@hotmail.com
|
|
Extremely easy to use and full-featured MySQL class with measured queries.
|
|
This class provides programmers with a more time efficient way to interact with mysql databases using php and sql.
|
|
Shows two methods on how to convert a MySQL date/time string into a UNIX timestamp that can be inserted into tables or used with date().
|
|
takes comma delimited file with first line of field names, <br>creates MySQL table
|
|
<B>The Database Template</B><BR>
Easy DataBase use. Make a database with ANY program.<BR>
<LI>MySQL Database
<LI>Replace any { } with your colloms
|
|
dbrowse allows the user to examine a wide variety of information about a MySQL database including a list of tables, each table structure, properties and metadata, keys and indexing, records in each table, and the server status, variables and threads.
|
|
Create a form from a MySQL table with 3 lines of code.
|
|
Demo for SQLites with php 5 example code
|
|
//to get list of option html tags from a table
|
|
This function will duplicate an existing dataset.
|
|
This script takes the contents of a MySQL table and dumps it to either a dynamically-generated MS Word File (file with ending '.doc') or a dynamically-generated MS Excel File (file with ending '.xls'). You can place this script on any Unix/Linux or Windows Server running PHP & MySQL, but you have to access it using a browser on a Windows computer with Word or Excel installed on it. This script does not use COM objects and does not support multiple Worksheets in Excel. It can be used not only for creating complete dumps of MySQL tables (as Word or Excel files), but can be very easily modified to support just about any kind of select statement you'd like to use.
|
|
Show each record in your database with a dynamic loop.
|
|
This is a class written for simplifying the mySQL operations.<BR>This class makes the following tasks very easy<BR><UL><LI>Database Connection Handling</LI><LI>Checking the existance of any record</LI><LI>User validation</LI><LI>Registratons</LI><LI>Modifying Records</LI><LI>Getting Records</LI><LI>Deleting Records</LI><LI>Executing Queries</LI><LI>Bug Reporting</LI></UL><BR>It helps you in object oriented programming and also makes your code readable. Each function in this class just return true or false or any data item if generated by the query.It is very easy to track bugs in it. Functionality of each function is fully defined with examples where necessary.
|
|
This is fuction to insert or update in to datbase tables
|
|
easily create your update query from
a list of cgi params which have the same names as your mysql fields
|
|
I ran one of my database front-ends that worked great in PHP3, under PHP4 and found that back-slashes started poping up like rabbits on fertility hormones.
After a little research into the problem, I found out what it was: mysql_escape_string, a function not availble in PHP3 was implemented "transparently" in PHP4 and (unfortunately) was installed "backwards": It escapes the result set, which is not how string escaping was intended.
The fix: I've made a fix called mysql_unescape_string. You won't find an analog of it at www.mysql.com because its a bastard function specifically for taking care of the PHP4 implementation problem.
See the example section for usage of it...
(Also, see the "mysql_escape_string" function in this same section for my original fix for string escaping in MySQL)
|
|
This snippet will display the fields supplied.
|
|
A simple function to build an insert query from an associative array. Changes to the table structure will be reflected automatically, no need to modify code.
|
|
Complet functions for fast code generation and very small size HTML files.
With error control and example.
|
|
This is a very simple and useful database function that is used within the XPC Conceptual CMF
|
|
<B>list_db.php</B> is stand alone PHP 4.0 script dedicate to print structure of selected database like list of HTML tables with full information about fields in to tables.<BR>
<BR>
Parameters of script are :<BR>
<UL>
<LI> Host name (if missing, $SERVER_NAME is use) of MySQL server
<LI> Port number of MySQL server
<LI> UserID to connect database
<LI> Password of UserID to connect database
<LI> Database name
</UL>
<BR>
|
|
What is the most common way to access data in the world today? If pressed for this answer, I would have to say it is Microsoft DAO (a.k.a. Data Access Object) whether it be with a VB, Access or VC++ front-end or with an Access or enterprise-level back-end. The greatest single group of application programmers use DAO, period.
This first stab at providing the most important parts of DAO (i.e. those that are use about 90% of the time) is my hope that many ASP programmers, sickened by Microsoft's insistance that web-based programming be done with the cumbersome, twitchy, and many times over-complicated ADO (ActiveX Data Object) may turn to PHP and MySQL without having to relearn a different data access methodology.
There are some important things missing in this first release. Recordset objects don't have the old "edit/update" functionality, and in this first release don't even have a findfirst/findnext method (but it is coming). But even with all the missing pieces, this release allows you to do everything you need to: query the database, execute SQL commands, traverse recordsets, object-based approaches. AND its available by including just one small file at the top of every PHP script you write.
Email me with your thoughts people! I'll get to it faster if there is a need out there!
|
|
Connecting to two different databases in one script using MySQL
|
|
This script is very simply.<br>With this application you can connect to a MySQL DB.
|
|
This class makes querying and fetching data from a database much easier. It's easy to understand, and requires little lines of code to use. You are able to execute multiple queries at a time, and fetch their results in any order you wish (which was somewhat of a problem with earlier versions of this class).
|
|
This connector allows you to connect to a MySQL database server. The class have routines to optimize database, count max field length, count table columns, get columns names...
|
|
This is a function that backs up the structure and data of a MySQL database and represents them as a large text file of SQL statements. Doesn't require special disk access permissions, it pulls everything through the connection handle itself. Output can be sent transfered via FTP (i.e. by transfering the text file) or by HTTP (i.e. by direct output to the invoking browser).
|
|
When interacting with a database, functions are called that are common to every transaction; functions to establish a connection,
execute the query and then close the connection. This article shows how to create functions that will eliminate this redundancy.
We will create a Select function to retrieve data, an Insert function to insert data, an Update function to update data and a
Delete function to remove data.
|
|
A simple way to search a mySql database without having to write any queries. Returns all results in one array so searching multiple tables can be a simple task.
|
|
This code will allow a user interface for people to manually re-order records in a database. It is currently coded to work in a table (The first holding the arrows for moving the records up or down). Please email me and Let me know how it works. Also, if you are interested in an addon that will allow for limiting records per page (e.g. Showing 1-20 of 54 records) and previous and next links please let me know at bgintz@novvia.com. Thanks
|
|
This will grab the contents from the table and mysql database that you specify and turn it into an array.
|
|
This function is for connecting to a pair of MySQL fail over servers. It tries to connect to the first availiable server in the array list of $mysql_servers and so on. The main use for this function is for MySQL servers in a two way replication setup. The client can read from any of the servers using the normal mysql_connect function but for writing mysql_rep_connect is safer in that it only addresses one server at a time, thus preventing data conflict. Add set-variable = max_connect_errors=2147483647 to avoid problems.
|
|
Inputs the result of a mysql_query and outputs the results in a dynamically sized HTML table, with the field names as table headers.
|
|
A drop in single-file app that will allow you to browse databases, tables in a MySQL server. Shows table explanations, and table contents.
|
|
This is the easiest way I know how to get data from a MySQL database to and Microsoft Access database. Its not automatic, but its by far the best way to move tables from MySQL to Access. A single function generates a CSV file (with Access string escaping) that can be easily downloaded and "imported" into Access.
|
|
This class caches a MySQL table on the filesystem. It is designed to be used with small tables. For example, you may have a table called `depts`, which stores information about the various departments in your website. Each dept may have a name, a path, auth info, etc. You may need to access this table for every page on your website in order to build the menu. For cases like these, caching on the filesystem offers a significant speed boost.
Each row in the table is stored as an array element, which is then stored as a file using serialize(). You may optionally choose a field from the table to be the key for an associative array (eg the department name) instead.
The array is stored in $this->data, and it will be populated by calling the constructor.
|
|
Simple <b>mysql</b> utility that dumps data from all databases on a server into a date stamped directory - can either be called either through a web site or automated with a PHP binary and entry into your crontab.
|
|
A nice way to dump mysql-data to excel and still be able to use the output on a webpage.
|
|
A big hole in PHP's mysql support: the lack of mysql_escape_string function. Wondered what the easiest way of taking any zero-terminated string (i.e. one with single/double quotes, commas, special chars) and putting it in an SQL statement so it ALWAYS WORKS? Use this version of mysql_escape_string; based on the formal MySQL escape charater definition found at www.mysql.com.
|
|
Returns an Array of acceptable values for an Enumerated field in a MySQL table. Great for setting up a pull down or select box in a web form.
|
|
Returns the field names of a mysql result as an array
|
|
A fairly simple PHP script that prompts you to choose a database and a table from a MySQL server (set which in the code). It will then generate a complete set of code (in PHP) to define an object which can be used to access a row in the given table. It is self commenting, including a dynamically created example in the header block that applies to the given created object.
It is an extremely handy way to access and deal with rows of data from the database in PHP. Objects can be easily passed to functions and such without the inherit awkwardness of using rows. It also shields the developer from having to write SQL for selecting, updating, or inserting rows to the table. Because the SQL is dynamically generated, it is also free of any typographic errors that might happen from "hand coded" SQL.
Methods include new(), load(), save(), and serialize_xml() (which will return an XML serialization of the object data).
|
|
Ever wanted to limit the number of returns you get from a MySQL Query? You want to show all of them, but you'd really like to show them spanning 2 or three or 15 pages for example... After sleeping on the bus, i discovered how to do this fairly easily.<br><br>
This used to be a small code snippet and now i've just made it a page, but it's still pretty small, it's a little smarter than it was, it's cleaner, and it's got plenty of wheat.
UPDATE: it works now and will connect to your db for free.
|
|
Limit the number of returns you get from a MySQL Query and printout navigation links to each of the pages. This was adapted from and performs exactly like nsfmc's in-line code
|
|
This is enhancement of <b><a href="http://www.zend.com/codex.php?id=568&single=1">Page Scroller ver 2</a></b>, I add a page map link so you can jump to any page.
|
|
Programers who had programed in VB will find a very usefull this two classes to generate PHP and MySQL driven sites
|
|
A set of php scripts to backup MySQL databases from many servers.
|
|
makes a MySQL query from user input when the user is
useing standered search commands (+ , "" , - , & and pain taxt commands)
uses mysql MATCH() AGAINST() and the advanced version in MySQL 4.0.1
|
|
Populate a form dropdown box with field names from a MySQL table.
|
|
Since mysql_select_db and its ilk does not provide a way to determine the previously selected database for a generalized approach to database selection, here's a "roll your own" that keeps a record of the previous database selection.
|
|
Prints the result of a mysql select query as a nice formatted table.
Works with joined tables.
Very useful for debugging purposes.
|
|
This program will create the table along with fields and their size in the database MYsql. This is only for three datatypes but one can enhance it
|
|
PHP is great for a lot of things, but report generation is NOT one of them (compared to Crystal Reports or other report generators). I really like Microsoft Access's report environment, but its a royal pain in the butt to tranfer data from a MySQL database to Access, especially if you need to do it multiple times (like you have to with real life reports). Here is the simplest way I know how to do it FULLY AUTOMATICALLY.<p>
|
|
This small fragment of code takes three arguments. The first one is the name of the MySQL table you're trying to access. The second one take specifcations of what your table is going to look like. The third argument must have an array representing the columns that you will be extracting the data from the table. The only problem with this function is that it lists entire data and cannot be used with WHERE and such other clauses used in MySQL
|
|
Functions to produce SQL INSERT and UPDATE statements based on data structures. Works similar to ADODBs GetUpdateSQL() and GetInsertSQL() but doesn't require a bogus empty SELECT query beforehand.
|
|
one can paste any query in the query box and it will run and we don't have to have any
prior knowledge to the database techniques
|
|
Simple Search on mysql database, and print no record when data not found <br> drop down menu with more than 3 options
|
|
This my first complicated script as a beginner in PHP. This "result.php" script, is a script that checking two input from HTML/PHP form ($formname & $formtown). First, the script check the $formtown, after that input the data to database. (Originally this is in Bahasa Indonesia, sorry for my bad english).
|
|
This is a class I wrote as a re-write of my original create_order_block() function. It's used to create href links on a page to sort a SQL query (in both ascending and decending orders, the two will alternate).
|
|
These functions allows you to pass an array, or list, of fields (or simply pass the $HTTP_GET_VARS or $HTTP_POST_VARS depending on your method type), compare the list of fields passed to the existing fields in the speficied table and automatically either insert or update a record with all of your data sent as the correct sql format.
|
|
one can see the properties of all the tables in a database
very useful for the programmer
|
|
Browse any table selected from the dropdown, either any from a DB or specify wich ones.
|
|
Can be used to edit a MySQL table.
Has support for <B>relational tables</B>.
Widely used at <A HREF="http://www.eksperten.dk/" TARGET="_top">www.eksperten.dk</A>
Please send bug reports and updates to jfl@eksperten.dk
|
|
Generate mail merge files that work with Microsoft Word 97 and up (on both PC and Macintosh) from a MySQL database.
|