예제 #1
0
		<!-- these js/css includes are ONLY to make the calendar widget work (fldDateMet);
			 these includes are not necessary for the class to work!! -->
		<link rel="stylesheet" href="includes/jquery.ui.all.css">
		<script src="includes/jquery.ui.core.js"></script>
		<!--script src="includes/jquery.ui.widget.js"></script-->
		<script src="includes/jquery.ui.datepicker.js"></script>
	</head>

<?php 
#change orientation (if desired/needed for large number of fields in a table)
//$tblFriend->setOrientation("vertical"); //if you want the table to arrange vertically
#i can define a relationship to another table
#the 1st field is the fk in the table, the 2nd is the second table, the 3rd is the pk in the second table, the 4th is field i want to retrieve as the dropdown value
#http://ajaxcrud.com/api/index.php?id=defineRelationship
$tblFriend->defineRelationship("fkMarriedTo", "tblLadies", "pkLadyID", "fldName", "fldSort DESC");
//last var (sorting) is optional; see reference documentation
#how you want the fields to visually display in the table header
$tblFriend->displayAs("pkFriendID", "ID");
$tblFriend->displayAs("fldName", "Name");
$tblFriend->displayAs("fldAddress", "Address");
$tblFriend->displayAs("fldCity", "City");
$tblFriend->displayAs("fldState", "State");
$tblFriend->displayAs("fldZip", "Zip");
$tblFriend->displayAs("fldPhone", "Phone");
$tblFriend->displayAs("fldEmail", "Email");
$tblFriend->displayAs("fldBestFriend", "Best Friend?");
$tblFriend->displayAs("fldDateMet", "Date We Met");
$tblFriend->displayAs("fldFriendRating", "Rating");
$tblFriend->displayAs("fldOwes", "Owes Me How Much?");
$tblFriend->displayAs("fldPicture", "Image");
<?php

require_once 'include/preheader.php';
// <-- this include file MUST go first before any HTML/output
include 'include/ajaxCRUD.class.php';
// <-- this include file MUST go first before any HTML/output
$tblDemo = new ajaxCRUD("Autos", "autos", "id_autos", "");
$tblDemo->defineRelationship("id_tipo", "tipo", "id_tipo", "desc_tipo");
$tblDemo->defineRelationship("id_modelo", "modelo", "id_modelo", "desc_modelo");
$tblDemo->defineRelationship("id_marca", "marca", "id_marca", "desc_marca");
$tblDemo->omitPrimaryKey();
$tblDemo->displayAs("nombre_autos", "Nombre");
$tblDemo->displayAs("desc_autos", "Descripcion");
$tblDemo->displayAs("detalle_autos", "Especificaciones");
$tblDemo->displayAs("precio_autos", "Precio");
$tblDemo->displayAs("id_marca", "Marca");
$tblDemo->displayAs("id_tipo", "Tipo");
$tblDemo->displayAs("id_modelo", "Modelo");
$tblDemo->setTextareaHeight('detalle_autos', 150);
$tblDemo->addWhereClause("WHERE id_marca = 2 and id_tipo = 41");
$tblDemo->setLimit(30);
$tblDemo->showTable();