purefusion
Members-
Posts
19 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
purefusion's Achievements
Newbie (1/5)
0
Reputation
-
Store contents of an array export into a new variable
purefusion replied to purefusion's topic in PHP Coding Help
kenrbnsn, awesome! Thank you! Works perfectly :) -
Store contents of an array export into a new variable
purefusion replied to purefusion's topic in PHP Coding Help
Thorpe, thank you. Now what happens if I'm already using ob on the page. Is there another way to loop the array contents into a string as Key -> Value without using objects? Thanks again. -
Hi. I'm looking to store the string printed by either var_dump(), var_export() or printr() into a new non-array variable for quick sending of email. Any ideas? Also, is there such a thing as a "Pretty" Variable Dump? Maybe a loop that would store the array in a pretty string format? It's not important enough that it needs to be formatted to look nice, but there is a lot of information coming from the form. Thanks so much!
-
wow, none of those worked. I extracted a small amount of code to run the query outside of the main script it was located in: [code] <? $user = array ('jallen' => 'Jim Allen', 'mmessmer' => 'Mike Messmer', 'sshowalter' => 'Scott Showalter', 'dmartin' => 'Dean Martin', 'krea' => 'Kathy Rea', 'mshaffer' => 'Mike Shaffer', 'kjenkins' => 'Ken Jenkins', 'webmaster' => 'Annonymous Someone'); $username = 'mshaffer'; $name = $user[$username]; echo $name; ?> [/code] And as it turns out, the no-quotes method works fine. The problem I found was in that the part of the script generating the $name variable came [i]after[/i] the script calling it. Doh! But this script is huge, and so it was hard to see that at first. Thanks for coming together with all sorts of ideas. I definately learned something new! (the variable variables concept, with may come in handy down the road. :-D Thanks again!
-
I tried it with single quotes, double quotes and no quotes to no avail before I posted the topic. Nothing seemed to work. the array will contain a value "Full Name" from a key of "flastname" (first initial and lastname). But the form will only send the key as the variable, not the value. It's chosen from a drop down list.
-
I swear I did this before, using some method or another. I need to execute code similar to this: [code] <? $username = $_POST['assoc']; $name = $user['$username']; echo "$name"; ?> [/code] Simple enough. Also, is there a way to reverse lookup an array value from a key, or a key from a value? Thanks!
-
Hey, I'm looking for a [b][i]simple[/i][/b] script that generates the next few Tues/Thurs pair combinations and stores them in a numbered array. Simple enough? For example: If today is Monday the 13, array[1] = Tuesday14, array[2] = Thursday16, etc I would like to have this rule: if today is Tuesday already, start with the next Thursday, and vice-versa. They will be echoed in a loop that generates a drop down box in a form such as: [code] <select name="select"> <option value="tues14">Tuesday</option> <option value="thurs16">Thursday</option> < ... etc ... > </select> [/code] Hoping you can point me along in the direction of simple coding, as something I'd come up with would to too over-coded and would probably take forever to render. Thanks so much!
-
Hey, I'm building a 'build-a-label' type system in PHP using GD2/ImageMagick type functions. What I'm looking for is a function (preferably in GD2, since I'm used to those functions) that would convert a (colored) logo to black and white, and/or a (colored or black and white) logo to a monochromatic specified color, such as red or blue. I appreciate all help on this so much! Thanks :)
-
I'm looking for a good comparison of the two, other than the basic facts (ie. MySQL more widely available, etc). I notice that the people who use postgreSQL really like it and seem pretty dedicated to it. But I notice there isn't many people who frequent the postgreSQL forum on this site, so I decided to post in here to get a larger audience. What are some unique functions of either postgreSQL or MySQL that the other doesn't have? Basically, what could I do with one that I can't do with the other.
-
MySQL: supplied argument is not a valid resource
purefusion replied to purefusion's topic in MySQL Help
Well, I've managed to get it to work. I restructured the query to use the numbers in the primary key, rather than the referrer column. Here's the new posted code: [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--] [span style=\"color:#0000BB\"]<? [/span][span style=\"color:#007700\"]require_once([/span][span style=\"color:#DD0000\"]\"/home/novav2/mysql_connect.php\"[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]$mon [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]date[/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\'M\'[/span][span style=\"color:#007700\"]); [/span][span style=\"color:#0000BB\"]$ref [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]1[/span][span style=\"color:#007700\"]; [/span][span style=\"color:#0000BB\"]$query [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#DD0000\"]\"UPDATE conversion_tracking SET $mon=$mon+1 WHERE cpc_id=\'$ref\' LIMIT 1\"[/span][span style=\"color:#007700\"]; [/span][span style=\"color:#0000BB\"]$result [/span][span style=\"color:#007700\"]= @[/span][span style=\"color:#0000BB\"]mysql_query[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$query[/span][span style=\"color:#007700\"]) or die ([/span][span style=\"color:#0000BB\"]mysql_error[/span][span style=\"color:#007700\"]()); if (@[/span][span style=\"color:#0000BB\"]mysql_affected_rows[/span][span style=\"color:#007700\"]() == [/span][span style=\"color:#0000BB\"]1[/span][span style=\"color:#007700\"]) { echo [/span][span style=\"color:#DD0000\"]\" Done.\"[/span][span style=\"color:#007700\"]; } else { echo [/span][span style=\"color:#DD0000\"]\"Go!\"[/span][span style=\"color:#007700\"]; } [/span][span style=\"color:#0000BB\"]?> [/span] [/span][!--PHP-Foot--][/div][!--PHP-EFoot--] So I guess MySQL is really picky when you're using $variables and stuff like that. -
MySQL: supplied argument is not a valid resource
purefusion replied to purefusion's topic in MySQL Help
Yeah, I put those in a few days ago, and I haven't removed them. -
MySQL: supplied argument is not a valid resource
purefusion replied to purefusion's topic in MySQL Help
I have added the error checking statements and no errors are reported because the queries go through just fine. It's the mysql_affected_rows function that isn't working, and how can I throw a die statement in an if statement? Also, the $mon is a variable that holds the current month in mmm for (ex: oct). So the query takes oct and increments it (oct=oct+1) -> ($mon=$mon+1) Thanks -
MySQL: supplied argument is not a valid resource
purefusion replied to purefusion's topic in MySQL Help
The error is actually a warning: Warning: mysql_affected_rows(): supplied argument is not a valid MySQL-Link resource in /home/novav2/public_html/pages/php_mysql_testing.php on line 15 But it's still not echoing "Done." when it updates the db. I may need this function to work, so all help is appreciated greatly. The db connection script is at the server root. It works. What if I changed that link to an include instead of a require? What's the difference?