Search the Community
Showing results for tags 'table'.
-
Hi all I want to display the same drop down list (selection) in every row of my table but I can't seem to work out how to do it, the drop down always seems to come at the end of the table and not on each row. The drop down list is a SQL query (a stored procedure) which is called. I managed to get the dropdown to appear in the correct place when it's just one row in a table. <?php $statement = db()->prepare("EXEC fe_uspAdminUserShowRegisteredAgencies"); $statement->execute(); $agencies= $statement->fetchAll(PDO::FETCH_ASSOC); ?> <p> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <table> <thead> <tr bgcolor="#FFF8DC"></b> <th><center><i>inviter</th> <th><center><i>inviter email</th> <th><center><i>inviter contact</th> <th><center><i>inviter region</th> <th><center><i>inviter skill</th> <th>refer to</th> <th></th> </i> </center> </tr> </thead> <p> </p> <?php if($inviterdetails) { foreach ($inviterdetails as $inviterdetail) { echo "<tr bgcolor=#FFF8DC>"; echo "<td><center>" . $inviterdetail['fullname'] . "</td>"; echo "<td><center>" . $inviterdetail['inviteremail'] . "</td>"; echo "<td><center>" . $inviterdetail['invitercontact'] . "</td>"; echo "<td><center>" . $inviterdetail['inviterregion'] . "</td>"; echo "<td><center>" . $inviterdetail['inviterskill'] . "</td>"; echo "<form action=LogReferal.php?email=referto>"; // echo "<td><left><input type=email id=referto name=referto></td>"; echo "<input type=hidden name=referred value=$inviterdetail[inviteremail]>"; echo "<td><left><input type=submit value=refer></td>"; } } ?> <td><select name="referto" id ="referto"> <?php foreach($agencies as $agencylist) { echo "<option><name=referto type=email>" . $agencylist['email'] . "</option>"; } Produces the desired result However when I try to repeat the process in a separate table which has multiple rows, I get the selection drop down all over the place in this case at the end of the row and not applicable to any particular row. I have managed to get it everywhere except on the row it should be and it doesn't repeat and be relevant to the row. <?php //Connection details section.. $email = current_user(); $statement = db()->prepare("EXEC fe_uspConnectionDetails ?;"); $statement->bindParam(1, $email, PDO::PARAM_STR); $statement->execute(); $details = $statement->fetchAll(PDO::FETCH_ASSOC); ?> <p> <p> <table> <thead> <tr> <th><i>name</th> <th><i>email</th> <th><i>skill</th> <th><i>mobile</th> <th><i>region</th> <th><i>days</th> <th><i><center>refer to</center></th> </tr> </thead> <hr color="#c7c34c" size="4" width="50%"> <p><i>my connections (below)</i></p> <?php if($details) { foreach ($details as $detail) { echo "<td><left>" . $detail['fullname'] . "</td>"; echo "<td><left>" . $detail['connectionemail'] . "</td>"; echo "<td><left>" . $detail['skill'] . "</td>"; echo "<td><left>" . $detail['phonenumber'] . "</td>"; echo "<td><left>" . $detail['region'] . "</td>"; echo "<td><left>" . $detail['daysremaining'] . "</td>"; echo "<form action=LogReferal.php?email=referto>"; // echo "<td><left><input type=email id=referto name=referto></td>"; echo "<input type=hidden name=referred value=$detail[connectionemail]>"; echo "<td><left><input type=submit value=refer></td>"; // echo "<form action=LogReferal.php?email=referto>"; // // echo "<td><left><input type=email id=referto name=referto></td>"; // echo "<input type=hidden name=referred value=$inviterdetail[inviteremail]>"; // echo "<td><left><input type=submit value=refer></td></tr></form>"; } } ?> <td><select name="referto" id ="referto"> <?php foreach($agencies as $agencylist) { echo "<option><name=referto type=email>" . $agencylist['email'] . "</option>"; } ?> </td> I kind of realise the repeating code (for each) has to be somewhere in the main table and not outside the table but I have just got stuck... Any help greatly received Cheers Greg
-
Hello There, Anyone wants to help me how to achive this thing on PHP? I have zero knowledge on Pibot table for PHP Mysqli and minimal knowledge on programming. Here's the link for output And below is the Table Attendance: -- phpMyAdmin SQL Dump -- version 5.2.0 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Jun 01, 2022 at 10:29 AM -- Server version: 10.4.24-MariaDB -- PHP Version: 8.1.6 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `mcgibn` -- -- -------------------------------------------------------- -- -- Table structure for table `attendance` -- CREATE TABLE `attendance` ( `atid` int(11) NOT NULL, `memid` int(11) NOT NULL, `serid` int(11) NOT NULL, `calid` int(11) NOT NULL, `entrydate` timestamp NOT NULL DEFAULT current_timestamp(), `month` varchar(30) CHARACTER SET latin1 NOT NULL, `year` varchar(5) DEFAULT NULL, `createdat` timestamp NOT NULL DEFAULT current_timestamp(), `updatedat` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `viewfrom` int(11) NOT NULL, `astatus` int(11) NOT NULL, `stype` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `attendance` -- INSERT INTO `attendance` (`atid`, `memid`, `serid`, `calid`, `entrydate`, `month`, `year`, `createdat`, `updatedat`, `viewfrom`, `astatus`, `stype`) VALUES (32, 37, 1, 1, '2022-05-31 12:55:28', 'May', '2022', '2022-05-31 12:55:28', '2022-05-31 12:55:28', 0, 1, 2), (33, 37, 2, 1, '2022-05-31 12:55:36', 'May', '2022', '2022-05-31 12:55:36', '2022-05-31 12:55:36', 0, 1, 1), (34, 37, 3, 1, '2022-05-31 12:55:43', 'May', '2022', '2022-05-31 12:55:43', '2022-06-01 03:28:55', 0, 1, 1), (35, 37, 1, 0, '2022-05-31 12:56:15', 'Jun', '2022', '2022-05-31 12:56:15', '2022-06-01 01:17:35', 0, 1, 2), (36, 37, 2, 1, '2022-05-31 12:56:25', 'Jun', '2022', '2022-05-31 12:56:25', '2022-06-01 01:17:35', 0, 1, 1), (37, 37, 3, 1, '2022-05-31 12:56:40', 'Jun', '2022', '2022-05-31 12:56:40', '2022-06-01 01:17:35', 0, 1, 1), (38, 37, 1, 1, '2022-05-31 12:57:24', 'May', '2023', '2022-05-31 12:57:24', '2022-05-31 12:57:24', 0, 1, 2), (39, 37, 2, 1, '2022-05-31 12:57:37', 'May', '2023', '2022-05-31 12:57:37', '2022-05-31 12:57:37', 0, 1, 1), (40, 37, 3, 1, '2022-05-31 12:57:46', 'May', '2023', '2022-05-31 12:57:46', '2022-05-31 12:57:46', 0, 1, 1), (41, 37, 1, 1, '2022-05-31 12:57:57', 'Jun', '2023', '2022-05-31 12:57:57', '2022-06-01 01:17:35', 0, 1, 2), (42, 37, 2, 1, '2022-05-31 12:58:08', 'Jun', '2023', '2022-05-31 12:58:08', '2022-06-01 01:17:35', 0, 1, 1), (43, 37, 3, 1, '2022-05-31 12:58:18', 'Jun', '2023', '2022-05-31 12:58:18', '2022-06-01 01:12:40', 0, 1, 1), (44, 49, 1, 1, '2022-05-31 12:58:32', 'May', '2022', '2022-05-31 12:58:32', '2022-05-31 12:58:32', 0, 1, 2), (45, 49, 2, 1, '2022-05-31 12:58:40', 'May', '2022', '2022-05-31 12:58:40', '2022-05-31 12:58:40', 0, 1, 1), (47, 49, 1, 1, '2022-05-31 12:59:01', 'Jun', '2022', '2022-05-31 12:59:01', '0000-00-00 00:00:00', 0, 1, 2), (48, 49, 2, 1, '2022-05-31 12:59:14', 'Jun', '2022', '2022-05-31 12:59:14', '2022-06-01 01:12:40', 0, 1, 1), (49, 49, 3, 1, '2022-05-31 12:59:31', 'Jun', '2022', '2022-05-31 12:59:31', '2022-06-01 01:12:40', 0, 1, 1), (50, 49, 1, 1, '2022-05-31 12:59:41', 'May', '2023', '2022-05-31 12:59:41', '2022-05-31 12:59:41', 0, 1, 2), (51, 49, 2, 1, '2022-05-31 12:59:49', 'May', '2023', '2022-05-31 12:59:49', '2022-05-31 12:59:49', 0, 1, 1), (52, 49, 3, 1, '2022-05-31 13:00:05', 'May', '2023', '2022-05-31 13:00:05', '2022-05-31 13:00:05', 0, 1, 1), (53, 49, 1, 1, '2022-05-31 13:00:21', 'Jun', '2023', '2022-05-31 13:00:21', '2022-06-01 01:12:40', 0, 1, 2), (54, 49, 2, 1, '2022-05-31 13:00:32', 'Jun', '2023', '2022-05-31 13:00:32', '2022-06-01 01:12:40', 0, 1, 1), (55, 49, 3, 1, '2022-05-31 13:00:43', 'Jun', '2023', '2022-05-31 13:00:43', '2022-06-01 01:12:40', 0, 1, 1), (56, 88, 1, 1, '2022-05-31 13:01:25', 'May', '2022', '2022-05-31 13:01:25', '2022-05-31 13:01:25', 0, 1, 2), (57, 88, 2, 1, '2022-05-31 13:01:30', 'May', '2022', '2022-05-31 13:01:30', '2022-05-31 13:01:30', 0, 1, 1), (58, 88, 3, 1, '2022-05-31 13:01:37', 'May', '2022', '2022-05-31 13:01:37', '2022-05-31 13:01:37', 0, 1, 1), (59, 88, 1, 1, '2022-05-31 13:01:45', 'Jun', '2022', '2022-05-31 13:01:45', '2022-06-01 01:27:00', 0, 1, 2), (60, 88, 2, 1, '2022-05-31 13:01:52', 'Jun', '2022', '2022-05-31 13:01:52', '2022-06-01 01:12:40', 0, 1, 1), (62, 88, 1, 1, '2022-05-31 13:02:37', 'Jun', '2023', '2022-05-31 13:02:37', '2022-06-01 01:27:07', 0, 1, 2), (63, 88, 2, 1, '2022-05-31 13:02:54', 'Jun', '2023', '2022-05-31 13:02:54', '2022-06-01 01:12:40', 0, 1, 1), (64, 88, 3, 1, '2022-05-31 13:03:04', 'Jun', '2023', '2022-05-31 13:03:04', '2022-06-01 01:27:10', 0, 1, 1), (65, 88, 1, 1, '2022-05-31 13:03:14', 'May', '2023', '2022-05-31 13:03:14', '2022-05-31 13:03:14', 0, 1, 2), (66, 88, 2, 1, '2022-05-31 13:03:22', 'May', '2023', '2022-05-31 13:03:22', '2022-05-31 13:03:22', 0, 1, 1), (67, 88, 3, 1, '2022-05-31 13:03:31', 'May', '2023', '2022-05-31 13:03:31', '2022-05-31 13:03:31', 0, 1, 1), (68, 89, 1, 1, '2022-05-31 13:04:21', 'May', '2022', '2022-05-31 13:04:21', '2022-05-31 13:04:21', 0, 1, 2), (69, 89, 2, 1, '2022-05-31 13:04:34', 'May', '2022', '2022-05-31 13:04:34', '2022-05-31 13:04:34', 0, 1, 1), (70, 89, 3, 1, '2022-05-31 13:04:40', 'May', '2022', '2022-05-31 13:04:40', '2022-05-31 13:04:40', 0, 1, 1), (71, 89, 1, 1, '2022-05-31 13:04:49', 'Jun', '2022', '2022-05-31 13:04:49', '2022-06-01 01:12:40', 0, 1, 2), (72, 89, 2, 1, '2022-05-31 13:04:56', 'Jun', '2022', '2022-05-31 13:04:56', '2022-06-01 01:12:40', 0, 1, 1), (73, 89, 3, 1, '2022-05-31 13:05:14', 'Jun', '2022', '2022-05-31 13:05:14', '2022-06-01 01:10:41', 0, 1, 1), (74, 89, 1, 1, '2022-05-31 13:05:24', 'May', '2023', '2022-05-31 13:05:24', '2022-05-31 13:05:24', 0, 1, 2), (75, 89, 2, 1, '2022-05-31 13:05:31', 'May', '2023', '2022-05-31 13:05:31', '2022-05-31 13:05:31', 0, 1, 1), (76, 89, 3, 1, '2022-05-31 13:05:41', 'May', '2023', '2022-05-31 13:05:41', '2022-05-31 13:05:41', 0, 1, 1), (77, 89, 1, 1, '2022-05-31 13:05:51', 'Jun', '2023', '2022-05-31 13:05:51', '2022-06-01 01:12:40', 0, 1, 2), (78, 89, 2, 1, '2022-05-31 13:05:59', 'Jun', '2023', '2022-05-31 13:05:59', '0000-00-00 00:00:00', 0, 1, 1), (79, 89, 3, 1, '2022-05-31 13:06:09', 'Jun', '2023', '2022-05-31 13:06:09', '2022-06-01 01:27:12', 0, 1, 1), (80, 84, 1, 1, '2022-05-31 13:07:19', 'May', '2022', '2022-05-31 13:07:19', '2022-06-01 03:40:25', 0, 1, 2), (81, 84, 2, 1, '2022-05-31 13:07:24', 'May', '2022', '2022-05-31 13:07:24', '2022-05-31 13:07:24', 0, 1, 1), (82, 84, 3, 1, '2022-05-31 13:07:31', 'May', '2022', '2022-05-31 13:07:31', '2022-06-01 03:42:52', 0, 1, 1), (83, 84, 1, 1, '2022-05-31 13:07:38', 'Jun', '2022', '2022-05-31 13:07:38', '2022-06-01 01:12:40', 0, 1, 2), (84, 84, 2, 1, '2022-05-31 13:07:45', 'Jun', '2022', '2022-05-31 13:07:45', '2022-06-01 01:27:14', 0, 1, 1), (85, 84, 3, 1, '2022-05-31 13:07:53', 'Jun', '2022', '2022-05-31 13:07:53', '2022-06-01 01:27:16', 0, 1, 1), (86, 84, 1, 1, '2022-05-31 13:08:12', 'May', '2023', '2022-05-31 13:08:12', '2022-05-31 13:08:12', 0, 1, 2), (87, 84, 2, 1, '2022-05-31 13:08:23', 'May', '2023', '2022-05-31 13:08:23', '2022-05-31 13:08:23', 0, 1, 1), (88, 84, 3, 1, '2022-05-31 13:08:30', 'May', '2023', '2022-05-31 13:08:30', '2022-05-31 13:08:30', 0, 1, 1), (89, 84, 1, 1, '2022-05-31 13:08:44', 'Jun', '2023', '2022-05-31 13:08:44', '2022-06-01 01:27:20', 0, 1, 2), (90, 84, 2, 1, '2022-05-31 13:08:58', 'Jun', '2023', '2022-05-31 13:08:58', '2022-06-01 01:27:22', 0, 1, 1), (91, 84, 3, 1, '2022-05-31 13:09:06', 'Jun', '2023', '2022-05-31 13:09:06', '2022-06-01 01:27:26', 0, 1, 1), (92, 121, 1, 1, '2022-05-31 13:09:59', 'May', '2022', '2022-05-31 13:09:59', '2022-05-31 13:09:59', 0, 1, 2), (93, 121, 2, 1, '2022-05-31 13:10:06', 'May', '2022', '2022-05-31 13:10:06', '2022-05-31 13:10:06', 0, 1, 1), (94, 121, 3, 1, '2022-05-31 13:10:13', 'May', '2022', '2022-05-31 13:10:13', '2022-05-31 13:10:13', 0, 1, 1), (95, 121, 1, 1, '2022-05-31 13:10:20', 'Jun', '2022', '2022-05-31 13:10:20', '2022-06-01 01:27:27', 0, 1, 2), (96, 121, 2, 1, '2022-05-31 13:10:29', 'Jun', '2022', '2022-05-31 13:10:29', '2022-06-01 01:27:29', 0, 1, 1), (97, 121, 3, 1, '2022-05-31 13:10:38', 'Jun', '2022', '2022-05-31 13:10:38', '2022-06-01 01:27:30', 0, 1, 1), (98, 121, 1, 1, '2022-05-31 13:10:50', 'May', '2023', '2022-05-31 13:10:50', '2022-05-31 13:10:50', 0, 1, 2), (99, 121, 2, 1, '2022-05-31 13:10:57', 'May', '2023', '2022-05-31 13:10:57', '2022-05-31 13:10:57', 0, 1, 1), (100, 121, 3, 1, '2022-05-31 13:11:11', 'May', '2023', '2022-05-31 13:11:11', '2022-05-31 13:11:11', 0, 1, 1), (101, 107, 1, 1, '2022-05-31 13:11:34', 'May', '2022', '2022-05-31 13:11:34', '2022-05-31 13:11:34', 0, 1, 2), (102, 107, 2, 1, '2022-05-31 13:11:39', 'May', '2022', '2022-05-31 13:11:39', '2022-05-31 13:11:39', 0, 1, 1), (103, 107, 3, 1, '2022-05-31 13:11:44', 'May', '2022', '2022-05-31 13:11:44', '2022-05-31 13:11:44', 0, 1, 1), (104, 107, 1, 1, '2022-05-31 13:11:51', 'Jun', '2022', '2022-05-31 13:11:51', '2022-06-01 01:10:41', 0, 1, 2), (105, 107, 2, 1, '2022-05-31 13:12:05', 'Jun', '2022', '2022-05-31 13:12:05', '2022-06-01 01:27:32', 0, 1, 1), (106, 107, 3, 1, '2022-05-31 13:12:14', 'Jun', '2022', '2022-05-31 13:12:14', '2022-06-01 07:57:46', 0, 1, 1), (107, 107, 1, 1, '2022-05-31 13:12:28', 'May', '2023', '2022-05-31 13:12:28', '2022-05-31 13:12:28', 0, 1, 2), (108, 107, 2, 1, '2022-05-31 13:12:37', 'May', '2023', '2022-05-31 13:12:37', '2022-05-31 13:12:37', 0, 1, 1), (109, 107, 3, 1, '2022-05-31 13:12:45', 'May', '2023', '2022-05-31 13:12:45', '2022-05-31 13:12:45', 0, 1, 1), (110, 107, 1, 1, '2022-05-31 13:12:56', 'Jun', '2023', '2022-05-31 13:12:56', '2022-06-01 01:27:36', 0, 1, 2), (111, 107, 2, 1, '2022-05-31 13:13:05', 'Jun', '2023', '2022-05-31 13:13:05', '2022-06-01 01:27:38', 0, 1, 1), (112, 107, 3, 1, '2022-05-31 13:17:28', 'Jun', '2023', '2022-05-31 13:17:28', '2022-06-01 01:27:40', 0, 1, 1), (113, 113, 1, 1, '2022-05-31 13:18:57', 'May', '2022', '2022-05-31 13:18:57', '2022-05-31 13:18:57', 0, 1, 1), (114, 113, 2, 1, '2022-05-31 13:19:04', 'May', '2022', '2022-05-31 13:19:04', '2022-05-31 13:19:04', 0, 1, 1), (115, 113, 3, 1, '2022-05-31 13:19:10', 'May', '2022', '2022-05-31 13:19:10', '2022-05-31 13:19:10', 0, 1, 1), (116, 113, 1, 1, '2022-05-31 13:19:18', 'Jun', '2022', '2022-05-31 13:19:18', '2022-06-01 01:10:41', 0, 1, 1), (117, 113, 2, 1, '2022-05-31 13:19:24', 'Jun', '2022', '2022-05-31 13:19:24', '2022-06-01 01:27:41', 0, 1, 1), (118, 113, 3, 1, '2022-05-31 13:19:31', 'Jun', '2022', '2022-05-31 13:19:31', '2022-06-01 07:57:43', 0, 1, 1), (119, 113, 1, 1, '2022-05-31 13:19:41', 'May', '2023', '2022-05-31 13:19:41', '2022-05-31 13:19:41', 0, 1, 1), (120, 113, 2, 1, '2022-05-31 13:19:48', 'May', '2023', '2022-05-31 13:19:48', '2022-05-31 13:19:48', 0, 1, 1), (121, 113, 3, 1, '2022-05-31 13:19:54', 'May', '2023', '2022-05-31 13:19:54', '2022-05-31 13:19:54', 0, 1, 1), (122, 113, 1, 1, '2022-05-31 13:20:04', 'Jun', '2023', '2022-05-31 13:20:04', '2022-06-01 01:27:45', 0, 1, 1), (123, 113, 2, 1, '2022-05-31 13:20:13', 'Jun', '2023', '2022-05-31 13:20:13', '2022-06-01 01:27:49', 0, 1, 1), (124, 113, 3, 1, '2022-05-31 13:20:22', 'Jun', '2023', '2022-05-31 13:20:22', '2022-06-01 01:27:53', 0, 1, 1), (125, 119, 1, 1, '2022-05-31 13:21:12', 'May', '2022', '2022-05-31 13:21:12', '2022-05-31 13:21:12', 0, 1, 1), (126, 119, 2, 1, '2022-05-31 13:21:18', 'May', '2022', '2022-05-31 13:21:18', '2022-05-31 13:21:18', 0, 1, 1), (127, 119, 3, 1, '2022-05-31 13:21:29', 'May', '2022', '2022-05-31 13:21:29', '2022-05-31 13:21:29', 0, 1, 1), (128, 119, 1, 1, '2022-05-31 13:21:45', 'Jun', '2022', '2022-05-31 13:21:45', '2022-06-01 01:27:54', 0, 1, 1), (129, 119, 2, 1, '2022-05-31 13:21:53', 'Jun', '2022', '2022-05-31 13:21:53', '2022-06-01 01:27:56', 0, 1, 1), (130, 119, 3, 1, '2022-05-31 13:22:16', 'Jun', '2022', '2022-05-31 13:22:16', '2022-06-01 01:28:00', 0, 1, 1), (131, 119, 1, 1, '2022-05-31 13:22:24', 'May', '2023', '2022-05-31 13:22:24', '2022-05-31 13:22:24', 0, 1, 1), (132, 119, 2, 1, '2022-05-31 13:22:30', 'May', '2023', '2022-05-31 13:22:30', '2022-05-31 13:22:30', 0, 1, 1), (133, 119, 3, 1, '2022-05-31 13:22:36', 'May', '2023', '2022-05-31 13:22:36', '2022-05-31 13:22:36', 0, 1, 1), (134, 119, 1, 1, '2022-05-31 13:22:45', 'Jun', '2023', '2022-05-31 13:22:45', '2022-06-01 01:28:03', 0, 1, 1), (135, 119, 2, 1, '2022-05-31 13:22:53', 'Jun', '2023', '2022-05-31 13:22:53', '2022-06-01 01:28:04', 0, 1, 1), (136, 119, 3, 1, '2022-05-31 13:23:10', 'Jun', '2023', '2022-05-31 13:23:10', '2022-06-01 01:28:08', 0, 1, 1), (137, 13, 1, 1, '2022-05-31 13:40:26', 'May', '2022', '2022-05-31 13:40:26', '2022-05-31 13:40:26', 0, 1, 1), (138, 13, 2, 1, '2022-05-31 13:40:31', 'May', '2022', '2022-05-31 13:40:31', '2022-05-31 13:40:31', 0, 1, 1), (139, 13, 3, 1, '2022-05-31 13:40:36', 'May', '2022', '2022-05-31 13:40:36', '2022-05-31 13:40:36', 0, 1, 1), (140, 13, 1, 1, '2022-05-31 13:40:42', 'Jun', '2022', '2022-05-31 13:40:42', '2022-06-01 01:28:10', 0, 1, 1), (141, 13, 2, 1, '2022-05-31 13:40:53', 'Jun', '2022', '2022-05-31 13:40:53', '2022-06-01 01:28:11', 0, 1, 1), (142, 13, 3, 1, '2022-05-31 13:41:11', 'Jun', '2022', '2022-05-31 13:41:11', '2022-06-01 03:41:46', 0, 1, 1); -- -- Indexes for dumped tables -- -- -- Indexes for table `attendance` -- ALTER TABLE `attendance` ADD PRIMARY KEY (`atid`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `attendance` -- ALTER TABLE `attendance` MODIFY `atid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=143; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; I followed this code below and it has different results and can't really do it myself, <?php if(isset($_POST['search'])) { $search = $_POST['search'] ?? ''; $year = $_POST['year'] ?? ''; $month = $_POST['month'] ?? ''; $sql = "SELECT DISTINCT entrydate FROM attendance ORDER BY entrydate "; $res = $link->query($sql); // mysqli query while ($row = $res->fetch_row()) { $dates[] = $row[0]; } /*********************************** * Table headings * ************************************/ $emptyRow = array_fill_keys($dates,''); // format dates foreach ($dates as $k=>$v) { $dates[$k] = date('d-M', strtotime($v)); } $heads = "<table class='table table-stripped table-bordered'>\n"; $heads .= "<tr><th>Name</th><th>" . join('</th><th>', $dates) . "</th></tr>\n"; /*********************************** * Main data * ************************************/ $sql = "SELECT entrydate, memid, astatus FROM attendance ORDER BY memid"; $res = $link->query($sql); $curname=''; $tdata = ''; while (list($d, $sn, $s) = $res->fetch_row()) { if ($curname != $sn) { if ($curname) { $tdata .= "<tr><td>$curname</td><td>" . join('</td><td>', $rowdata). "</td></tr>\n"; } $rowdata = $emptyRow; $curname = $sn; } $rowdata[$d] = $s; } $tdata .= "<tr><td>$curname</td><td>" . join('</td><td>', $rowdata). "</td></tr>\n"; $tdata .= "</table\n"; } ?> <?php echo $heads; echo $tdata; ?> Notes: memid = Member name serid = Services like (PM, PBB, WS) calid = 1st Week, 2nd Week and so-on. entrydate = TimeIn date. Hoping that there are someone who's able to help a newbie like me. Thank you and appreciate that.
-
What is the best table structure when constructing what will be a potentially large multi-user platform? Example- Each user inputs their own individualized information into a table, for recall only to that specific user and to certain other users defined as administrators or half-administrators super users. Would it be better to store this all in a single table, or to give each user their own individual table on formation of the account?
- 10 replies
-
- table
- database php
-
(and 3 more)
Tagged with:
-
I have a questions table and feedback table. I able to foreach the question header but not the feedback. My code as above: <?php $sql2 = "SELECT DISTINCT[question_id],[q_text] FROM [question]"; $ques = array(); $stmt2 = sqlsrv_query($conn, $sql2, $ques); while ($row = sqlsrv_fetch_array($stmt2, SQLSRV_FETCH_ASSOC)) { $ques[$row['question_id']] = $row['q_text']; } $sql = "SELECT [question_id], [Expr3],[Expr2] FROM [feedback] ORDER BY [Expr2] ASC"; $data = array(); $stmt = sqlsrv_query($conn, $sql); while (list($qid, $a, $eid) = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_NUMERIC)) { if (!isset($data[$qid][$eid])) { $data[$qid][$eid] = $newArray2; } $data[$qid][$eid][] = $a; } ?> <div class="container"> <?php // produce table header echo "<table border='1' id='table2excel'>\n"; echo "<tr><th>Employee ID</th>"; // loop over array of questions for the header foreach ($ques as $question) { echo "<th>$question</th>"; } echo "</tr>\n"; foreach ($data as $qid => $question) { foreach ($question as $question => $replies) { echo "<tr><td>$question</td>"; foreach (array_keys($ques) as $q_id) { echo "<td>"; echo $replies[$q_id]; echo "</td>"; } echo "</tr>\n"; echo "</tr>\n"; } } echo "</table>\n"; Questions Table: question_id q_text 1 Do you Like Red Color? 02A Do you Like Yellow Color? 02B Do you Like Blue Color? 3 Do you Like Green Color? 4 What color you like among them? 5 Do you Like Purple Color? 6 Do you Like Gold Color? 7 Do you Like Rose Gold Color? 8 Do you Like Black Color? 9 Do you Like Orange Color? The question 4, might be multiple answer. Feedback Table: question_id Expr2 Expr3 1 EMP1001 Yes 02A EMP1001 No 4 EMP1001 Red 4 EMP1001 Yellow 4 EMP1001 Blue 5 EMP1001 No 6 EMP1001 No 3 EMP1001 Yes 02B EMP1001 Yes 7 EMP1001 Yes 8 EMP1001 Yes 9 EMP1001 Yes 1 EMP1002 Yes 02A EMP1002 No 4 EMP1002 Red 5 EMP1002 No 6 EMP1002 Yes 3 EMP1002 Yes 02B EMP1002 Yes 7 EMP1002 No 8 EMP1002 9 EMP1002 Yes Result: Employee ID Do you Like Red Color? Do you Like Yellow Color? Do you Like Blue Color? Do you Like Green Color? What color you like among them? Do you Like Purple Color? Do you Like Gold Color? Do you Like Rose Gold Color? Do you Like Black Color? Do you Like Orange Color? EMP1001 EMP1002 EMP1001 EMP1002 EMP1001 EMP1002 EMP1001 EMP1002 EMP1001 EMP1002 EMP1001 EMP1002 EMP1001 EMP1002 EMP1001 EMP1002 EMP1001 EMP1002 EMP1001 EMP1002 Expected Result: Employee ID Do you Like Red Color? Do you Like Yellow Color? Do you Like Blue Color? Do you Like Green Color? What color you like among them? Do you Like Purple Color? Do you Like Gold Color? Do you Like Rose Gold Color? Do you Like Black Color? Do you Like Orange Color? EMP1001 Yes No Yes Yes Red No No Yes Yes Yes EMP1001 Yes No Yes Yes Yellow No No Yes Yes Yes EMP1001 Yes No Yes Yes Blue No No Yes Yes Yes EMP1002 Yes No Yes Yes Red No Yes No Yes The question id no.4 will allow multiple choice to select, hence there will be multiple feedback for that particular question. foreach.txt
-
Hello guys, I have a page named compare.php with two dropdown lists wich are populated with same values from a specific table. Now what i want to do is when a user is selecting one value from the first dropdown and another value from the secound dropdown to be redirected to a page lets say compare-items.php?id=1&id=2 and here in two different cols to get the values for the items, in the first col the values for the first item, and in the secound col the values from the sec item. How can i achive that? Thank you very much!
- 4 replies
-
- comparing.
- row
-
(and 3 more)
Tagged with:
-
Here's what I am trying to do. Users Table user_id, sponsor_id, username, filled_positions, position_1, position_2, position_3, position_4, position_5 1 0 user 1 4 user 2 user 3 user 4 user 5 2 1 user 2 2 user 4 user 5 3 1 user 3 4 2 user 4 5 2 user 5 Above is a "Users" table. Here's what I am trying to do. Insert new users into the table. Say I already have the users table set up with 5 users. I want to add User 6. I want to loop through the users in the table and find the next empty position and update it with the new user id. In this scenario diagram above, the next empty position is Row 1 - position_5. The one after that is Row 2 - position_3 and then Row 2 - position_4...etc. It basically loops through rows and checks each position. So User 6 will be placed under Row 1 - position_5 and User 7 will be placed under Row 2 - position_3. How can one go on about doing that?
-
I currently have a fulltext search that works. It matches against a item title column in mysql database. Now I would like to include another column to match against. How can that be done properly? Here's my code. Where it says MATCH, I would like to include the type_1 column as well; like this(type_1.type_1_name). $get_records = $db->prepare("SELECT items.*, type_1.* FROM items LEFT JOIN type_1 ON items.type_1 = type_1.type_1_id WHERE MATCH(items.item_title) AGAINST('$search_query' IN BOOLEAN MODE) ORDER BY items.item_id DESC LIMIT {$limit} OFFSET ".$offset); $get_records->execute(); $result_records = $get_records->fetchAll(PDO::FETCH_ASSOC); if(count($result_records) > 0){ foreach($result_records as $row) { // get results } }
-
I am finding that if I have "0"(zero) value in form select option, it won't select this option or submit data. If I change this value to any other number to text, it will work. Is there a way to fix this? I have to have an option where I am able to choose to submit "0" value to the database table. <option value="0" <?php if(empty($_POST['special'])) {} else { if($_POST['special'] == 0) { echo 'selected'; } } ?> >None</option>
-
Here's what I am trying to do. Retrieve "title" and "slug title" from all the rows in a table. Update them with new "title", "slug title" and "brand name". Here's my query. It updates the table with the brand names for each row. But for some reason, it removes the title and slug title from all the rows in the table. Is there a reason why it's doing that? function getIt($var) { $pos = strpos($var, ' - '); echo(substr($var, $pos+3)."\n"); } if(isset($_POST['submit'])) { $get_record = $db->prepare("SELECT * FROM items"); $get_record->execute(); $result_record = $get_record->fetchAll(PDO::FETCH_ASSOC); if(count($result_record) > 0){ foreach($result_record as $row) { $get_item_id = intval($row['item_id']); $get_item_title = trim($row['item_title']); $get_item_title_slug = trim($row['item_title_slug']); $new_title = getIt($get_item_title); $new_title_slug = Output::createSlug($new_title); $brand_name = substr($get_item_title, 0, strpos($get_item_title, ' - ')); $update_record = $db->prepare("UPDATE items SET brand_name = :brand_name, item_title = :item_title, item_title_slug = :item_title_slug WHERE item_id = :item_id"); $update_record->bindParam(':item_id', $get_item_id); $update_record->bindParam(':brand_name', $brand_name); $update_record->bindParam(':item_title', $new_title); $update_record->bindParam(':item_title_slug', $new_title_slug); if(!$update_record->execute()) { $errors[] = 'There was a problem updating the item.'; } } } else { $errors[] = 'No item found.'; } }
-
Say I have 2 tables. Table 1: Type(type_id, type_name) Table 2: Records(record_id, record_name, record_type) Under the "record_type" column, is it better to use type_id(eg. 10) or type_name(eg. Clothing & Watches)? If the answer is use the name, is it better to use the original name(Clothing & Watches) or a slug name(clothing-watches)?
-
Hi Peeps So basically im creating a "customer page" i have 2 tabs, 1 is customer info which is the primary and the invoicing tab I have a date picker in the invoicing tab which im hoping will populate a table below. I tried having the form post to php but this resets the page which then goes to the customer info tab so im guessing this will have to be done with jquery and ajax. could someone please point me in the right direction to do this? here is the current page for better explanation: All help is greatly appreciated in advance Mooseh
-
Hi guys, i have a table with 6 COLS and 12 ROWS. In the first column is a filed with dimensions (4 ml) and in the other 5 columns are the prices with are different one from another. What i like to do is when i click on a cell from the table to autocomplete bellow 2 inputs 1 with dimension and another with the price from that cell. I've manage to do the first part but the secound one i don't know how to do. Please have a look at my code below. (function () { if (window.addEventListener) { window.addEventListener('load', run, false); } else if (window.attachEvent) { window.attachEvent('onclick', run); } function run() { var t = document.getElementById('myTable'); t.onclick = function (event) { event = event || window.event; //IE8 var target = event.target || event.srcElement; while (target && target.nodeName != 'TR') { // find TR target = target.parentElement; } //if (!target) { return; } //tr should be always found //var cells = target.cells; //cell collection - https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableRowElement var cells = target.getElementsByTagName('td'); //alternative var f1 = document.getElementById('Inaltime / Dimensiune'); var f2 = document.getElementById('Ø 14'); var f3 = document.getElementById('Ø 16'); var f4 = document.getElementById('Ø 18'); var f5 = document.getElementById('Ø 20'); var f6 = document.getElementById('Ø 25'); f1.value = cells[0].innerHTML; f2.value = cells[1].innerHTML; f3.value = cells[2].innerHTML; f4.value = cells[3].innerHTML; f5.value = cells[4].innerHTML; f6.value = cells[5].innerHTML; //console.log(target.nodeName, event); }; } })(); <table id="myTable" class="demo"> <caption> <h3>Sisteme de cosuri fum TONA <span class="orange-price">- 15% REDUCERE</span></h3></caption> <thead> <tr> <th> Inaltime / Dimensiune </th> <th>Ø 14</th> <th>Ø 16</th> <th>Ø 18</th> <th>Ø 20</th> <th>Ø 25</th> </tr> </thead> <tbody> <tr> <td>5 ml <br> </td> <td><span class="old-price">583 EUR</span> <br> <span class="orange-price">496 EUR</span> </td> <td><span class="old-price">630 EUR</span> <br> <span class="orange-price">536 EUR</span> </td> <td><span class="old-price">661 EUR</span> <br> <span class="orange-price">562 EUR</span> </td> <td><span class="old-price">704 EUR</span> <br> <span class="orange-price">598 EUR</span> </td> <td><span class="old-price">1125 EUR</span> <br> <span class="orange-price">956 EUR</span> </td> </tr> <tr> <td>5.5 ml</td> <td><span class="old-price">608 EUR</span> <br> <span class="orange-price">517 EUR</span> </td> <td><span class="old-price">659 EUR</span> <br> <span class="orange-price">560 EUR</span> </td> <td><span class="old-price">692 EUR</span> <br> <span class="orange-price">588 EUR</span> </td> <td><span class="old-price">737 EUR</span> <br> <span class="orange-price">626 EUR</span> </td> <td><span class="old-price">1187 EUR</span> <br> <span class="orange-price">1009 EUR</span> </td> </tr> <tr> <td>6 ml</td> <td><span class="old-price">634 EUR</span> <br> <span class="orange-price">539 EUR</span> </td> <td><span class="old-price">687 EUR</span> <br> <span class="orange-price">584 EUR</span> </td> <td><span class="old-price">722 EUR</span> <br> <span class="orange-price">614 EUR</span> </td> <td><span class="old-price">770 EUR</span> <br> <span class="orange-price">655 EUR</span> </td> <td><span class="old-price">1250 EUR</span> <br> <span class="orange-price">1063 EUR</span> </td> </tr> <tr> <td>6.5 ml</td> <td><span class="old-price">659 EUR</span> <br> <span class="orange-price">560 EUR</span> </td> <td><span class="old-price">716 EUR</span> <br> <span class="orange-price">609 EUR</span> </td> <td><span class="old-price">752 EUR</span> <br> <span class="orange-price">639 EUR</span> </td> <td><span class="old-price">803 EUR</span> <br> <span class="orange-price">683 EUR</span> </td> <td><span class="old-price">1313 EUR</span> <br> <span class="orange-price">1117 EUR</span> </td> </tr> <tr> <td>7 ml</td> <td><span class="old-price">685 EUR</span> <br> <span class="orange-price">582 EUR</span> </td> <td><span class="old-price">745 EUR</span> <br> <span class="orange-price">633 EUR</span> </td> <td><span class="old-price">782 EUR</span> <br> <span class="orange-price">665 EUR</span> </td> <td><span class="old-price">836 EUR</span> <br> <span class="orange-price">711 EUR</span> </td> <td><span class="old-price">1375 EUR</span> <br> <span class="orange-price">1169 EUR</span> </td> </tr> <tr> <td>7.5 ml</td> <td><span class="old-price">710 EUR</span> <br> <span class="orange-price">604 EUR</span> </td> <td><span class="old-price">774 EUR</span> <br> <span class="orange-price">660 EUR</span> </td> <td><span class="old-price">812 EUR</span> <br> <span class="orange-price">690 EUR</span> </td> <td><span class="old-price">869 EUR</span> <br> <span class="orange-price">739 EUR</span> </td> <td><span class="old-price">1438 EUR</span> <br> <span class="orange-price">1222 EUR</span> </td> </tr> <tr> <td>8 ml</td> <td><span class="old-price">735 EUR</span> <br> <span class="orange-price">625 EUR</span> </td> <td><span class="old-price">803 EUR</span> <br> <span class="orange-price">683 EUR</span> </td> <td><span class="old-price">843 EUR</span> <br> <span class="orange-price">717 EUR</span> </td> <td><span class="old-price">902 EUR</span> <br> <span class="orange-price">767 EUR</span> </td> <td><span class="old-price">1500 EUR</span> <br> <span class="orange-price">1275 EUR</span> </td> </tr> <tr> <td>8.5 ml</td> <td><span class="old-price">761 EUR</span> <br> <span class="orange-price">647 EUR</span> </td> <td><span class="old-price">831 EUR</span> <br> <span class="orange-price">706 EUR</span> </td> <td><span class="old-price">873 EUR</span> <br> <span class="orange-price">742 EUR</span> </td> <td><span class="old-price">935 EUR</span> <br> <span class="orange-price">795 EUR</span> </td> <td><span class="old-price">1563 EUR</span> <br> <span class="orange-price">1329 EUR</span> </td> </tr> <tr> <td>9 ml</td> <td><span class="old-price">802 EUR</span> <br> <span class="orange-price">682 EUR</span> </td> <td><span class="old-price">876 EUR</span> <br> <span class="orange-price">745 EUR</span> </td> <td><span class="old-price">919 EUR</span> <br> <span class="orange-price">781 EUR</span> </td> <td><span class="old-price">984 EUR</span> <br> <span class="orange-price">836 EUR</span> </td> <td><span class="old-price">1642 EUR</span> <br> <span class="orange-price">1396 EUR</span> </td> </tr> <tr> <td>9.5 ml</td> <td><span class="old-price">827 EUR</span> <br> <span class="orange-price">703 EUR</span> </td> <td><span class="old-price">905 EUR</span> <br> <span class="orange-price">769 EUR</span> </td> <td><span class="old-price">949 EUR</span> <br> <span class="orange-price">807 EUR</span> </td> <td><span class="old-price">1017 EUR</span> <br> <span class="orange-price">864 EUR</span> </td> <td><span class="old-price">1704 EUR</span> <br> <span class="orange-price">1448 EUR</span> </td> </tr> <tr> <td>10 ml</td> <td><span class="old-price">853 EUR</span> <br> <span class="orange-price">725 EUR</span> </td> <td><span class="old-price">934 EUR</span> <br> <span class="orange-price">794 EUR</span> </td> <td><span class="old-price">979 EUR</span> <br> <span class="orange-price">832 EUR</span> </td> <td><span class="old-price">1050 EUR</span> <br> <span class="orange-price">893 EUR</span> </td> <td><span class="old-price">1767 EUR</span> <br> <span class="orange-price">1502 EUR</span> </td> </tr> <tbody> </table>
- 3 replies
-
- table
- javascript
-
(and 1 more)
Tagged with:
-
Is it possible to save history of all my tables from my other site and copy all those history into my new one? I have milions of posts at my site, but since im moving to other one which is a free host, i want to have all those history. I can easily copy main structure but i have like millions of posts and i want to keep them all.
- 1 reply
-
- table
- phpmyadmin
-
(and 1 more)
Tagged with:
-
Hi everyone, I am still learning PHP, I am getting better a little, but i am still struggle with while and foreach loop to create few columns. I create one column with while or foreach, but I couldn't figure to create few columns intsead of one long column. Can you help me or make any suggest? Thank you so much
-
Hello I've been developing a unique way to make my menus and sites using a single PHP file over the last few years. the layout itself uses several tables, the main table that is a single column by 3 rows. the middle row is then embedded with a second table of 3 columns and 1 row and the mid column/cell has the menu followed by a single cell table that has a stack over flow so that if there is more data in the cell then there is vertical space a scroll bar appears. Here lays the problem though with all the different devices and with screens that have the horizontal and vertical accesses switched the ration is now off set and the site doesn't look correct on the screens like this (there is a lot of blank space at the bottom of the screen). to check out a working site you can go to http://paradisealleywrestling.com here is the code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="description" content="Paradise Alley Wrestling School" > <meta name="keywords" content="wrestling schools, wrestling, wrestling schools ct, wrestling schools east haven, wrestling schools east haven ct, wrestling schools connecticut, wrestling schools east haven connecticut, mario mancini, dave paradise, pretty paul roma, paul roma, wwf wrestlers, wrestlers, become a wrestler, become a pro wrestler, become a professional wrestler, how to become a wrestler, how to become a pro wrestler, how to become a professional wrestler, best wrestling schools" > <meta name="description" content="So you want to be a Pro Wrestler??? Well you've come to the right place. At Paradise Valley Wrestling School. you'll learn from the Pros the art of Pro Wrestling. They will train you in Agility, Ring Awareness, High Flying Skils and Ring Psychology. So give us a call at (203)410-5152 and see just who you can pin down." > <title>Paradise Alley Wrestling School</title> <LINK REL="SHORTCUT ICON" HREF="images/logo.ico"> <!-- this is the CSS script for the menu --> <style type="text/css" media="screen"> #maymenu {margin: 0; padding: 0; } #mymenu li {margin: 0; padding: 0; list-style: none; float: left; } #mymenu li a { display: none; margin: 0 0px 0 0; padding: 0px 0px; width: 80px; background: url(images/buttons/back.png); color: none; text-align: center; } #mymenu li a:hover { background: url(images/buttons/back.png)} #mymenu ul { position: absolute; visibility: hidden; margin: 0; padding: 0; background: url(images/buttons/back.png); border: 0px solid #ffffff } #mymenu ul a {position: relative; display: none; margin: 0; padding: 0px 0px; width: 80px; text-align: left; background: url(images/buttons/back.png); color: none; } #mymenu ul a:hover {background: url(images/buttons/back.png); } <!-- this is the css to turn the submit button into a link --> .submit { background: url(images/buttons/back.png); margin: 0; padding: 0; border: none; cursor: pointer; font-family: Arial, Helvetica, Verdana, Geneva, sans-serif; font-size: 13px; line-height: 16px; color: #FF5F55;button { overflow: visible; width: auto; } } </style> <!-- this is the java script for the menu --> <script type="text/javascript"> //Variables for the Menu declaration var timer = 0;var item = 0; //function for opening of submenu elements function openelement(num){ // checks whether there is an open submenu and makes it invisible if(item) item.style.visibility = 'hidden'; // shows choosen submenu element item = document.getElementById(num); item.style.visibility = 'visible'; } // function for closing submenu element function closeelelement(){ // closes the submenu and loads the timer to 500 ms timer = window.setTimeout("if(item) item.style.visibility = 'hidden';", 500); } //this is the line of code that has the syntax error //function for keeping the menu open after 500 mstimer function keepsubmenu(){ window.clearTimeout(timer);} // hides the visualized menu after clicking outside of it's area and expiring of the loaded timerdocument.onclick = closeelement; </script> <!-- this is the CSS for the font --> <style> @font-face { font-family: GoodCityModern; src: url('fonts/GoodCityModern.otf'); } gothic { font-family: GoodCityModern } </style> </head> <body bgcolor="lightblue" text="darkblue"> <script language="php"> session_start() ; //Starts the session so that the veriables can be read by the browser if(isset($_SESSION['selection']))// sees if the veriable is active yet $page = $_SESSION['selection']; // reads session variables else $_SESSION['selection'] = ("0"); $page = $_SESSION['selection']; // reads session variables if(isset($_POST['selection']))// sees if the veriable is active yet $page = $_POST['selection']; // reads session variables else { $page = $_SESSION['selection']; } // this sets up the correct order for the page topbar(); leftsidebar(); mainmenu($page); mainpage($page); rightsidebar(); bottombar(); //this loads the top bar function topbar(){ </script> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr height="65px"> <td background="images/backgrounds/homepage/topbar.jpg" width="100%" height="33" > <center> <img src="images/Logo.png" width="206" height="89"> </font></center> </td> </tr> <script language="php"> } //this loads the left side bar function leftsidebar() { </script> <tr height="250"> <td> <table width="100%" border="0" bordercolor="#FFDF00" cellpadding="0" cellspacing="0"> <tr> <td background="images/backgrounds/homepage/sidebars.jpg" width="13%"> <br /><br /><br /> <p><iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com/pages/Paradise-Alley-Wrestling-School/1193063250762362&width=180&colorscheme=light&show_faces=true&border_color&stream=true&header=true&height=400" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:180px; height:400px;" allowTransparency="true"></iframe></p> </td> <script language="php"> } //this section loads the menu function mainmenu($page){ if ($page=="0"){ </script> <!-- --> <td width="74%" style="word-wrap:break-word;"> <center> <table width="100%" height="40px" cellpadding="0" cellspacing="0" border="0"> <tr> <td> <img src="images/buttons/h_left.gif" /> </td> <td> <center> <!-- home button --> <form id="form1" name="form1" method="post" action="index.php"> <input name="selection" type="hidden" id="selection" value="0" /> <button type="submit" class="submit"> <img src="images/buttons/homecl.gif" border="0" onMouseOver="src='images/buttons/homeho.gif'" onMouseOut="src='images/buttons/homecl.gif'" width="81" /> </button> </form> </td> <td> <center> <!-- pics button --> <form id="form1" name="form1" method="post" action="index.php"> <input name="selection" type="hidden" id="selection" value="1" /> <button type="submit" class="submit"> <img src="images/buttons/picsuc.gif" border="0" onmouseover="src='images/buttons/picsho.gif'" onMouseOut="src='images/buttons/picsuc.gif'" width="81"/> </button> </form> </td> <td> <center> <!-- video button --> <form id="form1" name="form1" method="post" action="index.php"> <input name="selection" type="hidden" id="selection" value="2" /> <button type="submit" class="submit"> <img src="images/buttons/vidsuc.gif" border="0" onMouseOver="src='images/buttons/vidsho.gif'" onMouseOut="src='images/buttons/vidsuc.gif'" width="81"/> </button> </form> </td> <td> <center> <!-- trainers button --> <form id="form1" name="form1" method="post" action="index.php"> <input name="selection" type="hidden" id="selection" value="3" /> <button type="submit" class="submit"> <img src="images/buttons/trainersuc.gif" border="0" onMouseOver="src='images/buttons/trainersho.gif'" onMouseOut="src='images/buttons/trainersuc.gif'" width="81"/> </button> </form> </td> <td> <center> <!-- hours button --> <form id="form1" name="form1" method="post" action="index.php"> <input name="selection" type="hidden" id="selection" value="4" /> <button type="submit" class="submit"> <img src="images/buttons/hoursuc.gif" border="0" onMouseOver="src='images/buttons/hoursho.gif'" onMouseOut="src='images/buttons/hoursuc.gif'" width="81"/> </button> </form> </td> <td> <center> <!-- about us button --> <form id="form1" name="form1" method="post" action="index.php"> <input name="selection" type="hidden" id="selection" value="5" /> <button type="submit" class="submit"> <img src="images/buttons/auuc.gif" border="0" onMouseOver="src='images/buttons/auho.gif'" onMouseOut="src='images/buttons/auuc.gif'" width="81"/> </button> </form> </td> <td> <center> <!-- contact us button --> <form id="form1" name="form1" method="post" action="index.php"> <input name="selection" type="hidden" id="selection" value="6" /> <button type="submit" class="submit"> <img src="images/buttons/cuuc.gif" border="0" onMouseOver="src='images/buttons/cuho.gif'" onMouseOut="src='images/buttons/cuuc.gif'" width="81"/> </button> </form> </td> <td> <img src="images/buttons/h_right.gif" align="right" /> </td> </tr> </table> <table width=100% border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img src="images/buttons/TechnoBlackLj4.gif" /> </td> <td> <img src="images/buttons/TechnoBlackLj4.gif" align="right" /> </td> </tr> </table> </center> <script language="php"> } I cut out the rest of the menu because it just repeats making slight adjustments for the option that has been made // this loads the main page function mainpage($page){ </script> <div style="height: 415px; overflow:auto;"> <center> <script language="php"> if ($page=="0"){ homepage(); } if ($page=="1"){ pics(); } if ($page=="2"){ videos(); } if ($page=="3"){ trainers(); } if ($page=="4"){ hours(); } if ($page=="5"){ aboutus(); } if ($page=="6"){ contactus(); } </script> </center> </div> </td> <script language="php"> } this is the main page where the scroll bar is located. This cell I would like to make 74% of the vertical screen where the top and bottom are 13% each. I have tried to do this using the height attribute in every table row and column as well as the cells themselves and it doesn't work. and when I try to do it with the stack overflow it's even more out of proportion is there any way to fix this? //this loads the right side bar function rightsidebar(){ </script> <td background="images/backgrounds/homepage/sidebars.jpg" width="13%"> <br /><br /><br /> <p><iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com/pages/Paradise-Alley-Wrestling-School/1193063250762362&width=180&colorscheme=light&show_faces=true&border_color&stream=true&header=true&height=400" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:180px; height:400px;" allowTransparency="true"></iframe></p> </td> </tr> </table> </td> </tr> <script language="php"> } // loads the bottom bar function bottombar(){ </script> <tr> <td> <center> Paradise Alley Wrestling(c) (203)410-5152 <br /> 662 Coe Ave East Haven Ct. 06512 <br /> <a href="http://www.000webhost.com/" target="_blank"><img src="http://www.000webhost.com/images/80x15_powered.gif" alt="Web Hosting" width="80" height="15" border="0" /></a> </td> </tr> </table> <script language="php"> } //this is the home page function homepage(){ // print ("Sorry the Home page is under construction"); </script> <h2> <br /> So you want to be a Pro Wrestler??? <br /><br /> Well you've come to the right place. <br /><br /> At Paradise Alley Wrestling School. you'll learn from the Pros the art of Pro Wrestling. They will train you in Agility, Ring Awareness, High Flying Skils and Ring Psychology. <br /><br /> So give us a call at (203)410-5152 and see just who you can pin down. <script language="php"> } //this is the pics page function pics(){ print ("Sorry the Pics page is under construction"); } //this is the videos page function videos(){ print ("Sorry the Videos page is under construction"); } //this is the trainers page function trainers(){ //print ("Sorry the Trainers page is under construction"); </script> <table width="100%"> <tr> <td width="33%"> <img src="images/trainers/mariomancini.png" width="200" height="150" /> </td> <td width="33%"> <Center> <img src="images/trainers/daveparadise.png" width="200" height="150" /> </Center> </td> <td width="33%" align="right"> <img src="images/trainers/prettypaulroma.png" width="200" height="150" /> </td> </tr> <tr> <td width="33%"> </h1> <h4> Mario Mancini: <br /><br /> Mario Mancini became a professional wrestler about six weeks after his eighteenth birthday and was the youngest wrestler in the WWF in 1984. <br /><br /> On July 31, 1984 Mario Mancini debuted, his professional wrestling career, against Greg "The Hammer" Valentine, and later on wrestled Tony Atlas in Madison Square Garden. <br /><br /> Mario Mancini's favorite move is The Flying Clothesline, and his finishing moves were the Reverse Flying Body Press and the Pile Driver. </h4> </td> <td width="33%" valign="top"> </h1> <h4> Dave Paradise: <br /><br /> Dave Paradise debuted, his professional career with the WWF on August 23, 1988 in a tag team match with Davis Isley against Ax and Smash. </h4> </td> <td width="33%" valign="top"> </h1> <h4> Pretty Paul Roma: <br /><br /> Pretty Paul Roma debuted, his professional wrestling career on December 17, 1984, at an all American taping in Poughkeepsie, NY. Where he was teamed with Salvatore Bellomo in a match against WWF Tag-Team Champions Adrian Adonis and Dick Murdoch. </h4> </td> </tr> </table> <script language="php"> } //this is the hours page function hours(){ //print ("Sorry the Hours page is under construction"); </script> <h1> <center> Class Schedule </center> </center> </h1> <br /> <h3> Tuesday: 6:00 PM to 8:30 PM <br /> Thursday: 6:00 PM to 8:30 PM <br /> Saturday: 9:30 AM to 1:00 PM <br /><br /> <center> Come on down to 662 Coe Ave East Haven Ct. 06512 <br /> We are located in the back building second door from the left. </center> <script language="php"> } //this is the about us page function aboutus(){ //print ("Sorry the About Us page is under construction"); </script> <h1> Why choose Paradise Alley Wrestling School over the others?</h1> <br /><br /> </center> <h3> We Pride ourselves with three former profesional wresters with over 25 years of expertise, that have the skills and knowledge to hone your skills and make you the best Professional Wrestler possible. <br /><br /> If you want to be successful in Professional Wrestling, Paradise Alley Wrestling School, gives it's students the best opportunity to make thier Dreams a reality by being dedicated to maintaining the Standards and Ideals of what it takes to become a Professional Wrestler. <br /><br /> Paradise Alley Wrestling School will set the standard to what wrestling schools should teach and what lessons our students will walk away with.You will be taught the high flying skills along with the ring psychology to compete at a Professional level. We are dedicated to maintaining the standards and ideals of what it takes to become a professional wrestler. <br /><br /> When you graduate from Paradise Wrestling School, you are a well-rounded professional wrestler with the tools, ability and confidence to perform at a professional level </h3> <script language="php"> } //this is the contact us page function contactus(){ //print ("Sorry the Contact Us page is under construction"); </script> <center> <h1> Paradise Alley Wrestling School <br /> 662 Coe Ave <br /> East Haven Ct. 06512 </h1> </center> </center> <br /><br /> <font color="#FF1F00"> Phone: (203)410-5152 <br /> e-Mail: <a href="mailto:paradisealleywrestling@paradisealleywrestling.com">paradisealleywrestling@paradisealleywrestling.com</a> <br /> Facebook: <a href="Facebook.com/ParadiseAlleyWrestling">Facebook.com/ParadiseAlleyWrestling</a> <br /> <br /><br /> <center> <h3> Come visit us and see what the Rings all about <br /> 662 Coe Ave <br /> East Haven Ct. 06512 <br /> We are located in the back building second door from the left. </h3> </center> </font> <script language="php"> } </script> </body> </html> Thank you for your time Christopher J. Crandall
-
I have a strange problem which I just cannot figure out. Some background before the question: I hired a programmer to build a feature for my site last year. I fear she tamperd with the code in ways she should not have and now it is not working correctly like it used to. PROBLEM: When a user completes a form and submits it, all fields are saved to my DB/table except for the userName and password fields. I have scoured the code for two days now and cannot figure out why this is happening, or rather, not happening. Thank you in advance for any hint or push in the correct direction regarding this specific issue! Here is the code: (Please see start of issue at line 153) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Sliding Login Panel with jQuery 1.3.2</title> <meta name="description" content="Demo of a Sliding Login Panel using jQuery 1.3.2" /> <meta name="keywords" content="jquery, sliding, toggle, slideUp, slideDown, login, login form, register" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <!-- stylesheets --> <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" /> <link rel="stylesheet" href="css/slide.css" type="text/css" media="screen" /> <!-- PNG FIX for IE6 --> <!-- http://24ways.org/2007/supersleight-transparent-png-in-ie6 --> <!--[if lte IE 6]> <script type="text/javascript" src="js/pngfix/supersleight-min.js"></script> <![endif]--> <!-- jQuery Slide --> <script src="http://code.jquery.com/jquery-latest.js"></script> <!-- Sliding effect --> <script src="js/slide.js" type="text/javascript"></script> <script> function validateEmail(email) { var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(email); } $(document).ready(function() { $('.error_message').hide(); $('#first_val').val(Math.floor(Math.random()*11)); $('#second_val').val(Math.floor(Math.random()*11)); $('#loadingGif').hide(); $('.bt_register').click(function(e){ $('#loadingGif').show(); e.preventDefault(); $('.error_message').hide(); $('#email_error').html("Please enter a valid email."); $('#user_error').html('Required'); error=false; if ($('#user').val().length<1) { error=true; $('#user_error').show(); } if ($('#email').val().length<1 || !validateEmail($('#email').val())) { error=true; $('#email_error').show(); } if ($('#pass').val().length< { error=true; $('#pass_error').show(); } if ($('#city').val().length<1) { error=true; $('#city_error').show(); } if ($('#pass').val() != $('#confirmpass').val()) { error=true; $('#confirmpass_error').show(); } var disallowed_characters=/www|http|@|com|\./; if (disallowed_characters.test($('#city').val())) { error=true; $('#city_error').show(); } if (disallowed_characters.test($('#company').val())) { error=true; $('#company_error').show(); } $.getJSON('ajax.php?username='+$('#user').val(), function(data) { if (data.error) { error=true; alert('An error has occured'); } else { if (!data.isUnique) { error=true; $('#user_error').html('This username is already taken.'); $('#user_error').show(); } } $.getJSON('ajax.php?email='+$('#email').val(), function(data) { if (data.error) { error=true; alert('An error has occured'); } else { if (!data.isUnique) { error=true; $('#email_error').html('This email is already being used.'); $('#email_error').show(); } } if ($('#equals_val').val() != (parseInt($('#first_val').val()) + parseInt($('#second_val').val()))) { error=true; $('#captcha_error').show(); } if (!error) { console.log('submit'); $('#member-signup').submit(); } $('#loadingGif').hide(); }); }); }) }) </script> <!--Favicon--> <link rel="icon" href="favicon.ico" type="image/x-icon"/> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/> <!--Country Dropdown--> <!-- <msdropdown> --> <link rel="stylesheet" type="text/css" href="css/msdropdown/dd.css" /> <script src="js/msdropdown/jquery.dd.min.js"></script> <!-- </msdropdown> --> <link rel="stylesheet" type="text/css" href="css/msdropdown/flags.css" /> <style> .error_message { color: #cf1717; font: Arial; font-size: 14px; display:block; } #panel { height: auto; } </style> </head> <body> <?php define('DB_HOST','localhost'); define('DB_NAME','******'); define('DB_USER','******'); define('DB_PASSWORD','******'); $con=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die("Failed to connect to MySQL:" . mysql_error()); $db=mysql_select_db(DB_NAME,$con) or die("Failed to connect to MySQL:" . mysql_error()); function NewUser() { $userName = $_POST['userName']; $email = $_POST['email']; $password = $_POST['password']; $countries = $_POST['countries']; $city = $_POST['city']; $company = $_POST ['company']; $state = $_POST ['state'];//Added 11/3/2014 $query = "INSERT INTO Table4 (userName,email,password,countries,city,company,state) VALUES ('$userName','$email','$password','$countries', '$city','$company','$state')"; $data = mysql_query ($query)or die(mysql_error()); if($data) { echo $state //echo "YOUR REGISTRATION IS COMPLETED..."; } } function SignUp() { if(!empty($_POST['userName'])) //checking the 'user' name which is from Sign-Up.html, is it empty or have some text { if ($_POST['equals_val'] != ($_POST['first_val'] + $_POST['second_val'])) { echo "CAPTCHA IS NOT CORRECT"; } else { $query = mysql_query("SELECT * FROM WebsiteUsers WHERE userName = '$_POST[user]' AND pass = '$_POST[pass]'") or die(mysql_error()); if(!$row = mysql_fetch_array($query) or die(mysql_error())) { NewUser(); } else { echo "SORRY...YOU ARE ALREADY REGISTERED USER..."; } } } } if(isset($_POST['submit'])) { SignUp(); } if (isset($_POST['type'])) { if ($_POST['type'] == "login") } ?> <!-- Panel --> <div id="toppanel"> <div id="panel"> <div class="content clearfix"> <div class="left"> <h1>Welcome to RedLineDown</h1><div style="color:#FFFFFF;">RedLineDown</div> <p class="grey">###</p> </div> <div class="left"> <!-- Login Form --> <form class="clearfix" action="#" method="post"> <h1>Member Login</h1> <input type="hidden" name="type" value="login" /> <label class="white" for="log">Username:</label> <input class="field" type="text" name="log" id="log" value="" size="23" /> <label class="white" for="pwd">Password:</label> <input class="field" type="password" name="pwd" id="pwd" value="" size="23" /> <div class="clear"></div> <input type="submit" name="submit-form" value="Login" class="bt_login" /> </form> </div> <div class="left right"> <!-- Register Form --> <form method="POST" id="member-signup" action="dbConnect.php"> <h1>Not a member yet? Sign Up!</h1> <input type="hidden" name="type" value="signup" /> <!-- Username Field --> <label type="grey" for="signup">Username:</label> <input type="field" type="text" name="user" id="user" value="" size="23")/><span class='error_message' id='user_error'>Required</span> <!-- Email Field(s) --> <label type="grey" for="email">Email:</label> <input type="field" type="text" name="email" id="email" size="23" /><span class='error_message' id='email_error'>Please enter a valid email.</span> <!-- Password Field --> <label type="grey" for="email">Password:</label> <input type="password" name="pass" id="pass" size="23" /><span class='error_message' id='pass_error'>Password must be at least 8 characters long.</span> <!-- Password Field --> <label type="grey" for="email">Confirm Password:</label> <input type="password" name="confirmpass" id="confirmpass" size="23" /><span class='error_message' id='confirmpass_error'>Passwords do not match.</span> //Insert countries here (Dropdown) <!-- City Field --> <label type="grey" for="email">City:</label> <input type="field" type="text" name="city" id="city" size="23" /> <select name="state" id="state"> <option value="AK">AK</option> <option value="AL">AL</option> <option value="AR">AR</option> <option value="AZ">AZ</option> <option value="CA">CA</option> <option value="CO">CO</option> <option value="CT">CT</option> <option value="DC">DC</option> <option value="DE">DE</option> <option value="FL">FL</option> <option value="GA">GA</option> <option value="HI">HI</option> <option value="IA">IA</option> <option value="ID">ID</option> <option value="IL">IL</option> <option value="IN">IN</option> <option value="KS">KS</option> <option value="KY">KY</option> <option value="LA">LA</option> <option value="MA">MA</option> <option value="MD">MD</option> <option value="ME">ME</option> <option value="MI">MI</option> <option value="MN">MN</option> <option value="MO">MO</option> <option value="MS">MS</option> <option value="MT">MT</option> <option value="NC">NC</option> <option value="ND">ND</option> <option value="NE">NE</option> <option value="NH">NH</option> <option value="NJ">NJ</option> <option value="NM">NM</option> <option value="NV">NV</option> <option value="NY">NY</option> <option value="OH">OH</option> <option value="OK">OK</option> <option value="OR">OR</option> <option value="PA">PA</option> <option value="RI">RI</option> <option value="SC">SC</option> <option value="SD">SD</option> <option value="TN">TN</option> <option value="TX">TX</option> <option value="UT">UT</option> <option value="VA">VA</option> <option value="VT">VT</option> <option value="WA">WA</option> <option value="WI">WI</option> <option value="WV">WV</option> <option value="WY">WY</option> </select> <span class='error_message' id='city_error'>Please enter a valid city.</span> <!-- Company Field --> <label class="white" for="email">Company:</label> <input class="field" type="text" name="company" id="company" size="23" /> <span class='error_message' id='company_error'>Please enter a valid company name.</span> <label class="white" for="captcha">Are you human:</label><br> <input class="field" type="text" name="first_val" id="first_val" style="width: 30px;" size="3" disabled/> + <input class="field" type="text" name="second_val" id="second_val" style="width: 30px;" size="3" disabled/> = <input class="field" type="text" name="equals_val" id="equals_val" style="width: 30px;" size="3" /><br> <span class='error_message' id='captcha_error'>Captcha is not correct.</span> <input type="submit" name="submit-form2" value="Register" class="bt_register" /> <img src="loading.gif" id="loadingGif"> <!-- Captcha --> </form> </div> </div> </div> <!-- /login --> <!-- The tab on top --> <div class="tab"> <ul class="login"> <li class="left"> </li> <li>Hello Guest!</li> <li class="sep">|</li> <li id="toggle"> <a id="open" class="open" href="#">Log In | Register</a> <a id="close" style="display: none;" class="close" href="#">Close Panel</a> </li> <li class="right"> </li> </ul> </div> <!-- / top --> </div> <!--panel --> <div id="container"> <div id="content" style="padding-top:100px;"> </div><!-- / content --> </div><!-- / container --> </body> </html>
-
Hi, I'm having a problem creating an HTML table in php. I used php code that I believed was the proper format but I guess it is not. I'm trying to pull data from a MySQL database and put the contents into a 3 cell table. There should be one cell in the first row and 2 cells side-by-side in the second row. The data is being displayed ok but just not in a table. Maybe someone can steer me in the right direction to create an html table in php. Here is the code tat I used: <?php echo “<center>”; echo “<table width="600" cellpadding="6">”; echo “<tr>”; echo ”<td>”; $dog = $_POST['breed']; $servername = "localhost"; $username = "myusername"; $password = "**************"; $dbname = "mydatabase"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "SELECT * FROM doginfo WHERE breed='$dog'"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { $detail = $size = $row["detail"]; $breed = $row["breed"]; $size = $row["size"]; $height = $row["height"]; $weight = $row["weight"]; $life = $row["life"]; $affect = $row["affection"]; $playfull = $row["playfull"]; $friendlyd = $row["friendly_dogs"]; $friendlyst = $row["friendly_stranger"]; $train = $row["training"]; $health = $row["health"]; } } else { echo "0 results"; } $conn->close(); echo nl2br("$detail" . "\n\n"); echo “/td>”; echo “</tr>”; echo “<tr>”; echo “<td>”; .nl2br("Breed : " . "$breed" . "\n") .nl2br("Size : " . "$size" . "\n") .nl2br("Height : " . "$height" . "\n") .nl2br("Weight : " . "$weight" . "\n") .nl2br("Life Expectancy : " . "$life" . "\n\n") ); echo “/td>”; echo “<tr>”; echo “<tr>”; echo “<td>”; echo ( nl2br("Based on a scale of 1 to 5\n\n") .nl2br(" Affection : " . "$affect" . "\n") .nl2br("Playfull : " . "$playfull" . "\n") .nl2br("Friendly with other dogs : " . "$friendlyd" . "\n") .nl2br("Friendly with strangers : " . "$friendlyst" . "\n") .nl2br("Ease of training : " . "$train" . "\n") ); if($health == "n/a") { echo " "; } else { echo nl2br("Health : " ."$health" . "\n\n"); } echo “</td>”; echo “</tr>”; echo “</table>”; echo ”</center>”; ?> By the way,... I am also having a problem bolding a line of text in the data displayed. Thanks in advance.
-
I have a mysql table named songs with 3 columns, id, artist,title. Most of the songs in the artist column are correct, ex: artist ------------------ John Denver Loretta Lynn Shania Twain Luke Bryan But some of the songs in the artist column are reveresed with a comma, ex: artist ----------------- Dever, John Lynn. Loretta Twain, Shania Bryan, Luke Is there an easy php code snippet or mysql statement that i can use to reverse the order of first name and last name and remove the comma in the last example so the artst columd matches the first example? I hope this makes sense, thanks, Dale.
-
Hallo everyone... here is my following code. i am fetching the picture from the file but unable to fetch it. kindly help me. error in bold underline... Thanks <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <?php session_start(); $uid=''; include("connection.php"); $query=mysql_query("SELECT * FROM users WHERE uid='".$_GET['uid']."'"); $row=mysql_fetch_array($query); $image=$row['images_path']; ?> <form action="edit.php" method="post"> <table border="1px" align="center" width="85%"> <tr> <td colspan="3"><?php include'header.php' ?></td> </tr> <input type="hidden" name="uid" value="<?=$_GET['uid'];?>" /> <tr> <td colspan="3">Welcome <?php echo $_GET['uid']; ?> </td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">User Name</td> <td width="63%"> <input type="text" name="uname" value="<?php echo $row['uname']?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">User Email</td> <td width="63%"> <input type="text" name="email" value="<?php echo $row['email'];?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">Mobile</td> <td width="63%"> <input type="text" name="mob" value="<?php echo $row['mob'];?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">Type</td> <td width="63%"> <input type="text" name="type" value="<?php echo $row['type'];?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">Status</td> <td width="63%"> <input type="text"name="status" value="<?php echo $row['status'];?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">Picture</td> <td><?php echo "<img border=\"0\" src=\"".$row['images_path']."\" width=\"102\" alt=\"your name\" height=\"91\">"; ?></td> </tr> </tr> <tr height="50px;"> <td colspan="3" style="padding-left:350px;"><input type="submit" name="submit" /> <input type="reset" value="Clear" /></td> </tr> <tr> <td colspan="3"><?php include'footer.php' ?></td> </tr> </table> <div align="left"><a href="home_users.php">Home</a></div> </form> </body> </html> ------------------ Thanks in advance
-
Hey guys i need help with a CURL code. I need to retreive all the data in a table located at http://www.listenlive.nl/tvgenre.php?g=1&page=0 and parse the data to finish with an array that looks like this: $row[0][station_name] = '3BTV'; $row[0][stream_link] = '420'; $row[0][stream_type] = 'wma'; $row[0][country] = 'United Kingdom'; $row[0][genre][0] = 'Variety'; $row[0][genre][1] = 'Alternative'; $row[0][genre][2] = 'Culture'; $row[0][rating] = '1/5'; I need that for each rows of the table where the first array number would increment $row[1], $row[2] ... My PHP code is incomplete. I currently have a loop for all the TR's of the page ... and when i loop all the TD's inside the TR's it returns a load of crap ... I am unsure where to go from here. Any help would be apreciated thx This is my code: $ch = curl_init(); $categ[url] = 'http://www.listenlive.nl/tvgenre.php?g=1&page=0'; curl_setopt($ch, CURLOPT_URL, $categ[url]); curl_setopt($ch, CURLOPT_POST, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookies); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookies); curl_setopt($ch, CURLOPT_COOKIE, $cookies); curl_setopt($ch, CURLOPT_REFERER, $categ[url]); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_USERAGENT, $nav); $data2 = curl_exec($ch); $dom2 = new DOMDocument(); libxml_use_internal_errors(true); $dom2->loadHTML($data2); $trs = $dom2->getElementsByTagName('tr'); foreach ($trs as $tr) { echo "<pre>"; print_r($tr); echo "</pre>"; }
-
So I've followed this code, corrected about 12 error, talked to my hosting and I am so done. I have tried everything but the error won't go away. The code is pasted below. As it's really late any help would be appreciated that would make my day the next day... <?PHP //connect to server $connect = mysql_connect("localhost","cello10_import","brigite27"); //connection to database mysql_select_db("cello10_import"); //query the database $query = mysql_query("SELECT * FROM users WHERE cover_image = 'http://d1w7fb2mkkr3kw.cloudfront.net/assets/images/book/small/9781/2500/9781250038821.jpg' "); //fetch the results / convert into array WHILE($rows = mysql_fetch_array(query)): $cover_image = $rows['cover_image']; $title = $rows['title']; $author = $rows['author']; echo "$cover_image<br>$title<br>$author<br><br><br>"; endwhile; ?> The error experienced is: Warning: mysql_fetch_array() expects parameter 1 to be resource, string given in /home/cello10/public_html/display.php on line 10 Thanks for your help
-
I have created a system that uses an API to drop utility data into MSQL Server 2008. Once the data is in the db, a web app can query the data to create electric bills. Currently we are working with only one customer but are entertaining expansion and want to approach the growth from the best possible angle. Considering that all data is the same type of data but comes from different customers and sources, would it be best to maintain 1 database with all of the utility meter data streaming to it or would it be best to have a new data base with each customer? Also, assuming we keep it all in the same database, would it be best (assuming we are secure) to have all the individual customers data go to the same tables or have separate tables for separate customers. I'm pretty certain I know the answer but I'm a novice so that means nothing. Thank you for any help with this issue.
-
I use PHPMyAdmin. I have to convert an InnoDB table to a MyISAM table. I then have to add a FULLTEXT index to two of the table's columns. Is this how I should proceed? 1) Backup table by exporting its contents. 2) Go to "Relation view" and drop foreign key constraints. 3) ALTER TABLE `table_name` ENGINE = MyISAM; 4) ALTER TABLE `table_name` ADD FULLTEXT index_name (col1,col2); Is that it? Is it safe? Note that the table contains approximately 3,500 rows.
-
I have problem how to saving all my record. when I save I just got 1 record saved in mySQL and it the last record on that table. Here is my code = <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO thasil (nrp, nama, pangkat, mgolongan, mtes_fisik, mkemampuan, hasil) VALUES (%s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['nrp'], "int"), GetSQLValueString($_POST['nama'], "text"), GetSQLValueString($_POST['pangkat'], "text"), GetSQLValueString($_POST['mgolongan'], "int"), GetSQLValueString($_POST['mtes_fisik'], "double"), GetSQLValueString($_POST['mkemampuan'], "double"), GetSQLValueString($_POST['hasil'], "double")); mysql_select_db($database_stok, $stok); $Result1 = mysql_query($insertSQL, $stok) or die(mysql_error()); $insertGoTo = ""; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } mysql_select_db($database_stok, $stok); $query_anggotaset = "SELECT * FROM tanggota ORDER BY nrp ASC"; $anggotaset = mysql_query($query_anggotaset, $stok) or die(mysql_error()); $row_anggotaset = mysql_fetch_assoc($anggotaset); $totalRows_anggotaset = mysql_num_rows($anggotaset); mysql_select_db($database_stok, $stok); $query_bobotset = "SELECT * FROM tbobot"; $bobotset = mysql_query($query_bobotset, $stok) or die(mysql_error()); $row_bobotset = mysql_fetch_assoc($bobotset); $totalRows_bobotset = mysql_num_rows($bobotset); $crMax = mysql_query("SELECT min(Golongan) as minK1, max(tes_fisik) as maxK2, max(kemampuan) as maxK3 FROM tanggota"); $max = mysql_fetch_array($crMax); $no=1; ?> <?php include ('header.php') ?> <div id="conten-wrapper"> <div id="conten"> <h1> Normalisasi Anggota Kesamaptaan </h1> <p> <a href="cetak.php"><img src="../images/btn_list.png" height="20"/> >>> Lihat & Cetak Hasil Akhir Perangkingan</a></p> <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1"> <table border="1" cellpadding="3" cellspacing="1"> <tr> <td>no</td> <td>nrp</td> <td>nama</td> <td>pangkat</td> <td>C1 Golongan</td> <td>C2 tes_fisik</td> <td>C3 kemampuan</td> <td>hasil</td> </tr> <?php do { $hasil= round (($max['minK1']/$row_anggotaset['Golongan']*$row_bobotset['golongan']+ $row_anggotaset['tes_fisik']/$max['maxK2']*$row_bobotset['tes_fisik']+ $row_anggotaset['kemampuan']/$max['maxK3']*$row_bobotset['kemampuan']),2) ; ?> <tr> <td><?php echo $no; $no++;?></td> <td><input type="text" name="nrp" value="<?php echo $row_anggotaset['nrp']; ?>" readonly/></td> <td><input type="text" name="nama" value="<?php echo $row_anggotaset['nama']; ?>" readonly/></td> <td><input type="text" name="pangkat" value="<?php echo $row_anggotaset['pangkat']; ?>" size="4" readonly/></td> <td><input type="text" name="mgolongan" value="<?php echo round ($max['minK1']/$row_anggotaset['Golongan'] *$row_bobotset['golongan'],2); ?>" size="2" readonly/></td> <td><input type="text" name="mtes_fisik" value="<?php echo round ($row_anggotaset['tes_fisik']/$max['maxK2'] *$row_bobotset['tes_fisik'],2); ?>" size="2" readonly/></td> <td><input type="text" name="mkemampuan" value="<?php echo round ($row_anggotaset['kemampuan']/$max['maxK3'] *$row_bobotset['kemampuan'],2); ?>" size="3" readonly/></td> <td><input type="text" name="hasil" value="<?php echo $hasil ?>" size="2" readonly/></td> </tr> <?php } while ($row_anggotaset = mysql_fetch_assoc($anggotaset));?> <tr valign="baseline"> <td colspan="8" align="right" nowrap="nowrap"><input type="submit" value="Insert record" /></td> </tr> </table> <input type="hidden" name="MM_insert" value="form1" /> </form> </div> <?php include ('footer.php') ?> </body> </html> <?php mysql_free_result($anggotaset); mysql_free_result($bobotset); ?>
-
Hello everyone, i'm Osiris and i'm stuck with this PHP/HTML code, i'm fairly new at this so this might be a dumb question. i have a database, but i want to output all data into a table from the database using HTML codes. i had it so far that i could outpust the info in just plain text but it doesn't output in the HTML table. Can anyone see what i did wrong? This is my PHP code its in the body section <?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'password'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } $sql = 'SELECT `Name`, `Color`, `Type`, `Subtype`, `Power`, `Toughness`, `Manacost`, `Rarity`, `Expansion`, `Foil`, `Stock` FROM `mtgtabel`'; mysql_select_db('mtgstock'); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not get data: ' . mysql_error()); } echo '<table class=mytable>'; echo "<tr><th >Name</th><th >Color</th><th >Type</th><th >Sub Type</th><th >Power</th><th >Toughness</th><th >Converted mana cost</th><th >Rarity</th><th >Expansion</th><th >Foil</th><th >Stock</th></tr>"; while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) { echo "<tr><td>"; echo $row['Name'] echo "</td><td>"; echo $row['Color']; echo "</td><td>"; echo $row['Type']; echo "</td><td>"; echo $row['Subtype']; echo "</td><td>"; echo $row['Power']; echo "</td><td>"; echo $row['Toughness']; echo "</td><td>"; echo $row['Manacost']; echo "</td><td>"; echo $row['Rarity']; echo "</td><td>"; echo $row['Expansion']; echo "</td><td>"; echo $row['Foil']; echo "</td><td>"; echo $row['Stock']; echo "</td></tr>"; } echo "</table>"; mysql_close($conn); ?> Thanks in advance!