I want to have two search-functions (number and name) to display the database-data in a form. You can edit this data and submit it back in the database.
I had it working with only number, but when I added the name-search, it only used name-search and not number-search.
I am open for ideas and suggestions, for I am a absolute beginner…
[php]<?php
include “login.php”;
$db_server = mysql_connect($db_hostname, $db_username, $db_password);
if (!$db_server) die("Unable to connect to MySQL: " . mysql_error());
$query = “SELECT * FROM fair0001”;
$result = mysql_query($query);
if (!$result) die ("Database access failed: " . mysql_error());
$result2 = mysql_query($query);
if (!$result2) die ("Database access failed: " . mysql_error());
if (isset($_POST[‘standnr0’])) $stdnr = sanitizeString($_POST[‘standnr0’]);
else {$stdnr = “-”;}
$rows = mysql_num_rows($result);
for ($j = 0 ; $j < $rows ; ++$j)
{
$stdnr_chk = mysql_result($result,$j,‘standnr’);
if ($stdnr_chk == $stdnr) {
$stnam = mysql_result($result,$j,‘naam’);
$stadr = mysql_result($result,$j,‘adres’);
$stpst = mysql_result($result,$j,‘postcode’);
$stplt = mysql_result($result,$j,‘plaats’);
$sturl = mysql_result($result,$j,‘url’);
$steml = mysql_result($result,$j,‘mail’);
$stafm = mysql_result($result,$j,‘afm’);
$br_x = mysql_result($result,$j,‘wdx’) * mysql_result($result,$j,‘scl’) / 1000 ;
$hg_y = mysql_result($result,$j,‘hgy’) * mysql_result($result,$j,‘scl’) / 1000 ;
$stid = mysql_result($result,$j,‘ID’);
$status = mysql_result($result,$j,‘class’);
}
else {
}
}
if (isset($_POST[‘standnm0’])) $stnam = sanitizeString($_POST[‘standnm0’]);
else {$stnam = “-”;}
$rows2 = mysql_num_rows($result2);
for ($k = 0 ; $k < $rows2 ; ++$k)
{
$stdnm_chk = mysql_result($result2,$k,‘naam’);
if ($stdnm_chk == $stnam) {
$stdnr = mysql_result($result2,$k,‘standnr’);
$stadr = mysql_result($result2,$k,‘adres’);
$stpst = mysql_result($result2,$k,‘postcode’);
$stplt = mysql_result($result2,$k,‘plaats’);
$sturl = mysql_result($result2,$k,‘url’);
$steml = mysql_result($result2,$k,‘mail’);
$stafm = mysql_result($result2,$k,‘afm’);
$br_x = mysql_result($result2,$k,‘wdx’) * mysql_result($result2,$k,‘scl’) / 1000 ;
$hg_y = mysql_result($result2,$k,‘hgy’) * mysql_result($result2,$k,‘scl’) / 1000 ;
$stid = mysql_result($result2,$k,‘ID’);
$status = mysql_result($result2,$k,‘class’);
}
else {
}
}
echo <<<_END
Zoek standnummer: Zoek standhouder:Bewerk standnummer:
Standnr: | |
Naam: | |
Adres: | |
Postcode: | Plaats: |
Website: | |
Email: | _END; |
Vrij | |
Bezet | |
Optie | |
Vrij | |
Bezet | |
Optie | |
Vrij | |
Bezet | |
Optie | |
|