The mainButton()function uses the value of $mainProgramto build

October 27, 2006 on 6:14 pm | In php |

The mainButton()function uses the value of $mainProgramto build a link back tothe primary screen in every other document produced by the system. Connecting to the DatabaseThe connectToSpy()function is fundamental to the spysystem. It uses system- level variables to generate a database connection. It returns an error message ifit is unable to connect to the database. The mysql_error()function prints an SQLerror message if the data connection was unsuccessful. This information may notbe helpful to the end user, but it might give you some insight as you are debug- ging the system. function connectToSpy(){ //connects to the spy DBglobal $serverName, $userName, $password; $dbConn = mysql_connect($serverName, $userName, $password); if (!$dbConn){ print

problem connecting to database…

\n ?; } // end if$select = mysql_select_db( chapter12 ?); if (!$select){ print mysql_error() .
\n ?; } // end ifreturn $dbConn; } // end connectToSpyThe connectToSpy()function returns a connection to the database that is subse- quently used in the many queries passed to the database throughout the system slife span. Creating a Quick List from a QueryI created a few functions in the spyMasterlibrary that didn t get used in the pro- ject s final version. The qToList()function is a good example. This program takesany SQL query and returns a simply formatted HTML segment describing thedata. I find this format useful when debugging because no complex formattinggets in the way. function qToList($query){ //given a query, makes a quick list of dataglobal $dbConn; 408PHP5/MySQLProgrammingfortheAbsoluteBeginner

Note: If you are looking for good and affordable webspace to host and run your servlet application check Virtualwebstudio servlet hosting services

WordPress database error: [Table './sandzak_com_-_blog/wp_comments' is marked as crashed and should be repaired]
SELECT * FROM wp_comments WHERE comment_post_ID = '495' AND comment_approved = '1' ORDER BY comment_date

No Comments yet

TrackBack URI

Sorry, the comment form is closed at this time.

Powered by cheap hosting