PHP & Hosted Applications by Ahmad Abualsamid Listing One
Listing Two Listing Three Listing Four $stmt = "insert into surveys.survey (name,lastupdate,DateCreated,OwnerID, "; $stmt = $stmt . "Description,isClosed) values ('$survey_name',now(),now(),0"; $stmt = $stmt . ",'$survey_description',0)"; if (!(mysql_query($stmt)) { { printf ("Failed in Creating the Survey Entry..."); exit(); } Listing Five <% Dim myObject Set myObject = Server.CreateObject("MyProject.MyClass") Dim myString myString = myObject.GetDataBaseName Response.Write "The Database name is " & myString %> Listing Six $myObject = new COM("MyProject.MyClass"); $myString = $myObject->GetDataBaseName(); echo "The Database name is $myString"; ?> Example 1: Create table survey (ID not int not null auto_increment, name varchar(255), LastUpdate date, DateCreated Date, OwnerID number, Description varchar(255), IsClosed smallint, primary key(ID)); Example 2: Create Table Questions (ID int not null auto_increment, SurveyID int not null, QuestionType smallint, QuestionText varchar(255), NumberOfChoices smallint, isRequired smallint, primary key (ID), index (SurveyID)); Example 3: Create Table Choices (ID int not null auto_increment, QuestionID int not null, Text varchar(255), primary key (ID), index (QuestionID)); Example 4: Create Table Answers (SurveyID number, QuestionID number, ChoiceSelected smallint, AnswerText varchar(255)); 1