Jump to content

severndigital

Members
  • Posts

    355
  • Joined

  • Last visited

Everything posted by severndigital

  1. quick answer (not sure if it is the best though) add a time stamp to the entry and update based off that. i can elaborate more if you want to go that way. chris
  2. not sure why but you can try this to fix it. //change this mysql_query("INSERT INTO history SET uid='$uid', pro='$id'"); //to this mysql_query("INSERT INTO history SET uid='$uid', pro='$id' LIMIT 1"); that would stop it running itself twice perhaps. chris
  3. ok i know this is a newbie question, but i can't seem to find anything about it. maybe i am searching the wrong keywords. i want to test a statement before executing it. something like this. $sql "UPDATE workers SET workerStatus = '0' WHERE workerId = '$empno'"; //I want to test this statement here. $mysqltestcommand = mysql_query($sql); //I don't know the command for this part. $check = mysql_affected_rows(); //run the check here and if it equals 1 than actually run the query. if($check != 1){ echo 'There is an error processing your request'; } else { $runquery = mysql_query($sql); echo 'Your command has been processed.'; } does that make sense?? or should i be doing this a different way?? thanks in advance, chris
  4. thanks for that. it is working fine now. thanks, again chris
  5. i am trying to find the max number entered into a field and i am having some difficulty. the query is quite basic, i thought here is my code <?php $getit = mysql_query("SELECT MAX(Mnum) FROM masters"); $workit = $getit + 1; echo $workit; ?> basically i want to find the MAX value and add 1 to it. the max value in this case is 300001 when i run this code however, $workit returns a value of 8. what am i doing wrong?? thanks in advance. chris
  6. does anyone know of a good in-depth tutorial on how to do this?? basically copying billing information fields to shipping information fields. i can only find completed scripts and i was looking to learn how to and more importantly what is happening when i script this. instead of just copy/pasting code. thanks in advance, chris
  7. I know this is probably very simple but i have always had a problem getting this to work. I am hoping to solve this problem forever today i created some css information see below .menubar { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; color: #336699; } .menubar a:link { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; color: #336699; text-decoration: none; } .menubar a:hover { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; color: #336699; text-decoration: underline; } nothing fancy .. very simple. however, when i test the code in the browser (firefox and IE) the links turn purple and become underlined after i click them. I tried adding visited and active css to the code to try and defeat it. see below .menubar { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; color: #336699; } .menubar a:link { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; color: #336699; text-decoration: none; } .menubar a:hover { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; color: #336699; text-decoration: underline; } .menubar a:visited { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; color: #336699; text-decoration: none; } .menubar a:active { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; color: #336699; text-decoration: none; } when i do that the purple underlined goes away, but i no longer get the underline on roll over. this is sooooo frustrating. can anyone shed some light on this for me. thank you, chris
  8. thanks.. i can be a dope sometimes. my brain was fried yesterday. sorry for the bum post.
  9. ok .. i am trying to do a simple logout from a page. i was going to use this code <? $kill = session_destroy(); if(!empty($_SESSION['authenticate'])){ $message = 'There was a problem logging out. Check with Chris.'; $div_content = 'pages/empty.php'; } else { $message = 'You have logged out successfully. See you later.'; $div_content = 'pages/login.php'; } ?> i'm sure it's something stupid that is causing it to not work correctly. it seems to log me out and destroy the session but only after it runs the entire script. when i run the script i get the $message var for and error. when i refresh the page i get the $message var for success. please any help would be great. thanks, chris
  10. Anyone know of a good 'how-to' to create a site that will integrate modules into itself. thanks, chris
  11. how do you plan to modify it? are you just adding text / photos to it. or do you want to modify the text/photos that are already embedded within the pdf file?
  12. I am getting ready to redesign an existing site. I am starting from the ground up and only taking limited code from the original site. my question is simple. should i focus on securing the site first? or secure it after it is developed and working?? the site will be running in https any input would be great. thanks, chris
  13. Ok, i've grasped the idea of using for each to get the variables from the $_POST command. But how do I incorperate them into a DB Query? assume for this that I am auto collecting username and password, then I would like to use them in a mysql query here's what i have so far: <? //grab all fields from the form foreach($_POST['field'] as $key => $val){ } //I know the mysql query would like this. $user_check = mysql_query("SELECT * FROM users WHERE username='$whatgoeshere' AND password='$whatgoeshere'"); ?> I just don't know how to get the form fields to interact with other code together. the foreach loop seems to want to make them work independently of each other. Is what I want to do here possible? or should I just be hard coding this. The above is one example. I would also like to put this in place for updating information in the db and also passing the information through multiple forms. any help would be great. thanks, chris
  14. http://us2.php.net/function.opendir that should get you started.
  15. is your image path returning correctly? looks to me like the code for for test.php is trying to reference a graphic within the same directory as the script. this line specifically should maybe read $img_path = 'directory path/on server/';//location where images are stored on server $img_location = '' . $img_path . '' . $row['uploaded_photo'] . ''; //build link to photo $news = ImageCreateFromString($img_location); //make image based of path instead of only image name there maybe a way to simplify this but I broke it down so I could explain it. chris
  16. try this instead echo '<option value="' . $row['maincat_id'] . '">' . $row['maincat_title'] . '</option>\n'; I've had similar problems in the past and this has proved to be a worthy solution for me.
  17. I can change pretty much anything I need to. I am reworking my own existing code for a vesion upgrade on an application I designed. Can you explain the process in more detail? thank you. chris
  18. best starter tutorial ever, right here on freaks http://www.phpfreaks.com/tutorials/105/0.php that's where i got my intro to GDLib. that at the functions list at php.net good luck
  19. I am going through my exisiting code for a new version of my application. I need to process the results of form fields currently I do it like this. $var1 = $_POST['field1']; $var2 = $_POST['field2']; I don't mind this method except that I have to process 15 - 20 fields on each submit. So, I have to cut and paste this code over and over again and modify the vars and field names for each submit. is there an easy way to process the fields and assign variables to them, based on the name of the field processed? I am thinking I should use a foreach statement, but I am not sure exactly how to use it properly or if it can automatically assign field names and values. I supposed I could run an sql query to get the proper field names and then build the post statements dynamically based off of that information. Anyway .. any thoughts or suggestions on this one, would be much appreciated. Thanks, Chris
  20. 1. capture filename 2. explode filename 3. change extention 4. rewrite filename there are several ways to simplify this code, but i broke it out as specific as possible to explain it. <? /* get file name I assumed it was being uploaded. if not, you can pull the filename from a database as well */ $file = $_FILES['form.fieldname']['name']; //explode at the dot $var = explode(".",$file); /* This will put the file name into an array that contains the information before and after the dot */ //get the filename $filename = $var[0];//this will grab the info BEFORE the dot. //now change the ext $new_ext = 'wtw'; now piece it back together $filename = '' . $filename . '.' . $new_ext''; //do what ever you want with the file after this. ?> that should do what you need. you can do the same thing when reopening the file just change the new ext to whatever you need it to be. personally i would create two functions 1. changes name to .wtw 2. changes name to .swf for display and writes a temporary file to view.
  21. looks ok to me, but a few things. 1. not sure if mail servers will see the header you have as vaild. If not, they will kick your email back as spam. (can someone else vaildate this?) 2. i've had problems in the past with the mail() function. Depending on your host, you mave have to send the mail() function with a -f command. I've only ever had to do this twice but the problem does exists. unfortunate you don't have a place to test your scripts.
  22. thank you, thank you, thank you. I know it simple now, but I have been stuck on this for 3 days. thanks again, chris
  23. initially i would do it like this. 1. pass a hidden field that contains the current total of form fields. 2. when the button is pressed, post the hidden field and add 1. 3. run a while loop to display the results and decrease the hidden field by 1 until it reaches zero. 4. don't forget to post and echo the current form information so the user doesn't have to re-input. something like this which can probably be simplified, but to break it down I'll go through it. <? //get field $totalfields = $_POST['hiddenfield']; //add one $add1 = $totalfields + 1; //run while loop while($add1 > 0){ echo 'the form field data would go here. do not forget to echo the contents from the post.'; $add1 = $add1 - 1 ;//subtract 1 from the total until it reaches zero } //echo the hidden field + 1 to get next time. $hiddentotal = $totalfields + 1; echo '<input name="totalfields" type="hidden" value="' . $hiddentotal . '">'; ?> this should keep you from having to use JavaScript, but it will refresh the page.
  24. just do an 'SQL dump' or export. you can export the information to a file and then upload that file to the new database
×
×
  • 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.