Re: [PHP-DB] Program Dies
On Oct 14, 2012, at 4:57 PM, Ethan Rosenberg, PhD wrote: Dear List - Thank you ever so much for all your help. I apologize in advance for dumping all this code on you. I cannot get any debugger to work for me [see my separate email on debuggers]. I placed numerous echo and print_r statements in the code, and could not find the error. The program worked perfectly previously, and now it dies. It mimic a doctor's office where a study is being performed on obesity. The parameter is a calculated value called BMI. In the initial part of the program, a search is performed to obtain the medical record . This works perfectly. The second step is to obtain data at the patient visit, which is triggered by a button "Do you wish to enter visit data?" If that button is clicked, the program returns to the original welcome screen. Advice and help, please. Here is the code: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> Search of Initial Input Data table { border-collapse: collapse; } td { border-top: "1px solid #000"; border-bottom: "1px solid #000"; border-left:"1px solid #000"; border-right: "1px solid #000"; } tr { border-top: "1px solid #000"; border-bottom: "1px solid #000"; border-left:"1px solid #000"; border-right: "1px solid #000"; } #more{ margin-top: 90%; } #vs{ position: absolute; left: 46%; } #vs2{ position: absolute; left: 44%; } Search of Input Data $errors_array[] = "First Name must be Text"; $errors = 1; } if(!empty($_POST['Lname'])) if(preg_match('#^[a-zA-Z]\w#', $_POST['Lname'])== 0) { $errors_array[] = "Last Name must be Text"; $errors = 1; } if(!empty($_POST['Site'])) if(preg_match('#^[A-Z]\w{1}#', $_POST['Site'])== 0) { $errors_array[] = "Site must be TWO CAPITAL LETTERS"; $errors = 1; } if(!empty($_POST['MedRec'])) if(preg_match('#^\d{5}$#', $_POST['MedRec']) == 0) { $errors_array[] = "color='red'>Medical Record must be FIVE NUMBERS"; $errors = 1; } if(!empty($_POST['Height'])) if(preg_match('#^[5-6]{1}$|^[5-6]{1}[0-9]{1}$#', $_POST['Height']) == 0) { $errors_array[] = "color='red'>Height must be between 50 and 69"; $errors = 1; } if(!empty($_POST['Phone'])) // ^\(?(\d{0,3})\)?(\.|\/)|\s|\-)?(\d{3})(\.| \/)|\s|\-)?(\d{4})\s?(x|ext)?(\d*)$ if(preg_match('#^\d{3}-\d{3}-\d{4}$#', $_POST['Phone']) == 0) { $errors_array[] = "Phone Format xxx-xxx-"; $errors = 1; } if(!empty($_POST['Bday'])) // ^\(?(\d{0,3})\)?(\.|\/)|\s|\-)?(\d{3})(\.| \/)|\s|\-)?(\d{4})\s?(x|ext)?(\d*)$ if(preg_match('#^\d{4}-\d{2}-\d{2}$#', $_POST['Bday']) == 0) { $errors_array[] = "color='red'>Birthday Format -mm-dd"; $errors = 1; } } function show_errors() { global $errors_array; foreach ($errors_array as $err) { echo $err, ""; } } function handle_data($cxn) { global $cxn; if(isset($_Request['Sex'])&& trim($_POST['Sex']) != '' ) { if ($_REQUEST['Sex'] === "0") { $sex = 'Male'; } else { $sex = 'Female'; } } $allowed_fields = array ( 'Site' => 's', 'MedRec' => 'i', 'Fname' => 's', 'Lname' => 's','Phone'=> 's', 'Height' => 'i', 'Sex' => 's', 'Hx' => 's','Bday' => 's', 'Age' => 'i' ); if(empty($allowed_fields)) { echo "ouch"; } // Configure the query and the acceptable params to put into the WHERE clause $sql12 = 'SELECT * FROM Intake3 WHERE 1'; // Magically put everything together $types = ''; $args = array(); foreach( $allowed_fields as $k => $type ) { if( !array_key_exists( $k, $allowed_fields ) ) continue; else { if( ($_POST[$k]) != '') { $args[] = &$_POST[$k]; // Note the addition of the ampersand here $types .= $type; $sql12 .= " AND ($k = ?)"; } } } // For debugging and demonstration echo 'Query: ' . $sql12 . PHP_EOL; echo 'Bind types: ' . $types . PHP_EOL; echo 'Arguments:' . PHP_EOL; echo "arguments"; print_r($args); $stmt = mysqli_stmt_init($cxn); mysqli_stmt_prepare( $stmt, $sql12 ); if( !$stmt ) throw new Exception( 'Error preparing state
Re: [PHP-DB] Program Dies
On Sun, Oct 14, 2012 at 11:57 PM, Ethan Rosenberg, PhD wrote: > Dear List - > > Thank you ever so much for all your help. > > I apologize in advance for dumping all this code on you. I cannot get any > debugger to work for me [see my separate email on debuggers]. I placed > numerous echo and print_r statements in the code, and could not find the > error. > > The program worked perfectly previously, and now it dies. > > It mimic a doctor's office where a study is being performed on obesity. The > parameter is a calculated value called BMI. > > In the initial part of the program, a search is performed to obtain the > medical record . This works perfectly. The second step is to obtain data > at the patient visit, which is triggered by a button "Do you wish to enter > visit data?" If that button is clicked, the program returns to the original > welcome screen. > > Advice and help, please. > > Here is the code: > Ethan, I'd love to help you out, but you really can't expect anybody from this mailing list to read through 633 lines of code... - Matijn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Debuggers
Bastien Koert On 2012-10-14, at 5:57 PM, "Ethan Rosenberg, PhD" wrote: > Dear list. > > I am running Debian 6 (sid) and Firefox 15.0 > > I have three debuggers: > > Firebug - I have never been able to make it step thru the code. > > Aptana - "Aptana Firefox extension launching...please wait". Never goes > beyond this point. > > Netbeans - 1]Will only give a Java debugger. 2] No color highlighting. > > Help and advice, please. > > Ethan > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > It sounds like you have the net beans for java version. The php version, I believe has x debugger installed. Bastien -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Program Dies
Dear List - Thank you ever so much for all your help. I apologize in advance for dumping all this code on you. I cannot get any debugger to work for me [see my separate email on debuggers]. I placed numerous echo and print_r statements in the code, and could not find the error. The program worked perfectly previously, and now it dies. It mimic a doctor's office where a study is being performed on obesity. The parameter is a calculated value called BMI. In the initial part of the program, a search is performed to obtain the medical record . This works perfectly. The second step is to obtain data at the patient visit, which is triggered by a button "Do you wish to enter visit data?" If that button is clicked, the program returns to the original welcome screen. Advice and help, please. Here is the code: "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> Search of Initial Input Data table { border-collapse: collapse; } td { border-top: "1px solid #000"; border-bottom: "1px solid #000"; border-left:"1px solid #000"; border-right: "1px solid #000"; } tr { border-top: "1px solid #000"; border-bottom: "1px solid #000"; border-left:"1px solid #000"; border-right: "1px solid #000"; } #more{ margin-top: 90%; } #vs{ position: absolute; left: 46%; } #vs2{ position: absolute; left: 44%; } Search of Input Data $errors_array[] = "First Name must be Text"; $errors = 1; } if(!empty($_POST['Lname'])) if(preg_match('#^[a-zA-Z]\w#', $_POST['Lname'])== 0) { $errors_array[] = "Last Name must be Text"; $errors = 1; } if(!empty($_POST['Site'])) if(preg_match('#^[A-Z]\w{1}#', $_POST['Site'])== 0) { $errors_array[] = "Site must be TWO CAPITAL LETTERS"; $errors = 1; } if(!empty($_POST['MedRec'])) if(preg_match('#^\d{5}$#', $_POST['MedRec']) == 0) { $errors_array[] = "Medical Record must be FIVE NUMBERS"; $errors = 1; } if(!empty($_POST['Height'])) if(preg_match('#^[5-6]{1}$|^[5-6]{1}[0-9]{1}$#', $_POST['Height']) == 0) { $errors_array[] = "color='red'>Height must be between 50 and 69"; $errors = 1; } if(!empty($_POST['Phone'])) // ^\(?(\d{0,3})\)?(\.|\/)|\s|\-)?(\d{3})(\.|\/)|\s|\-)?(\d{4})\s?(x|ext)?(\d*)$ if(preg_match('#^\d{3}-\d{3}-\d{4}$#', $_POST['Phone']) == 0) { $errors_array[] = "Phone Format xxx-xxx-"; $errors = 1; } if(!empty($_POST['Bday'])) // ^\(?(\d{0,3})\)?(\.|\/)|\s|\-)?(\d{3})(\.|\/)|\s|\-)?(\d{4})\s?(x|ext)?(\d*)$ if(preg_match('#^\d{4}-\d{2}-\d{2}$#', $_POST['Bday']) == 0) { $errors_array[] = "color='red'>Birthday Format -mm-dd"; $errors = 1; } } function show_errors() { global $errors_array; foreach ($errors_array as $err) { echo $err, ""; } } function handle_data($cxn) { global $cxn; if(isset($_Request['Sex'])&& trim($_POST['Sex']) != '' ) { if ($_REQUEST['Sex'] === "0") { $sex = 'Male'; } else { $sex = 'Female'; } } $allowed_fields = array ( 'Site' => 's', 'MedRec' => 'i', 'Fname' => 's', 'Lname' => 's','Phone'=> 's', 'Height' => 'i', 'Sex' => 's', 'Hx' => 's','Bday' => 's', 'Age' => 'i' ); if(empty($allowed_fields)) { echo "ouch"; } // Configure the query and the acceptable params to put into the WHERE clause $sql12 = 'SELECT * FROM Intake3 WHERE 1'; // Magically put everything together $types = ''; $args = array(); foreach( $allowed_fields as $k => $type ) { if( !array_key_exists( $k, $allowed_fields ) ) continue; else { if( ($_POST[$k]) != '') { $args[] = &$_POST[$k]; // Note the addition of the ampersand here $types .= $type; $sql12 .= " AND ($k = ?)"; } } } // For debugging and demonstration echo 'Query: ' . $sql12 . PHP_EOL; echo 'Bind types: ' . $types . PHP_EOL; echo 'Arguments:' . PHP_EOL; echo "arguments"; print_r($args); $stmt = mysqli_stmt_init($cxn); mysqli_stmt_prepare( $stmt, $sql12 ); if( !$stmt ) throw new Exception( '
[PHP-DB] Debuggers
Dear list. I am running Debian 6 (sid) and Firefox 15.0 I have three debuggers: Firebug - I have never been able to make it step thru the code. Aptana - "Aptana Firefox extension launching...please wait". Never goes beyond this point. Netbeans - 1]Will only give a Java debugger. 2] No color highlighting. Help and advice, please. Ethan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php