WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Dynamic WHERE CLAUSE depending on number of FORM FIELDS
Categories : ODBC, General SQL, PHP, Complete Programs, Databases Update Picture
Dirk Jonckers
Date : Sep 30th 1998
Grade : 2 of 5 (graded 4 times)
Viewed : 17858
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Dirk Jonckers
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

<HTML>
<BODY BACKGROUND="/images/bkjaune.gif">
<?

//__________________________________________________________
//
// query.php3
// lookup experts using PHP3 (dynamic WHERE CLAUSE)
// Dirk Jonckers - 09/1998
//__________________________________________________________


function Error_Handler( $msg, $cnx )
{
echo "$msg \n";
// in case of persistent connexion, it is important to close it before exiting.
odbc_close( $cnx);
exit();
}



// create an ODBC connection, returned in $cnx
$cnx = odbc_connect( 'INSTANCE' , 'user', 'pass' );

$sqlquery="

SELECT
pof_a,
pof_nm,
pof_chnm,
pof_mr,
pof_dept,
pof_labo,
pof_adr1,
pof_adr2,
pof_pobox,
pof_pc1,
pof_tnm,
cy_cynm,
pof_org
FROM
ampere.fi_pof,ampere.fi_cy

WHERE

pof_dpc = 'RBG4'
AND
substr(pof_a,4,4) = '4003'

AND
cy_code = pof_cy
AND
cy_lge = 'EN'
";

if ( $GCODE ){
$wherecl1 = " AND pof_a in (select ept_a from ampere.fi_ept where ept_a = pof_a and ept_ept = '$GCODE')";
}

if ($MCODE){
$wherecl2 = " AND pof_a in (select ept_a from ampere.fi_ept where ept_a = pof_a and ept_ept = '$MCODE')";
}

if ($LCODE){
$wherecl3 = " AND pof_a in (select ept_a from ampere.fi_ept where ept_a = pof_a and ept_ept = '$LCODE')";
}

if ($GRPCY){
$wherecl4 = " AND pof_cy in (select lib_lib1 from ampere.fi_lib where lib_table = 'GRPCY' and lib_lge = 'XX' and
lib_code = '$GRPCY')";
}

if ($CYCODE){
$wherecl5 = " AND pof_cy = '$CYCODE'";
}

if ($YEAR){
$wherecl6 = " AND TO_CHAR(pof_dcrea) > '01-$MONTH-$YEAR'";
}

if ($USED){
$wherecl7 = " AND pof_a in (select ept_a from ampere.fi_ept where ept_a = pof_a and ept_ept = '$USED')";
}

if ($SURNAME){
$wherecl8 = " AND pof_nm like upper('%$SURNAME%')";
}

if ($EXPNUMBER){
$wherecl9 = " AND pof_a like '%$EXPNUMBER%'";
}





$sql = $sqlquery . $wherecl1 . $wherecl2 . $wherecl3 . $wherecl4 . $wherecl5 . $wherecl6 . $wherecl7 . $wherecl8 .
$wherecl9 ;

//print $sql;



if( ! $cnx ) {
Error_handler( "Error in odbc_connect" , $cnx );
}

// send a simple odbc query . returns an odbc cursor
$cur= odbc_exec( $cnx, $sql);



if( ! $cur ) {
Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx );
}


echo "<CENTER><H2>Evaluation Expert(s) matching your criteria</H2></CENTER>\n";
echo "<CENTER><H5>SURNAME=($SURNAME) EXPNUMBER=($EXPNUMBER) GCODE=($GCODE)
MCODE=($MCODE)
LCODE=($LCODE) CYCODE=($CYCODE) GRPCY=($GRPCY) USED=($USED) </H5></CENTER>\n";
echo "<CENTER><TABLE BORDER=1>\n";

$nbrow=0;

// fetch the succesive result rows
while( odbc_fetch_row( $cur ) )
{
                $nbrow++;
        $pof_a= odbc_result( $cur, 1 );
        $pof_nm= odbc_result( $cur, 2 );
        $pof_chnm= odbc_result( $cur, 3 );
        $pof_mr= odbc_result( $cur, 4 );
        $pof_debt= odbc_result( $cur, 5 );
        $pof_labo= odbc_result( $cur, 6 );
                         $pof_adr1= odbc_result( $cur, 7 );
                        $pof_adr2= odbc_result( $cur, 8 );
                        $pof_pobox= odbc_result( $cur, 9 );
                        $pof_pc1= odbc_result( $cur, 10 );
                        $pof_tnm= odbc_result( $cur, 11 );
                        $cy_cynm= odbc_result( $cur, 12 );
                        $pof_org= odbc_result( $cur, 13 );
                        

echo "<tr><td width=140 units=pixels><h4><A HREF=\"/expdet.php3?$pof_a\">$pof_a</A></h4></td>\n";
echo "<td width=400 units=pixels><H5>$pof_mr $pof_nm $pof_chnm<BR>$pof_org<BR>$pof_debt<BR> $pof_labo <BR> $pof_adr1
$pof_adr2 $pof_pobox <BR> $pof_pc1 $pof_tnm <BR> $cy_cynm</H5></td></tr>\n";
}

echo "<tr><td colspan=2>$nbrow entries </td></tr></TABLE></CENTER>\n";
// close the connection. important if persistent connection are "On"
odbc_close( $cnx);

?>

</BODY>
</HTML>



This program allows you to upload an ODBC ressource - i.e. an MS-Access database to a MySQL server.
Categories : Databases, MySQL, Complete Programs, PHP, Databases
Modification of Shane Caraveo's guestbook. Uses ODBC...some code modifications
Categories : ODBC, Databases, Complete Programs, PHP
Point and Click Interface ala MS Access for creating SQL statements.
Categories : MySQL, Complete Programs, General SQL, PHP, Databases
ADODB Database Wrapper Abstraction Library for PHP: MySQL, MSSQL, Oracle, Interbase,ODBC, Microsoft Access and FoxPro.
Categories : PHP Classes, Databases, PHP, General SQL, ODBC
A set of functions sitting on top of the abstraction layer that makes it a little easier to do SQL stuff. Documentation is within
Categories : Databases, ODBC, Complete Programs, PHP
This program will take data from a user via a web based form, validate it, show it to the user for re-validation, and finally insert it into the database. Plenty of sanity checking on the fields in the form.
Categories : MySQL, HTML and PHP, PHP, Complete Programs, Databases
Voting Machine with Access 97
Categories : PHP, ODBC, WinNT, MS Access, Complete Programs
google like search function with bolded search terms
Categories : PHP, Search, Databases, General SQL
Education Center is a set of PHP-scripts to administer a corporate education and examination system via Internet/intranet written in PHP for MySQL.
Categories : PHP, Databases, MySQL, Complete Programs
I`d like to use the mysql_fetch_row function along with a "randomizer" function that would give me a random result from a mySQL table.
Categories : General SQL, MySQL, PHP, Databases
bookmarker - PHP, PHPLIB, MySQL WWW based bookmark manager
Categories : MySQL, PHP, MySQL, Complete Programs, Databases
myCSV-dump converts a simple CSV-flatfile-database into an MySQL-dump.
Categories : PHP, MySQL, Databases, Complete Programs
Multiple Search using PHP and Mysql
Categories : PHP, Databases, General SQL, MySQL
phpAddQuote v1.2 - UPDATED! Lets users add their own quotes to your website. You specify how many quotes appear on the page at a time. Easier install!
Categories : HTML and PHP, Complete Programs, PHP, Databases, Personalization and Membership
AITSH Download
Categories : PHP, Complete Programs, MySQL, Databases