Ethan,
You have been given advise and break down on your code.
Have you taken the advise given?
Which part of the code isn't working? Not which chunk, but break it down and
show which part
BR,
Gav
-Original Message-
From: Ethan Rosenberg [mailto:eth...@earthlink.net]
Sent: 04 May 2012 15:10
To: php-db-lists.php.net; php-general@lists.php.net
Subject: [PHP-DB] [PHP] PHP Database Problems -- Code Snippets - Any more
Ideas?
I am sending this again to see if more ideas for solution of this problem
are available.
Ethan
===
Dear list -
Sorry for the attachment. Here are code snippets ---
GET THE DATA FROM INTAKE3:
function handle_data()
{
global $cxn;
$query = select * from Intake3 where 1;
if(isset($_Request['Sex']) trim($_POST['Sex']) != '' )
{
if ($_REQUEST['Sex'] === 0)
{
$sex = 'Male';
}
else
{
$sex = 'Female';
}
}
}
$allowed_fields = array
( 'Site' =$_POST['Site'], 'MedRec' = $_POST['MedRec'], 'Fname' =
$_POST['Fname'], 'Lname' = $_POST['Lname'] ,
'Phone' = $_POST['Phone'] , 'Sex' = $_POST['Sex'] ,
'Height' = $_POST['Height'] );
if(empty($allowed_fields))
{
echo ouch;
}
$query = select * from Intake3 where 1 ;
foreach ( $allowed_fields as $key = $val )
{
if ( (($val != '')) )
{
$query .= AND ($key = '$val') ;
}
$result1 = mysqli_query($cxn, $query);
}
$num = mysqli_num_rows($result1);
if(($num = mysqli_num_rows($result1)) == 0)
{
?
br /br /centerbp style=color: red; font-size:14pt; No
Records Retrieved #1/center/b/style/p ?php
exit();
}
DISPLAY THE INPUT3 DATA:
THIS SEEMS TO BE THE ROUTINE THAT IS FAILING
centerbSearch Results/b/centerbr /
centertable border=4 cellpadding=5
cellspacing=55 rules=all frame=box
tr class=\heading\
thSite/th
thMedical Record/th
thFirst Name/th
thLast Name/th
thPhone/td
thHeight/td
thSex/td
thHistory/td
/tr
?php
while ($row1 = mysqli_fetch_array($result1, MYSQLI_BOTH))
{
print_r($_POST);
global $MDRcheck;
$n1++;
echo br /n1 br /;echo $n1;
{
if (($n1 2) ($MDRcheck == $row1[1]))
{
echo 2== ;
echo $MDRcheck;
echo td $row1[0] /td\n;
echo td $row1[1] /td\n;
echo td $row1[2] /td\n;
echo td $row1[3] /td\n;
echo td $row1[4] /td\n;
echo td $row1[5] /td\n;
echo td $row1[6] /td\n;
echo td $row1[7] /td\n;
echo /tr\n;
}
elseif (($n1 2) ($MDRcheck != $row1[1]))
{
echo 2!= ;
echo $MDRcheck;
continue;
}
elseif ($n1 == 2)
{
define( MDR , $row1[1]);
echo br /row1 br;echo $row1[1];
echo tr\n;
$_GLOBALS['mdr']= $row1[1];
$_POST['MedRec'] = $row1[1];
$MDRold = $_GLOBALS['mdr'];
echo td $row1[0] /td\n;
echo td $row1[1] /td\n;
echo td $row1[2] /td\n;
echo td $row1[3] /td\n;
echo td $row1[4] /td\n;
echo td $row1[5] /td\n;
echo td $row1[6] /td\n;
echo td $row1[7] /td\n;
echo /tr\n;
}
}
}
?
SELECT AND DISPLAY DATA FROM VISIT3 DATABASE
?php
$query2 = select * from Visit3 where 1 AND (Site = 'AA') AND (MedRec
= $_GLOBALS[mdr]);
$result2 = mysqli_query($cxn, $query2);
$num = mysqli_num_rows($result2);
global $finished;
$finished = 0;
while($row2 = mysqli_fetch_array($result2, MYSQLI_BOTH))
{
global $finished;
echo tr\n;
echo td $row2[0] /td\n;
echo td $row2[1] /td\n;
echo td $row2[2] /td\n;
echo td $row2[3] /td\n;
echo td $row2[4] /td\n;
echo td $row2[5] /td\n;
echo td $row2[6] /td\n;
echo /tr\n;
}
echo /table;
ENTER MORE DATA:
function More_Data()
{
$decision = 5;
?
Do you Wish to Enter More Data?
form method=post action=
centerinput type=radio name=decision value=1 /Yes
input type=radio name=decision value=0 /No/centerbr /
centerinput type=submit value=Enter more Data //center
input type=hidden name=next_step value=step10 /
/form
?php
} //end