Jump to content

akitchin

Staff Alumni
  • Posts

    2,515
  • Joined

  • Last visited

    Never

Everything posted by akitchin

  1. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=313673.0
  2. if you're trying to access the same index from the $_POST['descr'] array, you'll actually need to grab the index from the $_POST['staff'] array in your foreach(): foreach ($_POST['staff'] AS $key => $val) { echo 'Staff: '.$value.'<br />'; echo 'Description: '.$_POST['descr'][$key].'<br />'; }
  3. not sure why you're using: ($val BETWEEN sqf_min AND sqf_max, $val2 BETWEEN price_min AND price_max); that breaks the MySQL syntax. try: SELECT * FROM buyer_listings WHERE acct_type='FHA' AND buyerCity='Hollywood' AND bedrooms>=1 AND baths>=1 AND $val BETWEEN sqf_min AND sqf_max AND $val2 BETWEEN price_min AND price_max if that doesn't work, you may need to specify the BETWEEN requirements separately (ie. sqf_min <= $val AND sqf_max >= $val). EDIT: beaten to the punch, leaving this on because i don't want to have wasted all this finger pressing
  4. this might be a result of only using styles to assign the size, and not using the rows and cols attributes. if you add those in, does it help?
  5. when you begin typing in the textarea after it is cleared, does it begin typing on the next line, or is it simply the blinking cursor that is in the wrong spot?
  6. i'll be honest, nobody is going to go to the effort of downloading and parsing the entire template. what script(s) are you using to run this website?
  7. that data looks correct, except that every value between the first and last has a trailing space. trim *should* take care of that. once you run trim() against all values in the array (array_map comes in handy here), you can simply concatenate all the values into one comma-delimited string and put that into a SINGLE query: $trimmed_version = array_map('trim', $name); $single_list = implode(',', $trimmed_version); $query = "SELECT stuff FROM table WHERE name_column IN ($single_list)"; i would suspect that the actual error occurs when, at the end of the loop with the query in it, you assign: $name = $row[0]; echo $name."<br />"; that would reset the $name variable and kill the foreach() loop.
  8. for this you would need a simple PHP AJAX form validation script of some sort (jQuery's example is on their website). provided you can standardize the user's input, the PHP code to verify it should be simple: 1. validate the actual format of the date (see here for a quick tutorial on how to write this part). 2. convert the value to a timestamp using strtotime, and compare it against the current timestamp (using time).
  9. this isn't an easy answer, considering we have no idea what script(s) you're using and what code excerpts are being used for the pagination and display. however, my guess would be that you are limiting the query to grabbing 10 at a time. try changing that; if you don't where to do so, post the code for the pagination and we may be able to help.
  10. This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=313541.0
  11. what do you see if you use var_dump on the first array? this might be a way to detect the (sometimes difficult-to-spot) differences in the formatting. EDIT: i've also just noticed that you reassign $name the value obtained in the query... is that intentional? it will kill the loop and/or trigger an error...
  12. back to the ORIGINAL topic (not that i don't appreciate the enjoyable detour this thread took) - also be careful that the things that may be revealed in a rant or complaint could be information that can't be publicly disclosed, which they could use as grounds for dismissal (or worse - could contravene a signed agreement between you and your employer, potentially leading to litigation).
  13. it would be more helpful to get some background on this. what SHOULD it look like? has it transformed into this somehow? where is this located?
  14. for lack of a fancier way, you should be able to do this with a foreach() loop: $level_keys = array(); foreach ($master_array AS $k => $sub_array) { $this_level = $sub_array['level']; $level_keys[$this_level][$k] = array('cust' => $sub_array['cust'], 'type' => $sub_array['type']); } '<pre>'.print_r($level_keys, TRUE).'</pre>';
  15. do you mean $resulta becomes a string? if so, have you tried making search_username() pass back $result->fields instead of the $result object?
  16. haha oops - forgot to scroll down in the first post to see the rest of the code.. anyhow, you're not far off the mark, you just have the mail_message() call in the wrong place. once the code you've gotten from the other thread runs, you're left with all your name/email pairs in $list. what you need to do is iterate through that list, and use mail_message() for every pair. furthermore, we can edit your mail_message() function to return a message indicating the result, rather than the name/email pair - you don't need to return the pair, since we already know what it is (we have to pass it to the function after all): <?php function mail_message ($name,$email,$template_file) { if (empty ($name) || empty($email) || empty($template_file)) { return "One or more fields are missing"; } else { #echo "inside $name, $email<br/>"; $email_message = file_get_contents($template_file); $email_message = str_replace("#NAME#", $name, $email_message); #construct the email headers $to = $email; $from = "webmaster@viaeterna.com"; $email_subject = "Your invited to a party!"; #now mail $mailing_result = mail($to, $email_subject, $email_message, "From: Party List Central ".$from); if ($mailing_result == TRUE) return 'Mailing successful!'; else return 'Mailing failed.'; } } $list = array(); foreach ($_POST as $key => $value) { // is this a name? if (substr($key, 0, 4) == 'name') { $index = (int)substr($key, 4); $list[$index]['name'] = $value; $name = $value; # echo "$name<br/>"; } // is this an email if (substr($key, 0, 5) == 'email') { $index = (int)substr($key, 5); $list[$index]['email'] = $value; $email = $value; # echo "$email<br/>"; } } foreach ($list AS $key => $pair_array) { //DOCUMENT_ROOT is the file path leading up to the template name. $this_result = mail_message($pair_array['name'],$pair_array['email'],'./invite_text.txt'); $list[$key]['result'] = $this_result; } echo '<pre>'; print_r($list); echo '</pre>'; ?> give that a whirl and see what you get. i'm not sure if this deviates from your assignment, but hopefully it helps you see what order to process the data in. if you're ever wondering what to do with the data you've got, echo all your variables and see what you've got to work with.
  17. can we see the script that's calling this function? i presume you're iterating through the array of names/emails (as per the other thread) and running this function each time? if so, it's likely that you're replacing the $sent array every time mail_message() is called. the tell-tale sign of this being the issue is that it only ever contains the information of the last person mailed at the end.
  18. this will seem silly, but you're using $result rather than $resulta to assign the value to $user_id... typo?
  19. no, $months is an array of the months. $month is the variable you're comparing the $key to in order to check whether it should be the selected option or not. also, i meant the HTML as in the HTML code that the PHP script outputs.
  20. first off, please PLEASE get quotes around those HTML attributes! it's begging for issues to get into the habit of not using them. second, where is $month coming from, and what format is it in? third, what does the HTML output look like? do you end up with several options that have " selected" at the end of the option tag?
  21. .. i think you forgot the part of the query where you tell it WHAT name to pull out of the table. otherwise, it will simply return all names currently in the database. if (isset($_POST['Name'])) { $query = "SELECT NameDB FROM Table WHERE NameDB='{$_POST['Name']}'"; $resource = mysql_query($query); if ($result === FALSE) { echo 'Query failed: '.$query; } else { if (mysql_num_rows($resource) == 0) echo 'Name is not taken.'; else echo 'Name is currently taken.'; } } it is extremely wasteful of resources and time to pull every record from the database and iterate through them looking for a matching value - let MySQL do the legwork, and SELECT exactly what you're looking for.
  22. if you're not calling that chunk of code after updating the <td> element with AJAX, then it won't have a value, because the element's innerHTML hasn't been updated yet. it would be helpful to see the whole script if you want more help.
  23. and is that code working for you? if so, then you should have no problem assigning that innerHTML to a local variable.
  24. it could be that MySQL is limiting the size of the data that's SELECTed. how big is the file that you've stored?
×
×
  • 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.