Jump to content

tmh766

Members
  • Posts

    46
  • Joined

  • Last visited

    Never

Everything posted by tmh766

  1. Hi I can write this in multiple queries but I was hoping it would be possible to combine this into one. I have three tables: `mail`========================= #Contains a list of messages and their owning business ID. `businessId`,`message`,`sent` `business`====================== #Contains a business ID and a CSV of user IDs subscribed to to receive messages from this business. `businessId`,`name`,`userIdCsv` `user`========================= #Contains a user ID and their email. `userId`,`email` My goal is to first get all messages in the `mail` table that have not been sent (sent=0). Then for each each unsent message, for each `businessId` send a message to all user's emails. In other words, for each message where `sent`=0 I am trying to get rows with `mail`.`message`,`business`.`name,`business`.`userIdCsv`. Can anyone suggest a way to actually get `user`.`email` too all in one query instead of a CSV of user IDs? Any guidance would be appreciated! Thanks!
  2. Thank you for helping, but I ended up just eliminating the variables sent by ajax.
  3. Yes but it is mixed with HTML, it is not just Javascript. I think I will investigate another way to complete this rather than having to deal with parsing it out.
  4. Oops this should be in the Ajax Section can someone move it? I apologize.
  5. Hey Is this what you are looking for http://www.php.net/manual/en/reserved.variables.server.php So $_SERVER['HTTP_REFERER'];
  6. Hi everyone. I have never done anything like this and can't seem to figure out a solution. I have a page with a div whose content is reassigned onclick by way of an Ajax request. Here is the part I can't figure out. The div's content (a bunch of text comments and a reply box) uses JavaScript to move the reply box up and down to each comment when clicked, and more importantly, to set an ID variable, in the form (which contains the comments and reply box) so when posted, the server knows which comment is being replied to. Does anyone have an idea on how I can get the JavaScript within the returned text from the Ajax request to be evaluated? I can't seem to figure out a way. The Ajax request and is completed successfully, the returned HTML snippet is evaluated and rendered, but not the JavaScript that accompanies it. Thanks a lot for your time, I would greatly appreciate any insight on this problem, Tim
  7. submiited is spelled wrong if (isset($_POST['submiited'])) {
  8. Hi everyone I have been trying for hours to understand a way to do this. I need to replace all instances of "http" all the way to the first space character (get a url), as long as it does not end in ".jpg",".gif"...etc I can match a URL, /(http[^\s]+)/i but cannot figure out a way to not match it if a picture extension is present in the end. Thank you!
  9. Hey I can't do it like that though because the function is a String. What I was looking for was eval(), I can call eval($variable) so as long as $variable had return ahead of the function.
  10. You can store it in the database either way. If you store it in the database without replacing the enters with <br>s, just be sure to format it when you display it in HTML. The reason you have to replace the enters ("\r") with <br>, is HTML does not care about white space.
  11. I don't understand how to execute $variable, $variable() would not work as its not just a function name, but one with parameters.
  12. Hey just try out str_replace("\r",'<br>',$string); If that does not work, replace the "\r" with "\r\n"
  13. Is this possible? For example $variable="functionOne('param1','param2')"; Another example $varaible2="functionOne(functionTwo(1))"; Is it possible to execute $variable which would then call functionOne and pass it its parameters? And is it possible to execute $variable2 which would call functionOne which would call functionTwo?
  14. Hey Thank you so much, I didn't know about that.
  15. Hey I can't seem to figure out how to write this query. I have a PHP variable set to, for example: $match='a,b,c'; and want to check if a MySql field's value is within the variable match, not the other way around like usual. So if theMySql field had a value of "a", that row would be returned because the field's value is a substring of the variable match. Tim
  16. Can you split a string with more than one delimiter?
  17. How can you read only the last line of a file without reading the entire file? I have a log and only need the most recent line of data which is at the end.
  18. Is there a way to generate a random number with the date as a seed rather than the time so that a new random number is generated daily?
  19. So there is no simple predefined way to do it, I have to use this function Array_Search_Preg( $find, $in_array, $keys_found=Array() ) { if( is_array( $in_array ) ) { foreach( $in_array as $key=> $val ) { if( is_array( $val ) ) $this->Array_Search_Preg( $find, $val, $keys_found ); else { if( preg_match( '/'. $find .'/', $val ) ) $keys_found[] = $key; } } return $keys_found; } return false; }
  20. You guys helped me yesterday but I cant still can't figure out my problem What would you use to search an array for a substring and return the key its in? array_search($s1,$s2); what else
  21. Is it not possibe to search for a substring in an array and return the cell.
×
×
  • 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.