briskel Posted January 29, 2008 Share Posted January 29, 2008 ok i need help with this script.. ill explain what it does its part of a menu interfae that you can add/edit employees etc from the db when i go to view the employees it shows a drop down menu of the employees and then when i click on the employees name i want to view the info on it goes to the script im having trouble with.. it comes up with the table but not the info from the db. also im running it off apatchi as the person im doing it for wants it to run off a network not a server. <html> <head><title>View Carer</title> <?php include_once ("stylesheet.css"); include_once ('local_config.php'); ?> </head> <body> <?php mysql_connect($dbhost . ":" .$dbport, $dbuname, $dbpass); @mysql_select_db("$dbname"); // Select the fields from the appropriate tables $query = "SELECT CarerID, employees.FirstName, employees.SurName, employees.Sex, employees.DoB, employees.Address, employees.City, employees.StateOrProvince, employees.PostalCode, employees.Nationality, employees.HomePhone, employees.MobilePhone, employees.OtherPhoneNumber, employees.NextofKin, employees.NextofKinPhone, employees.NIN, employees.LanguagesSpoken, employees.Interests, employees.Driver, employees.CarOwner, employees.DayHours, employees.Live-in, employees.Smoker, employees.Notes FROM employees WHERE (employees.CarerID = $CarerID) ORDER BY employees.LastName, employees.FirstName"; $result = mysql_query($query); // Print the relevant information print "<table cellpadding=5>"; print " <tr bgcolor=black> <td><font color=white><b>CarerID</b></font></td> <td><font color=white><b>FirstName</b></font></td> <td><font color=white><b>SurName</b></font></td> <td><font color=white><b>Sex</b></font></td> <td><font color=white><b>DoB</b></font></td> <td><font color=white><b>Address</b></font></td> <td><font color=white><b>City</b></font></td> <td><font color=white><b>StateOrProvince</b></font></td> <td><font color=white><b>PostalCode</b></font></td> <td><font color=white><b>Nationality</b></font></td> <td><font color=white><b>HomePhone</b></font></td> <td><font color=white><b>MobilePhone</b></font></td> <td><font color=white><b>OtherPhoneNumber</b></font></td> <td><font color=white><b>NextofKin</b></font></td> <td><font color=white><b>NextofKinPhone</b></font></td> <td><font color=white><b>NIN</b></font></td> <td><font color=white><b>LanguagesSpoken</b></font></td> <td><font color=white><b>Interests</b></font></td> <td><font color=white><b>Driver(Y/N)</b></font></td> <td><font color=white><b>CarOwner(Y/N)</b></font></td> <td><font color=white><b>DayHours</b></font></td> <td><font color=white><b>Live-in</b></font></td> <td><font color=white><b>Smoker(Y/N)</b></font></td> <td><font color=white><b>Notes</b></font></td></tr>"; for($i=0; $i<$number; $i++) { $CarerID[$i] = mysql_result($result, $i, "CarerID"); $FirstName[$i] = mysql_result($result, $i, "FirstName"); $SurName[$i] = mysql_result($result, $i, "SurName"); $Sex[$i] = mysql_result($result, $i, "Sex"); $DoB[$i] = mysql_result($result, $i, "DoB"); $Address[$i] = mysql_result($result, $i, "Address"); $City[$i] = mysql_result($result, $i, "City"); $StateOrProvince[$i] = mysql_result($result, $i, "StateOrProvince"); $PostalCode[$i] = mysql_result($result, $i, "PostalCode"); $Nationality[$i] = mysql_result($result, $i, "Nationality"); $HomePhone[$i] = mysql_result($result, $i, "HomePhone"); $OtherPhoneNumber[$i] = mysql_result($result, $i, "OtherPhoneNumber"); $MobilePhone[$i] = mysql_result($result, $i, "MobilePhone"); $NextofKin[$i] = mysql_result($result, $i, "NextofKin"); $NextofKinPhone[$i] = mysql_result($result, $i, "NextofKinPhone"); $NIN[$i] = mysql_result($result, $i, "NIN"); $LanguagesSpoken[$i] = mysql_result($result, $i, "LanguagesSpoken"); $Interests[$i] = mysql_result($result, $i, "Interests"); $Driver[$i] = mysql_result($result, $i, "Driver(Y/N)"); $CarOwner[$i] = mysql_result($result, $i, "CarOwner(Y/N)"); $DayHours[$i] = mysql_result($result, $i, "DayHours"); $Livein[$i] = mysql_result($result, $i, "Live-in"); $Smoker[$i] = mysql_result($result, $i, "Smoker(Y/N)"); $Notes = mysql_result($result, $i, "Notese"); /* print even-numbered rows with a grey background, odd-numbered with a white background */ if ($i%2 == 0) { print "<tr bgcolor=lightgrey>"; } else { print "<tr>"; } print "<td>$CarerID </td> <td>$FirstName[$i], $SurName[$i] </td> <td>$Sex[$i] </td> <td>$DoB[$i] </td> <td>$Address[$i] </td> <td>$City[$i] </td> <td>$StateOrProvince[$i] </td> <td>$PostalCode[$i] </td> <td>$Nationality[$i] </td> <td>$HomePhone[$i] </td> <td>$OtherPhoneNumber[$i] </td> <td>$MobilePhone[$i] </td> <td>$NextofKin[$i] </td> <td>$NextofKinPhone[$i] </td> <td>$NIN[$i] </td> <td>$LanguagesSpoken[$i] </td> <td>$Interests[$i] </td> <td>$Driver[$i] </td> <td>$CarOwner[$i] </td> <td>$DayHours[$i] </td> <td>$Live-in[$i] </td> <td>$Smoker[$i] </td> <td>$Notes[$i] </td></tr>"; } print "</table>"; mysql_close(); ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/88383-need-help-with-this-script-its-very-urgent/ Share on other sites More sharing options...
revraz Posted January 29, 2008 Share Posted January 29, 2008 Just use a simple mysql_fetch_array instead of all that mess. Quote Link to comment https://forums.phpfreaks.com/topic/88383-need-help-with-this-script-its-very-urgent/#findComment-452414 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.