Jump to content

karatekid36

Members
  • Posts

    148
  • Joined

  • Last visited

    Never

Everything posted by karatekid36

  1. With the below query, it returns the MIN salary for each department, but what if you want to list the EMP_ID or EMP_NAME in this list as well? Meaning you want to see the EMP_ID in the department that has the MIN(salary). Won't that end up expanding the returns to more or less all rows? SELECT department, MIN(salary) as "Lowest salary" FROM employees GROUP BY department; Thanks!
  2. I agree, but something tells me that this issue may not require conditional comments. Something with the margin or the padding in the div's that I am unable to see is causing the problem I think. I am just looking for another set of eyes to help find the issue.
  3. In the rendered browser page, more specifically, the #wood_main div, the three paragraphs sit too high in IE6, but just fine in FF. Can anyone help me out? I had to fix some other problems and when I got to this I think my mind was spent. Any help would be greatly appreciated. If you need any other info, feel free to ask. Thank you. body{ font: 1em Georgia, "Times New Roman", Times, serif; } #topbar { margin: 0px; padding: 0px; background: url(images/top_bar.gif) repeat-x; height: 30px; } #wrapper { margin: 0px auto; width: 860px; overflow: auto; } #wrapper #header { height: 87px; } #home #wrapper #wood_main { } #wrapper #header #left_header { background: url(images/header.gif) no-repeat; height: 87px; width: 620px; float: left; } #home #wrapper #header #nav { } ul#menu{ list-style: none; } ul#menu li { display: inline; } ul#menu li a { text-indent: -9999px; display: block; height: 87px; float: left; } ul#menu li a.home { background: url(images/home.png) no-repeat top center; width: 60px; } ul#menu li a.artist { background: url(images/artist.png) no-repeat top center; width: 43px; } ul#menu li a.work { background: url(images/work.png) no-repeat top center; width: 55px; } ul#menu li a.contact { background: url(images/contact.png) no-repeat top center; width: 72px; } ul#menu li a.home:hover, ul#menu li a.artist:hover, ul#menu li a.work:hover, ul#menu li a.contact:hover { background-position: center center; } body#home ul#menu li a.home { background-position: bottom center; } #home #wrapper #wood_main { background: url(images/wood_main_bg.gif) no-repeat; height: 177px; width: 860px; font-size: 0.875em; color: #FFFFFF; } #home #wrapper #wood_main #wood_left, #home #wrapper #wood_main #wood_middle, #home #wrapper #wood_main #wood_right { width: 256.67px; float: left; padding: 0 0 0 20px; height: 100%; } #home #wrapper #wood_main h2 { font-size: 1.25em; font-weight: bold; letter-spacing: 1px; } #home #wrapper #wood_main p { font-size: .875em; font-weight: lighter; text-align: justify; } #home #wrapper #content { } #home #wrapper #content #main_col { width: 500px; float: left; } #home #wrapper #content .heading1 { font-size: 1.5em; border-bottom: thin solid #999999; font-weight: lighter; margin-top: 5px; margin-bottom: 5px; padding-bottom: 0px; } #home #wrapper #content .heading2 { font-size: 1.125em; border-bottom: thin solid #999999; font-weight: lighter; margin-top: 5px; margin-bottom: 5px; padding-bottom: 0px; } #home #wrapper #content #main_col .main_content { font-size: 0.875em; text-align: justify; line-height: 1.2em; margin-top: 0px; padding-top: 0px; font-weight: lighter; } #home #wrapper #content .oldent { float: left; font-size: .875em; } #home #wrapper #content .newent { float: right; font-size: .875em; } #home #wrapper #content #sec_col { width: 300px; float: right; margin-right: 10px; } #home #wrapper #content #sec_col .sec_content { font-size: .75em; text-align: justify; line-height: 1.2em; margin-top: 5px; padding-top: 0px; } #home #wrapper #content #sec_col img { border: 2px solid #999999; } #home #wrapper #footer { clear: both; background: url(images/tree_footer.gif) no-repeat; height: 94px; width: 860px; padding-top: 20px; } #home #wrapper #footer #left_footer { float: left; } #home #wrapper #footer #right_footer { float: right; } #home #wrapper #footer p { font-size: .75em; padding: 0px; margin: 0px; } #home #wrapper #footer .grey { color: #999999; } #home #wrapper #footer .grey a { text-decoration: none; color: #999999; } #home #wrapper #footer .bottom_text a { text-decoration: underline; color: #000; } #home #wrapper #footer .bottom_text a, #home #wrapper #footer .bottom_text { font-weight: normal; } #bottombar { margin: 0px; padding: 0px; background: url(images/top_bar.gif) repeat-x; height: 30px; }
  4. I understand using the limit, but I want to display 4 for each project. Not just one project. I do not understand which way to do that so that it displays four per project for all the projects that the user is a part of.
  5. Howdy Everyone, In the image below, there is a piece of a front page of a website I am making that I can not figure out how to construct. At the top of the page(not pictured) there is a list of projects that the user is involved with and at the bottom, I would like to display 4 "assets" for each project. A user can be on 1 or 100 projects(there is no limit) but I can not think of a way to do this. I have already built the proper display method to actually display the assets in a form that I can work with, but my trouble is, is displaying 4 assets for each project. What I mean is that I do not know how to write " For each project the user is associated with, build an html table with 4 assets from each project." I have a projects table, a users table, a project assets table, and a user_proj_relation table. I am not asking how I should exactly do this, I am looking for more of an overview of the way this should go, be it mysql or php. I do not know how to achieve my desired result. Can anyone point me in the right direction? Thank you.
  6. I would still very much be interested in a response to this post. If you have any thoughts feel free to add please.
  7. After reading about the IFNULL() function, I am not sure how it applies. All I want to do is list all of the forum titles, with a count of the replies to that post, and then either display the date the topic was posted(if there are no replies) or display the time/date or the latest reply for each forum message.
  8. I have been messing with this query for several hours now and I can not get it to do what I need. Any thoughts as to how I should go about this?
  9. The info about the project and then the users' id into the user_proj_rel table.
  10. Okay I 100% get how this works and see the reasoning behind it, but how can I insert data into two tables at once. I have a form where users fill out the project info, and who is assigned to the project, but I do not want to have two forms where two seperate INSERT queries are made. What is the structure for making two inserts at once?
  11. Okay I understand. In this case, I will be using this for only this one purpose. I read about the union and I am unsure if a Join or a Union will work better based on the last part of my query's needs. Which will make it easier to have either the post date or the last reply date, a union or a join? I would really like to make this in sql only and not php, because I would like to keep the code on the page to a minimum.
  12. Could you elaborate what you mean in the second half of your post?
  13. I have the following table structures My Current Query is as follows. SELECT COUNT(forum_replies.replyid), forum_replies.*, brothers.first_name, brothers.last_name, brothers.user_id, forum_messages.*, DATE_FORMAT(forum_messages.dateentered,'%W %b %D %l:%i%p') AS messagedate, DATE_FORMAT(forum_replies.dateentered,'%W %b %D %l:%i%p') AS replydate FROM forum_messages INNER JOIN brothers ON forum_messages.brotherid = brothers.user_id LEFT JOIN forum_replies ON forum_messages.messageid = forum_replies.inresponseto GROUP BY forum_messages.messageid Now I am getting 90% of my desired output, but this is going to be a the home page of a very basic forum that I am trying to build and what I want to have happen is I want there to be a column where it either displays the last date of a the most recent reply, or if not available, the post date, so that the most recent items stay on the top of the list, and where most of my problems are coming from, I want to sort by this column. Is this at all possible or must I use an IF Else statement? Thanks in advance
  14. Okay I will give this a go and see where it gets me.
  15. I do have a separate user table. These columns are for all the users who are assigned to the project. Is there a better way to place in a table the users who are assigned the project?
  16. Hey Everyone, I have this query that I am using to display some links. Basically I want the query to say select the info IF current = 1 and admin = 1, but in this table I am querying, I have 20 columns that are for users' id number and if the logged in user's number is in one of these columns, I should display too. I can not get the right AND / OR mix to get it to do what I need. Is it clear what I am looking for and does anyone have any suggestions? SELECT * FROM projects WHERE current = '1' AND admin = '1' AND user1=$user_id OR user2=$user_id OR user3=$user_id OR user4=$user_id OR user5=$user_id OR user6=$user_id OR user7=$user_id OR user8=$user_id OR user9=$user_id OR user10=$user_id OR user11=$user_id OR user12=$user_id OR user13=$user_id OR user14=$user_id OR user15=$user_id OR user16=$user_id OR user17=$user_id OR user18=$user_id OR user19=$user_id OR user20=$user_id
  17. Howdy All, I am revcieveing the following error, but my data is entering the table(the code follows the error): Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/carrigan/public_html/basecamp/enter_events.php on line 99 Warning: Cannot modify header information - headers already sent by (output started at /home/carrigan/public_html/basecamp/enter_events.php:99) in /home/carrigan/public_html/basecamp/enter_events.php on line 120 <?php session_name ('YourVisitID'); session_start(); // Start the session. // If no session value is present, redirect the user. if (!isset($_SESSION['user_id'])) { // Start defining the URL. $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); // Check for a trailing slash. if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) { $url = substr ($url, 0, -1); // Chop off the slash. } $url .= '/index.php'; // Add the page. header("Location: $url"); exit(); // Quit the script. } // Check if the form has been submitted. if (isset($_POST['submitted'])) { require_once ('includes/mysql_connect.php'); // Connect to the db. $errors = array(); // Initialize error array. // Check for an event name. if (empty($_POST['name'])) { $errors[] = 'You forgot to enter an event name.'; } else { $n = escape_data($_POST['name']); } // Check for a meeting type. if (empty($_POST['type'])) { $errors[] = 'You forgot to enter a meeting type.'; } else { $t = escape_data($_POST['type']); } // Check for a location. if (empty($_POST['location'])) { $errors[] = 'You forgot to enter a location.'; } else { $l = escape_data($_POST['location']); } // Check for a meeting description. if (empty($_POST['description'])) { $errors[] = 'You forgot to enter a meeting description.'; } else { $d = escape_data($_POST['description']); } // Check for a meeting month. if (empty($_POST['month'])) { $errors[] = 'You forgot to enter a meeting month.'; } else { $mm = escape_data($_POST['month']); } // Check for a meeting day. if (empty($_POST['day'])) { $errors[] = 'You forgot to enter a meeting day.'; } else { $md = escape_data($_POST['day']); } // Check for a meeting year. if (empty($_POST['year'])) { $errors[] = 'You forgot to enter a meeting year.'; } else { $my = escape_data($_POST['year']); } // Check for a meeting hour. if (empty($_POST['hour'])) { $errors[] = 'You forgot to enter a meeting hour.'; } else { $mh = escape_data($_POST['hour']); } // Check for a meeting min. if (empty($_POST['mins'])) { $errors[] = 'You forgot to enter a meeting time.'; } else { $mmin = escape_data($_POST['mins']); } if (empty($errors)) { // If everything's OK. // Enter the meeting in the database. // Check for previous registration. $query = "SELECT id FROM calendar WHERE ev_date='$my-$mm-$md' AND ev_locn='$l'"; $result = mysql_query($query); if (mysql_num_rows($result) == 0) { // Make the query. $query = "INSERT INTO calendar (ev_dat, ev_title, ev_locn, ev_desc, ev_time, ev_type) VALUES ('$my-$mm-$md', '$n', '$l', '$d', '$mh:$mmin:00', '$t')"; $result = @mysql_query ($query); // Run the query. if ($result) { // If it ran OK. // Send an email, if desired. // Redirect the user to the view_events.php page. // Start defining the URL. $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); // Check for a trailing slash. if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) { $url = substr ($url, 0, -1); // Chop off the slash. } // Add the page. $url .= '/view_events.php'; header("Location: $url"); exit(); } else { // If it did not run OK. $errors[] = 'Your event could not be added.'; // Public message. $errors[] = mysql_error() . '<br /><br />Query: ' . $query; // Debugging message. } } else { // Email address is already taken. $errors[] = 'The event has already been registered.'; } } // End of if (empty($errors)) IF. // Close the database connection. mysql_close(); } else { // Form has not been submitted. $errors = NULL; } // End of the main Submit conditional. // Begin the page now. $page_title = 'Add an Event'; require_once ('includes/mysql_connect.php'); // Connect to the db. if (!empty($errors)) { // Print any error messages. echo '<h1 id="mainhead">Error!</h1> <p class="error">The following error(s) occurred:<br />'; foreach ($errors as $msg) { // Print each error. echo " - $msg<br />\n"; } echo '</p><p>Please try again.</p>'; } // Create the form. ?> <h2>Add an Event</h2> <form action="enter_events.php" method="post"> <p>Event Name: <input type="text" name="name" size="30" maxlength="30" value="<?php if (isset($_POST['name'])) echo $_POST['name']; ?>" /></p> <p>Meeting Date: <?php // Make the months array. $months = array (1=> 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); // Make the days and years arrays. $days = range (1, 31); $years = range (2005, 2015); // Make the months pull-down menu. echo '<select name="month">'; foreach ($months as $key => $value) { echo "<option value=\"$key\">$value</option>\n"; } echo '</select>'; // Make the days pull-down menu. echo '<select name="day">'; for ($day = 1; $day <= 31; $day++) { echo "<option value=\"$day\">$day</option>\n"; } echo '</select>'; // Make the years pull-down menu. echo '<select name="year">'; $year = 2008; while ($year <= 2010) { echo "<option value=\"$year\">$year</option>\n"; $year++; } echo '</select>'; ?> <p>Time: <?php // Make the days pull-down menu. echo '<select name="hour">'; for ($hour = 0; $hour <= 23; $hour++) { echo "<option value=\"$hour\">$hour</option>\n"; } echo '</select>'; ?> <select name="mins"> <option>00</option> <option>15</option> <option>30</option> <option>45</option> </select> </p> </p> <p>Type: <label> <input type="radio" name="type" value="Mandatory" /> Mandatory</label> <label> <input type="radio" name="type" value="Not Mandatory" /> Not Mandatory</label> </p> <p>Location: <input type="text" name="location" size="15" maxlength="30" value="<?php if (isset($_POST['location'])) echo $_POST['location']; ?>" /></p> <p>Meeting Description: <br /> <TEXTAREA NAME="description" COLS=40 ROWS=4 value="<?php if (isset($_POST['email'])) echo $_POST['email']; ?>"></TEXTAREA> </p> <p><input type="submit" name="submit" value="Enter Event" /></p> <input type="hidden" name="submitted" value="TRUE" /> </form>
  18. I think I can modify Andy B's to meet my needs. Great Work on that code. I can edit this for my needs. Thank you all.
  19. I appreciate the honesty, I am in the same spot. I am making this in the hopes of being able to turn it into a large scale membership systems for some of the local yacht clubs and organizations of that nature near where I live. Your solution seemed perfect, but I will just have to work with the array one my own I guess. Have a good one.
  20. I 100% agree, but another problem I am having is that I have only generated calendars in the past where it just adds days until the counter reaches that max value I allow it. As of this minute, I can not envision a way to do it so that I would be able to have a query in each calendar day(obv using a loop or a while), but I have seen these types of calendars everywhere.
  21. I have a table of event that I would love to have displayed in a calendar where the title of the event is listed in the calendar square of the respective day. I can generate the calendar dynamically using php, but I am unsure how to get the dates into a calendar at all with the dates of the calendar and the date of the event matching. If anyone has any ideas or examples, it would be greatly appreciated.
  22. in the project table... projid - index user1 user2 user3 dateentered creator current The users are the people who are working on the project. It is currently three users, but I want to have it be 20 users. The creator is the user who started the project. current is to show if the project is still being worked on. If it is. It can either be a 0 type 1 deal or a Yes No. projassetid - index projid inresponseto title type userid assign dateentered messagetext This table is a little bit of a mess. The projid is the project it is in reference to. the inresponseto is if it is a comment on a message, this is filled with the proper number. Title is the title. type is either File, Deadline, Comment, or Message. Assign is who the item is assigned to. This generally only applies to deadlines. Userid is who made this project asset. dateentered is dateentered. Messagetext is a description of area. Please let me know if this helps.
  23. In the above Image, I drew out an idea I had for a php page I want to build. I have the projects at the top and then the projects listed again at the bottom. Each of the users will have projects assigned to them anywhere from 0 to 20 or so. I know how to list the projects at the top, but my issue is how to get them from the project table and then have the four more recent entries in my project assets table like I have at the bottom. I just designed this figuring that I could figure it out later, but I have hit a road block. There are two tables. The Projects table and the Project Assets table. I am just unsure how to query the table so that I can display them like I have in the bottom of the image. Any guidance would be greatly appreciated.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.