<?php
/*
Class Datamodul (class.mysql_datamodul_php4.inc.php) usable function list:
dm_info
dm_select_result_info
get_server
set_selected_db
get_selected_db
get_user
get_pass
get_db_names
get_db_table_names
get_db_table_field_names
get_db_table_field_name
get_db_table_field_types
get_db_table_field_nulls
get_db_table_field_keys
get_db_table_field_defaults
get_db_table_field_extras
get_db_count
get_db_table_count
get_db_table_field_counts
get_db_table_field_count
execute_sql
set_sql_row_index
get_sql_row_index
get_sql_rows
get_sql_table_names
get_sql_field_names
get_sql_table_count
get_sql_field_count
get_sql_row_count
get_sql_row_first
get_sql_row_next
get_sql_row_back
get_sql_row_last
get_sql_field_index
get_sql_affected_row_count
get_sql_executed_count
get_sql_string
* details in the class.mysql_datamodul_php4.inc.php source file *
*/
//class datamodul simple example
//our test database contents the test_table and the test_table2 ( with 2-2 rows), which have 3 fields as field1, field2, field3 ( with the values 1,2,3)
require_once('class.mysql_datamodul_php4.inc.php');
$dm=new DataModul("your_server","your_user","your_password","db_test");
$dm->dm_info();
echo '<br><br>example1:<br><br>';
$dm->execute_sql("SELECT * FROM test_table");
$dm->dm_select_result_info();
echo '-------------------<br>example2:<br><br>';
$dm->execute_sql("SELECT field1,field2 as second_field FROM test_table");
$row=$dm->get_sql_row_first();
do
{
echo '<b>Row number:</b> ',$dm->get_sql_row_index(),'<br> Field2 value: ',$row[$dm->get_sql_field_index('second_field')],' <br> Field1 value: ',$row[$dm->get_sql_field_index('field1')],'<br>';
}
while ($row=$dm->get_sql_row_next());
echo '-------------------<br>example3:<br><br>';
$dm2=new NewDataModul($dm);
$dm2->execute_sql('SELECT * FROM test_table2');
$row=$dm2->get_sql_row_last();
echo '<b>Row number:</b> ',$dm2->get_sql_row_index(),'<br> Field2 value: ', $row[1], '<br>';
$row=$dm2->get_sql_row_back();
echo '<b>Row number:</b> ',$dm2->get_sql_row_index(),'<br> Field3 value: ',$row[$dm2->get_sql_field_index('field3')],'<br>';
//I hope it will be usefull :)
?>
|