Jump to content

fat creative

Members
  • Posts

    41
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

fat creative's Achievements

Member

Member (2/5)

0

Reputation

  1. This is the code. I was originally testing paypals IPN and it wasn't working. I finally stripped everything down to a single update statement and thats when I discovered it wasnt the IPN, it was updating with phpmyadmin. My workaround is I'm just not updating with phpmyadmin anymore, I am using this form. Now that I have the workaround, the form has grown quite a bit in complexity. But the problem existed when I was updating a single text field. include('inc/dbc.php'); $email = $_POST['email']; $city = $_POST['city']; $featured = $_POST['featured']; $today=date(Ymd); $item_name = $_POST['item_name']; // this will check what item was purchased, 1, 3 6 or 12 months and set the end date of the featured item to today PLUS that time lenght if ($item_name == 'Subscription term: 1 month') { $featured_end_date = date('Y-m-d', strtotime('+1 month')); } if ($item_name == 'Subscription term: 3 months') { $featured_end_date = date('Y-m-d', strtotime('+3 month')); } if ($item_name == 'Subscription term: 6 months') { $featured_end_date = date('Y-m-d', strtotime('+6 month')); } if ($item_name == 'Subscription term: 12 months') { $featured_end_date = date('Y-m-d', strtotime('+12 month')); } $query = "SELECT * FROM vendors WHERE email = '$email'"; $result = mysql_query($query) or die ("There was an error:<br />".mysql_error()."<br />Query: $query"); if(mysql_num_rows($result)) //if a record is found!!! { $ok = mysql_query("UPDATE vendors SET featured_end_date = '$featured_end_date', featured_start_date = '$today', featured = '$featured' WHERE email = '$email'") or die(mysql_error()); if($ok) { echo "record updated. city is $city and emai lis $email and featured is $featured and featured start date is $today and end date is $featured_end_date"; } else { echo "sorry didint work"; } } else { $ok = mysql_query("INSERT INTO vendors (email, password, featured, featured_start_date, featured_end_date, active) VALUES('". mysql_escape_string($email) ."', 'password' ,'yes','$today','$featured_end_date', 'yes') ") or die(mysql_error()); if($ok) { $query1k = "SELECT * FROM vendors WHERE email = '$email'"; $result1k = mysql_query($query1k); while($row = mysql_fetch_array($result1k, MYSQL_ASSOC)) { $sr = "sr"; $sr .= "$row[ttd]"; $sr2 = "sr2"; $sr2 .="$row[ttd]"; $sr3 = "sr3"; $sr3 .="$row[ttd]"; $sr4 = "sr4"; $sr4 .="$row[ttd]"; $ok1 = mysql_query("UPDATE vendors SET sr_ttd = '$sr', ttd2 = '$sr2', ttd3 = '$sr3', ttd4 = '$sr4' WHERE email = '$email'"); } echo "record INSERTED. city is $city and emai lis $email and featured is $featured and featured end date is $today"; } else { echo "sorry didint work"; } } Thank you for any suggestions!
  2. I have come across a problem in a database I am working with. I have a work around, but am still curious as to why this is happening and wondered if anyone else has experienced such a thing. I have a form that updates my database. I submit it and it updates fine. However, if I edit the database using phpmyadmin and then submit the form again, it will no longer update that field in the database. My form is updating a field to say YES and I edited it again in phpmyadmin to say NO and submit the form again, just to confirm everything is working. It won't update the database on the second submit. However, I can submit the form several times and have it update different information in that field and it works. Its only as soon as I update with phpmyadmin, the submit will no longer update that field. It will update other fields, just not the one I edited in phpmyadmin. Does anyone have any idea why this would happen? Thanks in advance for any help.
  3. Okay, I seem to have half of this working and this is the code if anyone could use it on another project. Seems to work using CSS. I got this code from the CSS library. /* ========== popup images for coupons =========== */ /*Credits: Dynamic Drive CSS Library */ /*URL: http://www.dynamicdrive.com/style/ */ .thumbnail{ position: relative; z-index: 0; color: #603814; text-decoration: italic; font-size: 14px; font-weight: normal; } .thumbnail:visited { /* this is the text color of the visited links*/ position: relative; z-index: 0; color: #603814; text-decoration: none; font-size: 14px; font-weight: normal; } .thumbnail:hover{ /* this is the text color when you hover over it*/ background-color: transparent; z-index: 50; text-decoration: none; font-size: 14px; color: #a52620; font-weight: normal; } .thumbnail span{ /*CSS for enlarged image*/ position: absolute; background-color: #663300; padding: 5px; left: -1000px; /* border: 1px dashed gray;*/ visibility: hidden; /* display:none;*/ color: #a52620; text-decoration: none; font-weight: normal; } .thumbnail span img{ /*CSS for enlarged image*/ border-width: 0; padding: 2px; font-weight: normal; } .thumbnail:hover span{ /*CSS for enlarged image on hover*/ visibility: visible; top: 0; left: 60px; /*position where enlarged image should offset horizontally */ font-weight: normal; } Then I slightly modified the code from the earlier referenced tutorial as follows: <?php //this is the mouseover.php file $img_number = imagecreatefrompng ("images/blankcoupon.png"); $number = "this is my new specials text"; Imagestring($img_number,19,50,75,$number,$black); header("Content-type: image/jpeg"); imagejpeg($img_number); ?> These are in two different files and the html code calls the php file as follows: echo "<a class=\"thumbnail\" href=\"#thumb\">$special<span><img src=\"http://site/~peach/mouseover.php\" /><br /></span></a>"; echo "</td></tr>\n"; The $special variable will display the first 40 characters of text on the site and then the mouseover should display all the text. What's displaying now is the $number text. I tried replacing that with $special, but it didn't show anything. What I can't seem to figure out now is how to pass the $special variable to the mouseover.php file. I'm not submitting anything like a form, so I don't think a _POST or _GET will work. It needs to happen on the fly. Does anyone have any thoughts on how to pass this information from the html page to the php page? Thank you so much for any suggestions!
  4. :-) I wasn't asking anyone to do my work for me. I was asking for suggestions, directions, advice, code SAMPLES (which I have gotten here before), etc which you have managed to provide. Thank you for that. I didn't copy code here as I have gone through dozens of tutorials and my code changes hour to hour. I could not get the original tutorial to create an image which is what I meant by I couldn't get it to work. I did get the tutorial you provided to create a square and generate a random image. I'm guessing I can change the random image to something that will get the information from my database by using select statements. I'm not sure what to change to get the background to be an image, not solid gray and that's what I seem to be missing in all of the tutorials I have found. I provided all that detail of what I am trying to do as I didn't think I explained myself well enough before and was simply trying to explain better. Here is my code as it is right now. It's simply the tutorial you provided (again, thank you). <?php header("Content-type: image/jpeg");?> <?php //random_number.php $img_number = imagecreate(100,50); $white = imagecolorallocate($img_number,255,255,255); $black = imagecolorallocate($img_number,0,0,0); $grey_shade = imagecolorallocate($img_number,204,204,204); imagefill($img_number,0,0,$grey_shade); ImageRectangle($img_number,5,5,94,44,$black); ImageRectangle($img_number,0,0,99,49,$black); $number = get_random(); Imagestring($img_number,9,30,15,$number,$black); header("Content-type: image/jpeg"); imagejpeg($img_number); function get_random() { srand(time()); $max = getrandmax(); return rand(1,$max) + rand(1,$max) ; } ?> This is called from a file with this code: <img src='http://www.mysite.com/random_number.php' /> THIS ONE IS WORKING <img onMouseOver="http://www.MYSITE.com/random_number.php">my image is here THIS ONE ISN'T WORKING, I AM STILL TRYING TO FIGURE OUT THE ONMOUSEOVER. So, anyone, thank you in advance for any help. It is truly appreciated.
  5. Thank you for the info. I have spent the last few weeks trying to get this to work with no avail. I've gone through this tutorial again and I just don't see it as what I am really looking for. What I will have is a database with name and special and featured (yes/no). If featured is a yes, then the name appears. When you mouseover the name, an image will appear and will automatically add in the text from the specials column on top of it. There will be multiple people who are featured = yes and they will each have their own special. At this point I have nothing. I thought it would be pretty simple and committed to do it, but now I am clueless how to even get started. ANY suggestions, direction, advice, code, would be appreciated. Thank you.
  6. I read that post before creating my post. Unless I'm totally missing it, it seems to be doing text on a square with the background colors changing. I've seem lots of tutorials on that, but it's not quite I'm needing. And unfortunately, I'm quite a newbie and I'm not sure what to change to get what I need.
  7. I am trying to code the following: when you mouse over a word, an image will popup. Obviously I can do this with javascript no problem. But I need a standard background image to always appear and then the text on the image to change based on whats in the database. For example, if clientid=1, then put the client name, address, etc on an image. If clientid=2, put the new client name, address, etc on the same image. Can anyone offer any suggestions? I have seen code to change the background color of a square and then I can make my php statements to retrieve the text I need, I can do a javascript onmouseover, but I can't seem to get that to work with a php file. I'm just not sure which way to go from here. ANY help would be appreciated!
  8. I'm open to changing the code completely, if anyone can suggest how. I'm a newbie to PHP and know nothing about Javascript, so I'd really appreciate any direction. Thanks everyone!
  9. I have a dynamic menu in a form where the user makes a selection in the first drop down and their choice populates the 2nd drop down. It was written in javascript and works great. What I can't figure out is how to get the selection the user makes written to my database. I have worked with array's before, but this one looks a bit different to me and I quite figure out what to do. If anyone could offer any direction, I would so appreciate it! The page with the form is at http://174.34.155.2/~farmers/join.php and the drop down is under the date / location section. The javascript section looks like this.... team = new Array( new Array( new Array("January 12"), new Array("January 19"), new Array("January 26"), new Array("February 2") ), new Array( new Array("January 10"), new Array("January 17"), new Array("January 24"), new Array("January 31") ), new Array( new Array("January 10", 23840238), new Array("January 17", 92390484), new Array("January 24", 29048203), new Array("January 31", 29345423) ), new Array( new Array("January 10", 23840238), new Array("January 17", 92390484), new Array("January 24", 29048203), new Array("January 31", 29345423) ), new Array( new Array("January 10", 20394802), new Array("January 17", 34982039), new Array("January 24", 92348902), new Array("January 31", 98234902) ) ); function fillSelectFromArray(selectCtrl, itemArray, goodPrompt, badPrompt, defaultItem) { var i, j; var prompt; // empty existing items for (i = selectCtrl.options.length; i >= 0; i--) { selectCtrl.options = null; } prompt = (itemArray != null) ? goodPrompt : badPrompt; if (prompt == null) { j = 0; } else { selectCtrl.options[0] = new Option(prompt); j = 1; } if (itemArray != null) { // add new items for (i = 0; i < itemArray.length; i++) { selectCtrl.options[j] = new Option(itemArray[0]); if (itemArray[1] != null) { selectCtrl.options[j].value = itemArray[1]; } j++; } // select first item (prompt) for sub list selectCtrl.options[0].selected = true; } } //--> Thanks!
  10. I have a a flash file reading a php file and as long as the php file says select EVERYTHING from the database, it works beautifully. However, when I pass a variable from flash to the php file, I can see in the browser that the variable is passed and the records are retrieved correctly when I look at the page through the browser, however, in Flash it displays a [type Function] error message instead of displaying the records. Does anyone have any ideas? I tried doing this several different ways, I've looked at amfphp, but my flash file is written in actionscript 2.0 and these other solutions have seemed to need 3.0. Thanks in advance for any suggestions!
  11. Thanks for the response. I looked over the amfphp thing and its honestly greek to me. If there are any other suggestions, I would very much appreciate it. I'm afraid the amf will take me the rest of the year to figure out.
  12. I am trying to send a variable (state = selection) from Flash to PHP, have that pull records from my database and then return the information to Flash in a new Frame. I cannot get it to work. When my PHP file (therapist.php) says to select everything from the table, it works fine. But when I try to get it to select what was passed from Flash, it will not work. I think it's not passing anything from therapists.php to therapists2.php, but I'm not sure how to get it to do that. Therapists2.php is creating an xml file. When I put everything into one file, I get an error message which is why I split it into two files. My scripst are as follows: frame name therapist_select actionscript stop(); var serverLang:String = "asp"; //Create a loadvars object named email_lv var state_search_lv:LoadVars = new LoadVars(); //this function is called when email_lv loads the server-side script. state_search_lv.onLoad = function(success) { if (success) { if (state_search_lv.state_search_mes == "ok") { gotoAndPlay ("therapist"); } } else { search_status_txt.text = "failed"; } }; state_search_btn.onRelease = function() { if (!state_list.selected) { search_status_txt.text = "Select state"; } else { state_search_lv.state_list = state_list.getValue(); state_search_lv.sendAndLoad("http://www.fatcreative.com/mmbr/therapists.php", state_search_lv, "POST"); } }; Frame name therapist actionscript = var xml:XML = new XML(); xml.ignoreWhite = true; xml.onLoad = function() { theTree.dataProvider = this.firstChild; } xml.load("http://www.fatcreative.com/mmbr/therapists2.php"); var treeL:Object = new Object(); treeL.change = function() { var item = theTree.selectedItem; var desc = item.attributes.description; var earl = item.attributes.url; if(earl) { getURL(earl,"_self"); } } theTree.addEventListener("change",treeL); theTree.setStyle("indentation", 20); theTree.setStyle("disclosureOpenIcon","TreeDisclosureOpen"); theTree.setStyle("disclosureClosedIcon","TreeDisclosureClosed"); theTree.setStyle("folderClosedIcon", "blankicon"); theTree.setStyle("folderOpenIcon", "blankicon"); theTree.setStyle ("defaultLeafIcon","blankicon"); stop(); therapists.php file $state = $_POST['state_list']; $ok = $query = "SELECT * FROM therapists"; //this line sends the mail and returns true or false if($ok) { echo "&state_search_mes=ok&"; //if mail was send print to the screen "&server_mes=ok" } else { echo "&state_search_mes=fail&"; // if mail was NOT sent, print to the screen "&server_mes=fail" } //$query = "SELECT * FROM therapists WHERE state = $state"; $query = "SELECT * FROM therapists"; $results = mysql_query($query); echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; echo "<therapists>\n"; while ($line = mysql_fetch_assoc($results)) { echo "<folder label=\"" . $line["name"] ."\" >\n"; echo "<info label=\"- Specialty: " . $line["modality"] ."\" />\n"; echo "<info label=\"- Price Range: " . $line["price_range"] ."\" />\n"; echo "<info label=\"- Gender: " . $line["gender"] ."\" />\n"; echo "<info label=\"- Licensed: " . $line["licensed"] ."\" />\n"; echo "<info label=\"- Years of Experience: " . $line["years_exp"] ."\" />\n"; echo "<info label=\"Visit My Page\" " . "url=\"" . $line["website"] ."\" />\n"; echo "</folder> \n"; } echo "\n"; echo "</therapists>\n"; therapists2.php file $query = "SELECT * FROM therapists"; $results = mysql_query($query); echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; echo "<therapists>\n"; while ($line = mysql_fetch_assoc($results)) { echo "<folder label=\"" . $line["name"] ."\" >\n"; echo "<info label=\"- Specialty: " . $line["modality"] ."\" />\n"; echo "<info label=\"- Price Range: " . $line["price_range"] ."\" />\n"; echo "<info label=\"- Gender: " . $line["gender"] ."\" />\n"; echo "<info label=\"- Licensed: " . $line["licensed"] ."\" />\n"; echo "<info label=\"- Years of Experience: " . $line["years_exp"] ."\" />\n"; echo "<info label=\"Visit My Page\" " . "url=\"" . $line["website"] ."\" />\n"; echo "</folder> \n"; } echo "\n"; echo "</therapists>\n"; Does anyone have any idea how to pass the variable from one file to the other? I also tried starting a session, but I got error messages with that one too. Or is there another way of doing this? I am new to AS, and just a beginner with PHP, so any help would be greatly appreciated. The site can be seen at http://www.FatCreative.com/mmbr and the action all takes place when you click on the Find a therapist link. Thanks again!
  13. I have a form that is dynamically created based on selections from a previous page. In the form, there are several checkboxes and each checkbox has a unique name. When this form is submitted, it checks whether each unique checkbox is either true or false and then sends mail based on that selection. What I need to add to this is the ability to select ALL checkboxes before submitting the form. I can do this in javascript, but that seems to need all the checkboxes to have the same name / different id. They all need to have a different name so I can evaluate them on the next page to send mail. I was hoping that if I put in all possible checkbox names, the javascript would just skip what doesnt exist, but instead it created an error message. I turned off the error messages, but it just stops the script, it won't just skip the line with the error in it. Does anyone know of a way to do this in PHP? Or anyway???? :-) I can't seem to get past this and I think it's the last thing I need for my project. I don't know javascript at all, and am quickly learning PHP, so any advice would be appreciated. Thanks in advance!
  14. mrdamien, thank you very much for all the help! Right now, I have the site done in my backwards way of doing it and since its due tomorrow, I'm giving it to the client this way. What I ended up doing was writing an if statement to see if each checkbox is "on". If it was, it sends the email. Then it checks the next checkbox. While it works, I know its not the best way as I had to create almost 500 if statements, one for each possible checkbox that could be on the page. However, I am making a copy of everything to play with on my own so i can learn how to do it the right way for the next project. The client did mention possibly updating some things later in the week and hopefully I can update the site with the better way. Thank you again, so very much. I have learned quite a bit with this project and am looking forward to the day that I can help others with their problems!
  15. Sorry, I haven't worked with arrays so I didn't really know what that was. I watched some video tutorials at killerphp.com last night, so I think I understand what to do, I just need to change the options to whats in my data. So I have id 126 ->email@email.com and I do that for the entire list. But I still don't understand what to do with it next. As far as the flow, yes that is correct in terms of what I can't get to work. The start of congress.php also emails the form data but I think I have that part working. On the congress.php form, I also need to add in a select all option, but I THINK I know how to do that. Late last night, I did come up with a very backwards way of getting this to work so I feel less pressure for the Monday deadline, but I'd still like to know how to do it the RIGHT way, so again, any other help would be appreciated. Thanks again!
×
×
  • 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.