[PHP] Getting arrays out of HTTP_POST_VARS
My mind is going blank here and I feel like I'm missing something basic. I have an insert form for movie profiles that takes cast members, writers and directors and inserts them into the tables for the correct movieid. In the old version of the script I would repeat the inserting section of the code three times, once for casts, once for directors and once for writers. The script checks if the person's first/middle/last name exists in the people table. If it does it grabs the id number, if it doesn't it doesn't it inserts it and gets the id number. The peopleid and titleid are then inserted into the appropriate table. (casts, writers, directors) I decided to streamline the code with a function so that calling peopleinserter($table,$titleid) would loop through the form variables and insert into the appropriate table. I can easily grab the results of the $HTTP_POST_VARS but I'm going blank trying to get the array out of the array. Here's a snippet: function peopleinserter ($table,$titleid) { //$titleid = the titleid from the titles table //$table = the job table e.g. casts, directors, writers global $HTTP_POST_VARS; $firstvar = first$table; //if $table = casts it would grab the firstcasts variables from the form $middlevar = middle$table; $lastvar = last$table; while (list ($key, $val) = each ($HTTP_POST_VARS[$lastvar])) { //in this example $lastvar=lastcasts, so it's calling each ($HTTP_POST_VARS[lastcasts]) // if I echo $key $val for this I would get for example 0 Thornton 1 Jolie //end snippet How do I call the key of the firstcasts, middlecasts, lastcasts arrays so I can do stuff like: $lastcasts[$key] = trim($lastcasts[$key]); and $sql = SELECT peopleid, first, middle, last FROM people WHERE first='$firstcasts[$key]' and middle='$middlecasts[$key]' AND last='$lastcasts[$key]]'; In other words, how do I get those three arrays out of the HTTP_POST_VARS array? Banging head on desk... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Getting arrays out of HTTP_POST_VARS
Wow, that holds the land speed record for a reply. Thanks for your help! Mike Eheler wrote: $HTTP_POST_VARS['middlecasts']['key']['subkey']['wecould']['go_on']['forver']; -- Ian Evans Digital Hit Entertainment - News and Information http://www.digitalhit.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Server limits/recommendations
I'd really like to move our site to a dedicated server, but I'm not ready to lay down the monthly cash for a multi-SCSI drived 1gig ram beast -- yet. Right now we're hosted by the oxymoronically named HostPro. We're on a shared NT server with a SQL Server ODBC connection and we use PHP to do a lot of the stuff on the site. There's stuff that just doesn't work. For example, I have better odds rolling the dice than hoping that my databse insert form for our entertainment news will work. Sometimes it does, sometimes it doesn't and Support (they had to name it something I guess) has never been able to figure out why. Covering the world of entertainment, we can average 10,000 pageviews a day but will swing up to 200,000+ on days like the Oscars. We've seen our bandwidth usage swing from 80meg a day to 3gig. I'd just like to get into an entry-level dedicated linux server, running apache, PHP and MySQL. I've looked at Rackspace as other contacts have recommended them and their entry level system consists of: 750 Mhz Processor 256MB RAM 20GB EIDE Drive 10GB/Month Burstable Bandwidth I'm looking for input on that configuration. The way I see it, if we're surviving on a shared server now, we'll still be able to stretch our feet and grow a bit (as well as being able to do things that we can't in our shared NT server) before we need to add memory and go to SCSI, etc. Do you concur? Thanks! -- Ian Evans Digital Hit Entertainment - News and Information http://www.digitalhit.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]