Hello,
I'm new to php and i'd like to post the following.
I have written code to get records from a DB and i need one record at a time to be filled in a form i created. Then the next record should be displayed after the user hits the "press any ket button". It does not work
PLEASE HELP !
code is following
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<?php
$labels = array( "user_name" => "User Name", "create_date" => "Creation Date", "password" => "Password",
"last_name" => "Last Name",
"first_name" => "First Name",
"street" => "Street",
"city" => "City",
"state" => "State",
"zip" => "Zip",
"email" => "Email",
"phone" => "Phone",
"fax" => "Fax");
$submit = "Press any key";
include("dbstuff.inc");
$cxn = mysqli_connect($host,$user,$passwd,$databname);
if (!cxn) {
printf("Can't connect to localhost. Errorcode: %dn", mysqli_connect_errno ());
}
else { echo "connection successful !";
}
/* or die ("could not connect to server");*/
$query = "SELECT * FROM customer ";
$result = mysqli_query ($cxn,$query) or die ("could not execute query");
/*$customer = mysqli_fetch_assoc($result);*/
?>
<html>
<head><title>Customer Record</title>
<style type='text/css'>
/*div {background-color:#b0c4de}*/
body {color:blue}
body {background-color:#b0c4de}
<!--
#form {margin: 1.5em 0 0 0;
padding: 15;
}
#field {padding-bottom: 1em;}
label {
font-weight: bold;
float: left;
width: 10%;
margin-right: 1em;
text-align: right;
}
-->
</style>
</head>
<body>
<h3> Customer Details</h3>
<?php
/* Loop that displays the form fields */
/* print_r ($customer);*/
while ($customer = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
echo "<form action = '$_SERVER[PHP_SELF]' method = 'POST'>
<div id='form'>";
foreach($labels as $field => $label)
{
echo "<div id='field'><label for='$field'>$label</label>
<input id='$field' name='$field' type='text'
size='50%' maxlength='65' value = {$customer[$field]} />
</div>n";
} /* foreach*/
echo "<input style='margin-left: 33%' type='submit' value='$submit' />n";
} /*while*/
/*echo "</div>n";*/
/* free result set */
mysqli_free_result($result);
/* close connection */
mysqli_close($cxn);
?>
</form></body></html>
ALV List Display to point to another report on Double Click
Hi,
Sum of Values in an Array
This is probably really simple... but it's been years since I've written anything, so bare with me!I've got a MySQL database setup with a table that has multiple fields, where one is a numerical
mysq_num_rows
Hi,I want to use:Code: if(mysql_num_rows($ergebnis2)==2)how can the value 2, be retrieved from the database?example, lets say I have ifCode: (mysql_num_rows($ergebnis2)==$limit)$limit =
Multiple Options for a Single Page
For this example I want to use the Handlers option which is under Fed Admin and all the related coding to the handlers option is found on the handlers.php page which includes a list of handlers with a
Php If in MySql query (hiding labels if a field is empty)
Okay, I've been trying to do this for a while, and I'm finally going to ask for help so I can get the simple answer and feel like an idoit .Anyway, I'm building a dynamic driver profile page for my
SAP Logon Failed
I tried to login to SAP through MMC.
Sales orders ans reservations not taken into account on MPS / MRP
Hello,
Change log of Cost centre change in Plant maintenance order
Hi,
array_combine() trouble w/csv file
I have a problem with a piece of code I wrote to import some records from a csv file into mysql. I have a .csv file with about 300 records in it. The code worked perfect while testing on 3 or 4
Delete Client 066 Earlywatch
Hi all,