SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: i must be an idoit!
-
Aug 14, 2000, 12:52 #1
- Join Date
- Aug 2000
- Posts
- 22
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
first i want to thank all of those who gave me suggestions on my earlier post. since the i have simplified and reworked my pages. I feel like i have done nothing more than dug a deeper whole for myself. i have 2 pages, the first is used to do a search the second is used to display the results. But i seem to be doing something wrong. the search page lists the data in my database, but i don't think it is pass the query on to the second page. can some one take a look and see what i
have screwed up ?
<!-- search.php -->
<HTML>
<HEAD>
<TITLE> Employee Profiles </TITLE>
</HEAD>
<BODY>
<H1> Employee Profiles </H1>
<?php
$dbcnx = @mysql_connect("localhost", "root", "password");
mysql_select_db("EmployeeProfiles");
$employees = mysql_query("SELECT ID, Name FROM employees");
$bizs = mysql_query("SELECT ID, bgroup FROM employees");
?>
<FORM ACTION="search.php" METHOD=POST>
<P>View Employees:<BR>
By Employee:
<SELECT NAME="aid" SIZE=1>
<OPTION SELECTED VALUE="">Any Employee
<?php
while ($employee = mysql_fetch_array($employees)) {
$eid = $employee["ID"];
$ename = $employee["Name"];
echo("<OPTION VALUE='$eid'>$ename\n");
}
?>
</SELECT><BR>
By Business Group:
<SELECT NAME="bid" SIZE=1>
<OPTION SELECTED VALUE="">Any Business Group
<?php
while ($biz = mysql_fetch_array($bizs)) {
$bid = $biz["ID"];
$bname = $biz["bgroup"];
echo("<OPTION VALUE='$bid'>$bname\n");
}
?>
</SELECT><BR>
<!-- Containing Text: <INPUT TYPE=TEXT NAME="searchtext"> --><BR>
<INPUT TYPE=SUBMIT NAME="submit" VALUE="View">
</FORM>
<BR>
</BODY>
</html>
<!-- results.php -->
<HTML>
<HEAD>
<TITLE> employee information</TITLE>
</HEAD>
<BODY>
<H1>Manage Jokes</H1>
<P><A HREF="search.php">New Search</A></P>
<?php
$dbcnx = @mysql_connect("localhost", "root", "password");
mysql_select_db("employeeprofiles");
// The basic SELECT statement
$select = "SELECT DISTINCT name, bgroup";
$from = " FROM employees";
$where = "$names = $name["name"];
"$bgroups = $bgroup["bgroup"];
}
?>
<TABLE BORDER=1>
<TR><TH>Name</TH><TH>Position</TH><TH>Extention</TH><TH>Birthday</TH><TH>Home Address</TH><TH>Home Phone</TH><TH>Business Group:</TH></TR>
<?php
$employees = mysql_query($select . $from . $where);
if (!$employees) {
echo("</TABLE>");
echo("<P>Error retrieving employees from database!<BR>".
"Error: " . mysql_error());
exit();
}
while ($employee = mysql_fetch_array($employees)) {
echo("<TR>\n");
$name = $employee["Name"];
$postition = $employee["Position"];
$extention = $employee["Extention"];
$birthday = $employee["Birthday"];
$homeaddress = $employee["HomeAddress"];
$homephone = $employee["HomePhone"];
$bgroup = $empployee["bgroup"];
echo("<TD>$name</TD>\n");
echo("<TD>$position</TD>\n");
echo("<TD>$extention</TD>\n");
echo("<TD>$birthday</TD>\n");
echo("<TD>$homeaddress</TD>\n");
echo("<TD>$homephone</TD>\n");
echo("<TD>$bgroup</TD>\n");
}
?>
</TABLE>
</BODY>
</html>
------------------
bl@cky
-
Aug 14, 2000, 22:32 #2
- Join Date
- Jul 1999
- Location
- Derbyshire, UK
- Posts
- 4,411
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hi,
change the following line:
$where = "$names = $name["name"];
to:
$where = "$names = $name["name"]";
You had missed the quote from the end of the line.
------------------
Karl Austin
KDA Web Services
"Everyone has a photographic memory. Some just don't have film."
-
Aug 15, 2000, 03:16 #3
- Join Date
- Aug 2000
- Posts
- 22
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
ok i figured it out...well some what,
my Form Action = search.php should have been
form action = found.php
the problem now is i get this error:Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in found.php on line 17
i am at a loss as to what i need to do now to fix it. any ideas ?
------------------
bl@cky
Bookmarks