Jump to content

freshwebs

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

freshwebs's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. What is the standard way to pass an associative array of database results from PHP to JavaScript? I basically just need to have an array of data waiting and ready to use to populate a form via JS. I figured my options were to either serialize the array with PHP and then use a JS function to deserialize it. Or I could use XML which seems more JavaScript friendly, but less PHP. Which would be the most efficient way to handle this?
  2. Thanks, that gets the job done. I think there might be a more efficient way to do it, but it's sufficient for now. This is a really dumbed down version of what I'm doing. Basically, we need to be able view what someone's profile looked like any given week. I have it setup so that at max one new profile record is created each week, otherwise it's just updated. Let me know if you, or anyone else, has any improvements on the last query.
  3. Sorry, I meant to say that I need to select all the users and their most recent profile.
  4. Users: id, first_name, last_name, email, password Profiles: id, user_id, date, address, city, state, zip, etc. Every time the user changes their profile, another row is added with their user_id and the date. The query needs to select their row from the users table and their latest profile record. Thanks!
  5. This is probably a really simple query, but I'm having trouble figuring it out. I have two tables. One has user account information and the second has profile information. Changes to the profile are logged, so every time someone saves their profile, another row is added to the profiles table with the profile data, user_id, and date. I'm trying to write a query to join the two tables, only using the most recent profile data for each user. So, the query will return one row for every user with all their info. How would this be done? Thanks in advance!
  6. How do I match all characters except for a certain word?  I need to match text which may contain line breaks but stop when it comes to a </div> tag.  I've just been using "<div>([[:print:][:space:]]*?)</div>" but I feel like there's a better way to do it. Thanks for any help! Aaron
  7. So I'm an idiot with regular expressions, I can't ever seem to figure them out.  Could someone help me make a regular expression that will find all the anchors in a block of text and add a target="_blank" attribute to them?  It would be [i]greatly[/i] appreciated. Thanks!!!
  8. Yeah, I've thought about using the XML extensions but I don't have PHP5 installed on the server I use.
  9. I need some help creating a function that will be passed a block of html, a search tag, and the instance.  It will find the end of that specific tag and return everything between its opening and closing tags. For example: [code]function get_tag_contents($haystack, $tag, $instance=0) {   // function code }[/code] It would work like this: [code]$html = "<div id="page"><div>text a</div><div>text b</div>text c<div><div>text d</div></div></div>"; get_tag_contents($html, "<div>"); // would return "<div>fasdfsadf</div><div>hjkh</div>asdfas<div><div>dfasdf</div></div>" get_tag_contents($html, "<div>", 1); // would return "text a" get_tag_contents($html, "<div>", 3); //would return "<div>text d</div>"[/code] Can anyone help me with this?
×
×
  • 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.