Jump to content

adriscoll

Members
  • Posts

    38
  • Joined

  • Last visited

    Never

Everything posted by adriscoll

  1. Hello. I have an Apache handler but would prefer to use a wget command to pull a .php file that is scripted to query a database. The php runs correctly but my crontab line of code keeps getting rejected. * * * * * /usr/bin/wget http://www.website.com I have tried it using "" quotes around the url. I have also tried it using -q in between the wget and http lines. Whenever there is a space following the /usr/bin/wget section, I get an error saying that it can't be found. I will contact the hosting provider, but wanted to check here first.
  2. PFM, The WHERE statement should have been removed in my code before I posted this. I have a small database and was setting it up to scroll through all entries. I know that is not the best method, but, once I could get that to work, I was then going to do it based on entries made on the current day and run it at 11:59pm.
  3. PFM*, thank you again. I guess there is no need to send a PM over to you now about this one. Very easy fix, so thank you again. I did have a question about the data input and an error I keep coming across. When I run this query, everything goes fine, and when it hits a duplicate email address it is savvy enough to not allow it. Awesome. "Duplicate entry 'generic@email.net' for key 2". However, I keep running into an issue where it will load all of the appropriate new email addresses that occur before the above mentioned dup in the list, but not after it hits the dup email. Any thoughts?
  4. PFMaBiSmAd, Thank you. That worked wonderfully.
  5. Hello. I would like to transfer information from one table to another. Currently, the code below works well. $result = mysql_query( "INSERT INTO table2 (name, email) SELECT firstname, email FROM table1 WHERE email='generic@email.com' ") or die(mysql_error()); However, I would like to add another layer of complexity but my effiorts have not worked well. I would like to add default information into 2 new fileds within table2 (registered & confirmed). In table 2, these should both defaul to a value of "1". My feeble attempt is below. $result = mysql_query( "INSERT INTO table2 (name, email, registered='1', confirmed='1') SELECT firstname, email FROM table1 WHERE email='generic@email.com' ") or die(mysql_error()); Any help would be appreciated.
  6. Nodral, I appreciate the response but that query didn't populate anything. I think it is on the right track, but am unable to execute it.
  7. For whatever reason, most browsers will not recognize the id although it is coded. I ended up removing any browser requirments from the backend, so now it works on all browsers.
  8. Pikachu2000 , It worked like a charm. as always, thank you.
  9. Hello. I am having difficult combining 2 functions. On their own, each works fine. I would like to sum all of the hours within a certain event type based on the current year. Year = in table as DATE type and formatted as 2011-05-01. My current code to sum the hours is: <?php include('dbconfig.php'); // Make a MySQL Connection mysql_connect("localhost", "$user", "$password") or die(mysql_error()); mysql_select_db("$database") or die(mysql_error()); $result = mysql_query("SELECT sum(hours) AS total_hours FROM event_schedule Where park = 'ParkA' ") or die(mysql_error()); while($row = mysql_fetch_array($result)) { echo "Hours Worked: "; echo $row['total_hours']; } ?> I was thinking of combining that with something similar to what's below but don't know how to. <?php $cur_year = date("Y"); echo $cur_year; ?> Thank you in advance.
  10. Hello. I have a simple enough code that takes information from one table and drops it into another. This is great, but I have 2a new complexities that I have been unable to code correctly. A. 'lastname', 'firstname' on table1 need to be combined into 'name' How & Where do I combine these strings and then pass them? <?php include('dbconfig.php'); // Make a MySQL Connection mysql_connect("localhost", "$user", "$password") or die(mysql_error()); mysql_select_db("$database") or die(mysql_error()); $result = mysql_query( "INSERT INTO table2 (lastname, firstname, email) SELECT lastname, firstname, email FROM table1 WHERE email='someemail@gmail.com' ") or die(mysql_error()); ?>
  11. I would think it would be considered a PHP issue if it works fine in plain HTML, but, because of an 'echo' or 'print' statement the outcome of functionality has changed.
  12. Pikachu2000, thank you for observing this post, but I have to disagree. This is not a HTML or JS issue. It is a php code issue in which the browser was not recognizing the textarea identification because of the single quotes. thank you. adriscoll
  13. Drummin, Thanks for catching that. That was quite a bonehead scrap to leave in there. Unfortunately, though, it didn't change the other browsers not reading it. I guess it's time to look into those other options.
  14. crmamx, i will be happy to look into those, but it doesn't exactly help me understand if my code is wrong. As i mentioned, this works for IE, but not the other browsers. thank you.
  15. Hello. I am using openWYSIWYG by openWebWare. It works great on IE but will not function on any other browsers. It gives the error message, "No text area found with the given identifier (ID: nletter)." I think this is because of how I coded it, but could use an expert opinion. Thank you in advance. <script language="JavaScript" type="text/javascript" src="openwysiwyg_v1.4.7/scripts/wysiwyg.js"></script></script> <script language="javascript1.2"> // attach the editor to a specific text area WYSIWYG.attach('nletter'); </script> <?php include('dbconfig.php'); // Make a MySQL Connection mysql_connect("localhost", "$user", "$password") or die(mysql_error()); mysql_select_db("$database") or die(mysql_error()); $adminmail="crew@xxx.com"; // Pass the event id variable $event_id=$_GET['id']; if(isset($_POST['submit'])) { $subject=$_POST['subject']; $nletter=$_POST['nletter']; if(strlen($subject)<1) { print "You did not enter a subject."; } else if(strlen($nletter)<1) { print "You did not enter a message."; } else { $nletter=$_POST['nletter']; $subject=$_POST['subject']; $nletter=stripslashes($nletter); $subject=stripslashes($subject); $lists=$_POST['lists']; $nletter=str_replace("rn","<br>",$nletter); //the block above formats the letter so it will send correctly. $getlist="SELECT * from volunteer WHERE event_id = '$event_id' "; //select e-mails in ABC order $getlist2=mysql_query($getlist) or die("Could not get list"); while($getlist3=mysql_fetch_array($getlist2)) { $headers = "From: $adminmail \r\n"; //unlock adminmail above and insert $adminmail for email address $headers.= "Content-Type: text/html; charset=ISO-8859-1 "; //send HTML enabled mail $headers .= "MIME-Version: 1.0 "; mail("$getlist3[email]","$subject","$nletter",$headers); } print "Your Message Has Been Sent."; } } else { print "<form action='volunteer_send.php?id=".$event_id."' method='post'>"; print "Subject:<br>"; print "<input type='text' name='subject' size='20'><br><br>"; print "Message:<br>"; print "<textarea name='nletter' cols='50' rows='6'></textarea><br><br>"; print "<input type='submit' name='submit' value='submit'></form>"; } ?>
  16. The quotes did the trick. I still don't entirely comprehend how partial values passed through, but it works. Thanks a ton wildTeen88.
  17. If that were the case, how is it that single word values make it through fine? Shouldn't it all be broken? I'll test it in the mean time.
  18. The first file (webform) is getting the information from url link on a preceeding page. It displays the information correctly as someone sees the detail and enters in their personal info to sign up. From there, it passes the variables as 'hidden' to a backend file that inserts info into the DB. They then get an autoresponse, but the autoresponse is cutting off the 2nd word of any entries with multiple words in the text field. Fields effected are: Description, crew leader, meetingplace (really any with 2 words) <?php include('dbconfig.php'); $event_id = $_GET['id']; $park = $_GET['park']; $orderdate = $_GET['orderdate']; $meetingPlace = $_GET['meetingPlace']; $description = $_GET['description']; $leader = $_GET['leader']; $hour = $_GET['hour']; $min = $_GET['min']; $ampm = $_GET['ampm']; $sponsor = $_GET['sponsor']; echo "Date: $orderdate"; echo "<BR>"; echo "Park: $park"; echo "<BR>"; echo "Description: $description"; echo "<BR>"; echo "Meeting Place: $meetingPlace"; echo "<BR>"; echo "Crew Leader: $leader"; echo "<BR>"; echo "Sponsor: $sponsor"; echo "<BR>"; echo "Start Time: $hour"; echo ":"; echo $min; echo $ampm; ?> <body> <form enctype="multipart/form-data" action="volunteerDB.php" method="POST" name="myform"> <table border="1"> <input type="hidden" name="event_id" value=<?php echo $event_id; ?>> <input type="hidden" name="park" value=<?php echo $park; ?>> <input type="hidden" name="orderdate" value=<?php echo $orderdate; ?>> <input type="hidden" name="description" value=<?php echo $description; ?>> <input type="hidden" name="meetingPlace" value=<?php echo $meetingPlace; ?>> <input type="hidden" name="leader" value=<?php echo $leader; ?>> <input type="hidden" name="sponsor" value=<?php echo $sponsor; ?>> <input type="hidden" name="hour" value=<?php echo $hour; ?>> <input type="hidden" name="min" value=<?php echo $min; ?>> <input type="hidden" name="ampm" value=<?php echo $ampm; ?>> <tr> <td>First Name</td> <td> <input name="firstname" /> </td> </tr> <tr> <td>Last Name</td> <td> <input name="lastname" /> </td> </tr> <tr> <td>Email</td> <td> <input name="email" /> </td> </tr> <tr> <td>Phone</td> <td> <input name="phone" /> </td> </tr> <tr> </tr> </table> <input type="submit" value="Sign Up" onclick="verify();"> </td> </tr> </form> </body> the backend file is: <?php include('dbconfig.php'); $event_id = $_POST['event_id']; $park = $_POST['park']; $orderdate = $_POST['orderdate']; $meetingPlace = $_POST['meetingPlace']; $description = $_POST['description']; $leader = $_POST['leader']; $sponsor = $_POST['sponsor']; $hour = $_POST['hour']; $min = $_POST['min']; $ampm = $_POST['ampm']; $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $email = $_POST['email']; $phone = $_POST['phone']; $email_list = $_POST['email_list']; // Make a MySQL Connection mysql_connect("localhost", "$user", "$password") or die(mysql_error()); mysql_select_db("$database") or die(mysql_error()); // Insert a row of information into the table "example" mysql_query("INSERT INTO volunteer (id, event_id, park, firstname, lastname, email, phone, email_list) VALUES('', '$event_id', '$park', '$firstname', '$lastname', '$email', '$phone', '$email_list') ") or die(mysql_error()); ?> <?php $to = "$email"; $subject = "Trailworker Event Signup Confirmation"; $message = "Hello $firstname! Thank you for signing up to work the '$park' trailworker event listed below. If you have any questions, please visit the Volunteer page on the Trailworkers website at http://www.trailworkers.com/index.php/volunteer and click on the event crew leader's personal contact link to open a message form. Volunteer Event Information Park: $park Date: $orderdate Time: $hour:$min $ampm Meeting Place: $meetingPlace Description: $description Crew Leader: $leader Sponsor: $sponsor"; $from = "crewleader@xxx.com"; $headers = "From: $from"; mail($to,$subject,$message,$headers); echo "Thank you for signing up. You will receive an email shortly letting you know event details and who your crew leader is."; ?>
  19. Hello. I am trying to pass along a variable in an email auto response ($park), however if the variable is 2 words then it only passes along the first word. Any info would be great. <?php $to = "$email"; $subject = "Event Signup Confirmation"; $message = "Hello $firstname! Thank you for signing up to work the $park event. Someone will contact you shortly. Event Information Park: $park Date: $orderdate Time: $hour:$min $ampm Description: $description Crew Leader: $leader"; $from = "guy@xxxx.com"; $headers = "From: $from"; mail($to,$subject,$message,$headers); echo "Thank you for signing up. You will receive an email shortly letting you know event details and who your crew leader is."; ?>
  20. Hello. I have a form where people can sign up for events. I want to stop them from signing up for the same event multiple times, and wanted to know if it is possible to do some type of check before insert. I need help with the theory of how this would be accomplished.
  21. Hello. How can I insert a prompt to confirm the deletion of a record? Currently I have a page that lists all of the table entries with a url to pass along the variable to identify the record to delete on a hidden, secondary page. Page 1 echo "<a href=\"/administrator/db/event_delete2.php?id=$row[id]\">Delete</a>"; Page 2 mysql_query("DELETE FROM event_schedule WHERE id='$id' LIMIT 1"); The code may be sloppy, but it works. Now I am trying to add the speedbump of the "are you sure you want to delete this record?" Thank you.
  22. Everything worked perfectly once i changed the table structure to DATE vs VarChar. Thank you much.
  23. Hello, I have a query that displays a list of events for the year, and am in need of guidance on how to have it only show events that are >= today's date. The 'date' is inserted into the table as a varchar field from javascript code. There was an old blog post about doing something like.... SELECT * FROM calendar WHERE `date` >= NOW() ORDER BY date ASC LIMIT 5 I seem to have trouble in that i believe NOW() will only work with proper datetime entries as opposed to my varchar setup. any help navigating this would be great.
  24. cunoodle, thank you for the guidance. The idea makes sense, but where do i put it in...at the INSERT command?
  25. Hello. My query results are only pulling partial values for table entries with a space (Example: AJ Smith only returns AJ and not the full name ). I am sure this is an easy fix and I am just missing something. Thank you.
×
×
  • 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.