Jump to content

techdude

Members
  • Posts

    38
  • Joined

  • Last visited

    Never

Everything posted by techdude

  1. ARRRGH! Why is it that I always procrastinate posting to this forum, and then the minute I post, I figure out my problem? Any way, the solution is as follows: SELECT e.employee_id, e.employee_name, GROUP_CONCAT(l.language SEPARATOR ", ") as languages, FROM employees e JOIN (employee_languages `el`, languages l) ON (e.employee_id = `el`.employee_id AND `el`.language_id = i.language_id); Oh well, Problem solved. hope this post helps someone else. -- techdude
  2. Hi folks! I need some help coming up with the correct query to perform this. I have several tables, but to simplify it, we will just put it like this: TABLES: employees languages employee_languages (used to link multi to multi) I need to select * from employees with all the languages they speak. I am not quite sure how to do this, but I expect the result to be something like: +-----------------+-----------------------+-----------------------+ | employee_id | employee_name | languages | +-----------------+-----------------------+-----------------------+ | 1 | Joe Smith | English, Spanish | +-----------------+-----------------------+-----------------------+ I know there is a simple solution, but I just can't seem to find it. Thanks for any help! -- techdude
  3. What is it with me always answering my own questions, only minutes after I ask them? I sit there pondering a question and researching it for hours (Well, ok this time it was only 1.25 hours) until I decide to post it to this forum, only to have a spark of inspiration 5 minutes later, and solve my own question. Oh, well. Here is the solution. Add a foreign key constraint like this: CONSTRAINT `client_dates_ibfk_5` FOREIGN KEY (`instructor_id`, `calendar_date`) REFERENCES `instructor_dates` (`instructor_id`, `calendar_date`) ON DELETE CASCADE ON UPDATE CASCADE 'til next time, -- techdude
  4. Hi. I have two tables: instructor_dates: instructor_id, calendar_date client_dates: instructor_id, client_id, calendar_date. I want to add a foreign key constraint that checks for the following: When inserting into client_dates, does calendar_date exists where the instructor_id = <whatever>; I would like this to be implemented as a constraint as I can write sql to check this prior to insertion, but I want the rule to apply to the other people who are working on this project. Not keeping the two tables in sync (for example client_date exists where an instructor date does not) could cause problems and I wan't to be able to ensure that is the case. In short, I am asking how to create a foreign key constraint on multiple fields. Thanks! -- techdude
  5. Doh! I should have checked that first. Looks like my host is using an out of date version of mysql (5.0.x) thnx. -- techdude
  6. Hi! I use the SHA2 function in a mysql query. the query work OK on my own machine, but when I upload it to the server, It doesn't work. I logged into my server via SSH, and entered mysql, typing the following at the prompt. mysql > SELECT SHA2("blahblah",512) as loopy; It works on my developer's machine. On my server it says that SHA2 is not defined. What do I need to to to enable SHA2? Thanks for any help -- techdude
  7. Try getTeamLogo($past->id); Instead of $row->* You apparently were looking at a different page than I was. Could you tell me what file you edited, and what query string I have to append to my joomla page to view it? -- techdude
  8. Similar solution to the last one. Place: <?php $params = &JComponentHelper::getParams('com_gridiron'); ?> at the top of the template file. (php) Then, you can use <img src="<?php echo JURI::base().$params->get('images_path').$row->visitinglogo;?>" alt="" /> where you want the visitor's logo to go, and <img src="<?php echo JURI::base().$params->get('images_path').$row->homelogo; ?>" alt="" /> for the home team logo. Hope that helps! -- techdude
  9. One warning on this is that if your are using checkboxes, you will not be able to determine if a check box is not checked, since most browsers just plain don't send the "name" attribute of the checkbox unless it is checked. Just a little "Gocha!" -- techdude
  10. Here is what looks like an excellent class you could use for this purpose. Make sure you have GDLIB enabled on your server! (Hint: phpinfo()) http://www.bitrepository.com/resize-an-image-keeping-its-aspect-ratio-using-php-and-gd.html -- techdude
  11. Please Note: The night before I found the solution, treybraid and I had the following chat. I figured I should add it here for the record. -- techdude
  12. Ok, here is the solution I found. First, open the file and add a "<th> </th>" at the top to allow another column for the logo. Then, I added this code where the image should be: <td> <?php $params = &JComponentHelper::getParams('com_gridiron'); $logo = getTeamLogo($stats->id); ?> <img src="<?php echo JURI::base() . $this->params->get('images_path') . $logo;?>" alt="<?php echo $stats->name;?>" title="<?php echo $stats->name;?>" /> </td> That's it! I used the getTeamLogo() function to get the logo (from the functions.php file), and getParams() to get the images_path. You probably would want to move at least the getParams() part to the top of the document so it doen't have to run once for every row. Other than that, the rest is pretty straight forward. Also, just thought I'd complement on the overall design of the modules and components. Have a good day! -- techdude P.S. I like to logo!
  13. Ok, I installed the two mods and the the component. Here is a list of errors that I received when trying to access them in the components -> gridiron section. The E_STRICT errors may be ignored, but they could point to the problem that you are having, so I recommend that you at least read them: gridiron: leagues-a-divisions: seasons: Teams: Schedules: players Game Results: Fields: Game Types: About (much better) Whew! Just so you know, I am running PHP 5.3.5, with MySQL 5.0.7 and Joomla 1.6.1 (I like to keep it up to date.) If you can fix some of the bugs, I will be able to help, but as it stands, I can't use any of the components. The error I would look into the most is the "Call to a member function getUserStateFromRequest() on a non-object" errors. The 'nul' constant could be a problem too, but the pass by reference is going to need some help in the near future if your want your mod to last when php 6 is released. Post back here for more help. --techdude
  14. Glad I can help -- techdude
  15. Ooops! Sorry, I got the syntax incorrect. Try this instead: Post back if this helped. -- techdude
  16. Where do you have the team logo stored? do you enter it in params when you build a module? is it in a database? where are the teams stored, and where are the stats stored? -- techdude
  17. $this referrs to the JDocumentHTML Object. The page probably does not have error reporting turned on, so you will not see anything but a blank screen when there is an error. Try adding the code <?php error_reporting(E_ALL | E_STRICT); ini_set('display_errors', '1');?> to the top of the page. That way, you will be able to see the errors. --techdude
  18. Whoops! Thanks for correcting my misunderstanding. I didn't know that browsers always use \n. Thanks for the clarification. Hope we have been helpful, Jnerocorp. Please post back here and let us know. -- techdude
  19. I would not reccommend just replacing ' with ", because that can easily be bypassed. However, using an escape function for the appropriate library is a VERY GOOD idea, and should be used at all costs. For MSSQL, try PDO::prepare, or PDO::quote. -- techdude CompTIA Security+ Certified
  20. Great! now all you need to do is figure out the $team->logo portion. That info should be stored and retrieved in the same manner as $team->name. Could it be that (looking back at your first post) you meant $stats->name, $stats->logo? Try to add the logo value to the $obj-><whatever> = $team-><whatever> section, then access the info using $stats. -- techdude
  21. Very close, RussellReal, but that doesn't take care of the multiple possible line endings line \r\n, \r, AND \n. Here is my whack at the code. $values = preg_split('/(\r\n|\r|\n)/', $_POST['text_area']); //this gets an array where each item on its own line is an element in the array $query = "INSERT INTO `database_name`.`table_name` (`value1` ,`value2` ,`value3`) VALUES "; //prepare the first part of the query with the fields foreach($values as $index=>$value){ $value = explode("-", $value); //make the array $query .= "('{$value[0]}', '{$value[1]}', '{$value[2]}'),"; //add that item } $query = rtrim($query, ","); //remove the trailing comma // Now add your own code to execute the query. -- techdude
  22. The code was error_reporting(E_ALL); ini_set('display_errors', '1'); file_get_contents("Auth.php"); The include_dir contained the /usr/share/pear folder. Found the solution, it was blocked by an open_basedir path, but because it was an include without a path, it DID NOT PRODUCE THE USUAL ERROR THAT "Open basedir restriction was in effect". Kind of a wierd effect, but it worked to add that file to the open base dir. I wonder why it fails silently. -- techdude
  23. Exactly! The $params object is used at the beginning of the file. As long as you have the correct parameter set, you should be able to use it. Also note that the object appears in the global context, while you appear to be using it in a control context. Try putting this line before the output of the image. global $params; Also, you may get a better idea what is going on if you add this code to the top of the page. Just make sure you remove it before your site "goes live". <?php error_reporting(E_ALL | E_STRICT); ini_set('display_errors', '1');?>
  24. Razaqg, Just a warning to you: the code $pnlusername = $_POST['pnlusername']; $pnlpassword = $_POST['pnlpassword']; $query = mssql_query('SELECT Title, Surname, FirstName FROM PeoplesRec where Username = '$pnlusername' '); is VERY INSECURE. What would happen if someone submitted or ? The person could execute arbitrary commands to the database! In addition, they could make inserts into the MSSQL users table, and get superaccount access to the database, and later to the server that runs the data base! I would reccommend at the very least url-encoding the values. $pnlusername = rawurlencode($_POST['pnlusername']); $pnlpassword = rawurlencode($_POST['pnlpassword']); $query = mssql_query('SELECT Title, Surname, FirstName FROM PeoplesRec where Username = '$pnlusername' '); Again, just a warning, but you should learn to ALWAYS VALIDATE USER INPUT. THIS INCLUDES DATA TRANSFERED OVER THE SO-CALLED SECURE HTTPS CHANNEL, OR DATA SUBMITTED BY POST. -- techdude CompTIA Security+ Certified
  25. Post back if this helped. (Also, read the guidelines before posting.) -- techdude
×
×
  • 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.