to the site admins: please don't be angry if this post actually belongs to "Databases"
Here's my question: In some part of the Back Office of the PHP / MySQL based cms i'm currently working at, an editor can inscribe names of people which are working at the same project. After choosing how many (1 - xxxx) people he wants to inscribe, a second form opens with the following code:
Code: Select all
<?php
if (($p04=='01') || ($p04=='03')) {
for ($i=0; $i < $auth_num; $i++) {
echo "<B>$i.</B> <INPUT TYPE=text NAME="auth_last_$i" VALUE="" SIZE=25> <INPUT TYPE=text NAME="auth_first_$i" VALUE="" SIZE=10> <INPUT TYPE=text NAME="auth_ini_$i" VALUE="" SIZE=2>\n";
echo "<BR>";}}
else {}
?>After the editor has created and filled out let's say 5 rows, the form is send to a validation step, in which a MySQL query should extract data corresponding to the names entered before from three different tables in the staff database:
Code: Select all
<?php
require_once('../../include/databases/db_connect.php3');
$dbName = "DBstaff";
MYSQL_CONNECT($hostname,$username,$password) OR DIE("Database connection failed.");
@mysql_select_db("$dbName") or die("Database not found.");
$query = "SELECT staff.s01, staff.s03, staff.s04, staff_departments.dep_s03, staff_departments.dep_s05, staff_departments.dep_s06, staff_groups.grp_s03, staff_groups.grp_s04, staff_groups.grp_s05, staff_groups.grp_s06 from staff LEFT JOIN staff_departments on staff.s03 = staff_departments.dep_s03 LEFT JOIN staff_groups on staff_departments.dep_s03 = staff_groups.grp_s03 WHERE staff.s05 = '$auth_last_xx' AND staff.s06 = '$auth_first_xx' AND staff.s07 = '$auth_ini_xx'";
$erg = MYSQL_QUERY($query);
$numrows = MYSQL_NUM_ROWS($erg);
?>Thanx in advance.