Jump to content

jdorma0

Members
  • Posts

    23
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

jdorma0's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Per GDPR article 17 I'd like to request that all of my content, including topics (as they contain identifiable information) (https://forums.phpfreaks.com/topic/194707-rank-employees-by-performance-mysql-php-help/, https://forums.phpfreaks.com/topic/194859-display-a-certain-list-of-days-using-date/) and posts, for all intents and purposes, to be deleted and my account closed aka right to be forgotten. Please scrub this post when completed. Cheers.
  2. Great! Yeah, your whichchart variable wasn't being defined once you actually went to a chart.. it attempted to load comments, but it didn't have a chart to pull them from. And the first issue was that your script wasn't getting the variable because it wasn't defined with $_GET. But but modifying like I suggested you corrected those two problems and it's working now, so congrats!
  3. That fixed the biggest problem. Now change the end of your script to this: if ($pagenum == 1) { } else { $previous = $pagenum-1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1&whichchart=".$_GET['whichchart']."'><<-First</a> "; echo " "; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$previous&whichchart=".$_GET['whichchart']."'><-Previous</a> "; } if ($pagenum == $last) { } else { $next = $pagenum+1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$next&whichchart=".$_GET['whichchart']."'>Next -></a> "; echo " "; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$last&whichchart=".$_GET['whichchart']."'>Last ->></a> "; } ?> in place of if ($pagenum == 1) { } else { $previous = $pagenum-1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1'><<-First</a> "; echo " "; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$previous'><-Previous</a> "; } if ($pagenum == $last) { } else { $next = $pagenum+1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$next'>Next -></a> "; echo " "; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$last'>Last ->></a> "; } ?>
  4. First of all, change this if (!(isset($pagenum))) { $pagenum = 1; } to this if (!(isset($_GET['pagenum']))) { $pagenum = 1; }else{ $pagenum = $_GET['pagenum']; } Let me know when it's uploaded, I'll check it out again.
  5. You're welcome! Let me know if you need anything else.
  6. No problem. Let me know if it works or if it helped.
  7. Your form is using method=post. Why are you using $_GET['whichchart']? Should be $_POST['whichchart'] or change your form to method=get. That's the main thing I noticed. Got a live URL?
  8. $cat_id = $_GET['cat_id']; $state = $_GET['state']; if (($cat_id == "00") && ($state == "00")) { $query = "SELECT name,address,city,state,zip,phone,web,other FROM ydc ORDER BY name ASC"; } else if (($cat_id != "00") && ($state == "00")) { $query = "SELECT name,address,city,state,zip,phone,web,other FROM ydc WHERE cat_id = $cat_id ORDER BY name ASC"; } else if (($cat_id == "00") && ($state != "00")) { $query = "SELECT name,address,city,state,zip,phone,web,other FROM ydc WHERE state = '$state' ORDER BY name ASC"; } else { $query = "SELECT name,address,city,state,zip,phone,web,other FROM ydc WHERE cat_id = $cat_id AND state = '$state' ORDER BY name ASC"; } $result = mysql_query($query) or die(mysql_error()); if (mysql_num_rows($result) == 0) { echo "<h3>Sorry, there are no listings that match your selection.</h3>"; } else { while($row=mysql_fetch_array($result, MYSQL_ASSOC)) { $name = $row['name']; $address = $row['address']; $city = $row['city']; $state = $row['state']; $zip = $row['zip']; $phone = $row['phone']; $web = $row['web']; $other = $row['other']; echo "<h3>$name</h3>"; echo "$address<br />"; echo "$city, $state $zip<br />"; echo "$phone<br />"; echo "<a href=http://$web>Visit Website</a><br />"; echo "$other"; echo "<h2> </h2>"; } } Try that. I think that will work because you have to use quotes whenever the data is not a integer.
  9. Well, I actually created a live test of your code on my server and it's operating exactly as intended. http://www.widocomputers.com/smarttime/EmptyPHP.php Just click the different conditions at the bottom of the page to see it in action. I'm not using the queries though, I'm just testing the conditions.
  10. Why don't you replace die('Sorry, could not get the listings at this time, please try later'); with die(mysql_error()); Just to see if you get any errors on those other two conditions.
  11. Yes sir. I know I should start another topic for this, but maybe you will know the answer. I need to prefill a select field for each row of my form. echo "<div align=\"center\"><font color=\"red\"><b>WARNING:</b> Only use the results for the week ending on <b>".$vars['emp_date']."</b></font></div><br />"; ?> <table align="center" class="style6"> <tr> <th>Employee</th> <th>Star</th> <th>CSAT</th> <th>CPH</th> <th>PA</th> <th>Credit</th> <th>Attachments</th> </tr> <?php echo '<form action="insert.php" method="post">'; $i=0; while($i<$vars['emp_num']) { $emp = "<tr><td><select name=\"row_associd_$i\">"; $res = mysql_query("SELECT * FROM employees WHERE department='".$_POST['emp_department']."'"); $emp .= "<option \"\">Select Employee</option>"; while($emps = mysql_fetch_array($res)) { $emp .= "<option value=".$emps['associd']; // $emp .=" selected"; // Need to decide how to get this to output, skipping the last person $emp .=">".$emps['fname']." ".$emps['lname']."</option>"; } $emp .= "</select></td>"; $emp .= "<td><input type=\"text\" size=\"5\" name=\"row_star_$i\">"; $emp .= "</td><td><input type=\"text\" size=\"5\" name=\"row_csat_$i\">"; $emp .= "</td><td><input type=\"text\" size=\"5\" name=\"row_cph_$i\">"; $emp .= "</td><td><input type=\"text\" size=\"5\" name=\"row_pa_$i\">"; $emp .= "</td><td><input type=\"text\" size=\"5\" name=\"row_credit_$i\">"; $emp .= "</td><td><input type=\"text\" size=\"5\" name=\"row_attachments_$i\">"; $emp .= "</td></tr>"; echo $emp; $i++; } ?> </table> <input type="hidden" name="emp_i" value="<?php echo $i;?>"> <input type="hidden" name="action" value="emp_processrows"> <input type="submit" name="emp_submit" value="rank employees"> </form> Basically, I would like to have selected each person for the row. Example: Bob Jones - selected Mary Beth - not selected Frank Sinatra - not selected Bob Jones - not selected Mary Beth - selected Frank Sinatra - not selected Bob Jones - not selected Mary Beth - not selected Frank Sinatra - selected I was playing around with it but I couldn't get it figured out. I'd appreciate it if you could help me with that one too.
  12. Thanks so much! With a little modification: $week = 60*60*24*7;//60 secs a min * 60 mins an hour * 24 hours a day * 7 days a week $time = strtotime("last sunday"); for ($i = 0; $i < 10; $i++){ $etime = "<option value=\"".date("Y-m-d", $time)."\""; if($i==1) { $etime .="selected"; } $etime .= ">".date("Y-m-d", $time) . "</option>"; echo $etime; $time -= $week; } It works like a charm! I appreciate it.
  13. $newID = "SELECT `id` FROM `jobs` ORDER BY `id` LIMIT 1"; $getID = mysql_query($newID); if($getID): while($nid = mysql_fetch_assoc($getID)): $id = $nid['id']; endwhile; if($id == 0): $id = 1; endif; else: return 'Failed to complete your request to open a new job, please contact support.'; endif; Give that a whirl.
  14. Basically, I need to prefill a select drop down box with the sunday of each week. I would like to it to basically be in the format of: <select name="row_date"> <option value="2010-01-01">2010-01-01</option> <option value="2010-01-08">2010-01-08</option> <option value="2010-01-15">2010-01-15</option> <option value="2010-01-22">2010-01-22</option> etc. etc. </select> But it would automatically select the current week (as the default value) and allow the user to change that.. but only from the displayed dates. I wouldn't need more than 6 weeks to be shown, but that's not too important. I've researched this forum, php.net and Google to no avail. Hopefully one of you bright people can help me out! Thanks! =] Joey
  15. No I believe mysql_fetch_array will return actual values instead of references so closing it shouldn't be a problem since $row is a regular php array and has nothing to do with the database link. Oh okay, I figured it would be that but I threw it out there because I wasn't 100% sure.
×
×
  • 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.