Jump to content

schilly

Members
  • Posts

    870
  • Joined

  • Last visited

    Never

Everything posted by schilly

  1. ok did some tests. had a feeling about using 'character' as a declaration. it is reserved by mysql. you can't use it. change character to something else and it should work.
  2. it is a mysql error and the only place "avg(training_ability) as training_ability" occurs is in your select statement. //Get the average votes in the votes table for a specific employer $sql = "SELECT avg(courtesy) as courtesy, avg(stability) as stability, avg(loyalty) as loyalty, avg(attitude) as attitude, avg(turnover_rate) as turnover_rate, avg(work_stress) as work_stress, avg(work_safety) as work_safety, avg(employee_treatment) as employee_treatment , avg(competence) as competence, avg(reliability) as reliability, avg(pay_compensation) as pay_compensation, avg(work_environment) as work_environment, avg(medical_benefits) as medical_benefits, avg(experience) as experience, avg(respectfulness) as respectfulness, avg(fairness) as fairness, avg(positive_motivator) as positive_motivator, avg(foresight) as foresight, avg(insight) as insight, avg(negotiator) as negotiator, avg(stamina) as stamina, avg(perseverance) as perseverance, avg(assertive) as assertive, avg(planner) as planner, avg(level_headed) as level_headed, avg(even_tempered) as even_tempered, avg(constructive_criticism) as constructive_criticism , avg(anger_management) as anger_management, avg(trouble_shooter) as trouble_shooter, avg(business_knowledge) as business_knowledge, avg(honesty) as honesty, avg(integrity) as integrity, avg(courage) as courage, avg(character) as character, avg(training_ability) as training_ability, avg(gives_recognition) as gives_recognition, avg(instills_trust) as instills_trust, avg(supportive) as supportive, avg(empathy) as empathy, avg(consistency) as consistency FROM votes WHERE grade_id='{$employer_id}'";
  3. can you put the foreach call in the include? the php engine might not like that the closing bracket is in a separate file.
  4. well what you want to do is completely possible but I can't help you any further without seeing how you actually create the include.
  5. $imagesave = $_upload_dir . $file_name; $_upload_dir looks to be declared as $upload_dir.
  6. mysql_num_rows accepts a result set. $rows = mysql_num_rows($result, $conn);
  7. you need to escape your inputs. $sql = sprintf("INSERT INTO comm2 (author,parent,time,post) VALUES ('%s','%s','".time()."','%s')", mysql_real_escape_string($userid), mysql_real_escape_string($inPar), mysql_real_escape_string($inText));
  8. your missing a closing bracket. $validdate = checkdate($_POST['month'], $_POST['day'], $_POST['year'];
  9. ok. i see why you wanted to concatenate the fields now. k I think you want: $i=1; foreach($listAI as $ai) { $ai_name .= '<td width="175">' . $ai->ai_name . '</td>'; $ai_nie .= '<td width="175">' . $ai->ai_nie . '</td>'; $ai_address .= '<td width="175">' . $ai->ai_address . '</td>'; $ai_loc .= '<td width="175">' . $ai->ai_city. ' '.$ai->ai_state. ', ' .$ai->ai_zip . '</td>'; if($i==1){ $aiOutput .= '<table border="0" cellspacing="0" cellpadding="0" style="font-size:8pt;">'; } if ($i%4==0) { $aiOutput .= '<tr>'. $ai_name . '</tr> <tr>' . $ai_nie .'</tr> <tr>'. $ai_address . '</tr> <tr>' . $ai_loc . '</tr>'; $aiOutput .= '</table>'; $i=0; $ai_name = ''; $ai_nie = ''; $ai_address = ''; $ai_loc = ''; } $i++; } $aiOutput .= '</table>'; so basically concatenate the table data until we hit the 4th row. add the data to the output inside the table rows. reset the fields. repeat. that should output how you want i think.
  10. check the file permissions on the folder you are uploading the image into. if php can't write/save to this directory it will fail. in your ftp client, get info on the folder and give that folder full permissions (777) and see if that changes anything.
  11. make sure you're upload directory is writable by PHP. Change it to 777 and see it if works.
  12. USE_BASE_ROOT looks like some kind of flag. The code provided doesn't determine where it is defined though. Is there an include file that gets included above local.php? do the links use BASE_HREF? If they do you could just change this to have the links work locally.
  13. you don't need to call move_uploaded_file twice. just in the if statement is fine.
  14. sorry but coming to a help forum and asking for someone to write you a script where you have detailed exactly what you want isn't going to get you anywhere. it would be like me posting and asking for money. now if you have code written, we can help you.
  15. what does the function look like now?
  16. you close off your foreach too early and i dont think you wanted you td vars (ai_name, etc) to concatenate. $i=1; foreach($listAI as $ai) { $ai_name = '<td width="175">' . $ai->ai_name . '</td>'; $ai_nie = '<td width="175">' . $ai->ai_nie . '</td>'; $ai_address = '<td width="175">' . $ai->ai_address . '</td>'; $ai_loc = '<td width="175">' . $ai->ai_city. ' '.$ai->ai_state. ', ' .$ai->ai_zip . '</td>'; if($i==1){ $aiOutput .= '<table border="0" cellspacing="0" cellpadding="0" style="font-size:8pt;">'; } $aiOutput .= '<tr>'. $ai_name . '</tr> <tr>' . $ai_nie .'</tr> <tr>'. $ai_address . '</tr> <tr>' . $ai_loc . '</tr>'; if ($i%4==0) { $aiOutput .= '</table>'; $i=0; } $i++; } $aiOutput .= '</table>';
  17. well if it's a unix timestamp, use date() to get the day of the week then just use a switch statement to check the day against the days of the week. return true or false accordingly.
  18. code looks ok. what's the results you are getting?
  19. ok I think I know what you mean now. The reason is you check the other form variables after the db query code block. I think you want something more like this: if(isset($_POST['submitted'])) { $validdate = checkdate($_POST['month'], $_POST['day'], $_POST['year']); if (empty($_POST['model'])) { header("Location: " . $config_basedir . "/newcar.php?error=model"); } else if (empty($_POST['engine'])){ header("Location: " . $config_basedir . "/newcar.php?error=engine"); } else if ($_POST['colour']){ header("Location: " . $config_basedir . "/newcar.php?error=colour"); } elseif($validdate == false){ header("Location: " . $config_basedir . "/newcar.php?error=date"); } elseif($validdate == TRUE) { $concatdate = $_POST['year'] . "-" . sprintf("%02d", $_POST['month']) . "-" . sprintf("%02d", $_POST['day']) . " " . $_POST['hour'] . ":" . $_POST['minute'] . ":00"; $vehiclesql = "INSERT INTO vehicle(user_id,model,engine,colour) VALUES(". $_SESSION['USERID']. ",'" . addslashes($_POST['model']). "', '" . $_POST['engine'] . "', '" . addslashes($_POST['colour']) . "','" . $concatdate . "');"; mysql_query($vehiclesql); $vehicleid = mysql_insert_id(); header("Location: " . $config_basedir . "/addimage.php?id=" . $vehicleid); } }
  20. oh. so something like: function render_products_from_FACE() { $output = "<table class='products'><tr>"; $i = 0; foreach (get_xml_face() as $product) { include_once('path/to/file/common_code.php'); } your path may change depending on the dir your files are in, unless you use the absolute path. preferably i would put the whole function in a file and include it then pass in variables to the function depending on what page it's on. then you only have one instance of the entire function and it will output the proper code depending on the variables you pass it. having the same function but different on every page is a little unpractical but i'm not exactly sure how that function works in your case.
  21. <a href="/mysite.com/business/catalogue/corporate/index.php?subcatID=1&itemTypeID=3"> T-shirts </a> relative links won't work in your case because you're changing your base dir when you click one of the links so you need to use absolute.
  22. so why do you want to put some of the fn as an include? you've already modularized it as a function.
×
×
  • 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.