Jump to content

webguy262

Members
  • Posts

    95
  • Joined

  • Last visited

Everything posted by webguy262

  1. Simple table with two cols: date & email. I want to select unique (distinct ?) emails so I don't get dupes, but I also want the date column for the unique emails. If I do this in phpmyadmin... SELECT DISTINCT email, date FROM `voter_emails` ... I get duplicate emails. So I guess I need a subselect or temp table? Can anyone help with syntax for that?
  2. The class makes a soap call to get an xml feed and then creates a grid showing the data. I did not write the application, I'm just trying to adapt it for use with multiple sites. I could put a copy of the class file in each domain folder, but I prefer having one copy of the file to make modification easier. On the designated $results_page, the class file gets called as follows: <?php include('../classes/class.grid.php'); $grid = new grid(); print $grid->displayEventByEventIDInteractive($_GET['eventID']); ?>
  3. I have a class that creates a grid from an xml feed. The class file is attached. The grid displays on a page which is defined within the class as follows: private $results_page = '/foobar.php'; I'm including the same class in multiple folders (the folders are addon domains) so I can have just one copy of the class so it is easy to modify. The problem is that I need to add a variable containing the folder name to the $results_page path, so that when the class executes within each folder, the $results_page is 'FOLDER//foobar.php' I have a file with defines in each folder, and I have tried including that file in the class and using the defined var in the construct, but I can't get it to work. What am I missing? [attachment deleted by admin]
  4. thanks!
  5. Thanks for the CREATE TABLE info. Just what I needed! The only pain was that the two tables had several common columns so although I wanted all the columns, I had to specify each individual columns I wanted, leaving out the common ones. Thanks again!
  6. Are there any shortcuts to taking the result of a join query and using it to create a new table? Using pma I can obviously export the data, but what about the structure of the table? Or at least the col names? I guess I could export a SQL file for each table, and put them together in a text editor, right? It would be great, tho, if I could do it all in one step from the result of the join query.
  7. Chris / Maq Thanks for the guidance! Very clear! One question... Is there a difference between $var['foobar'] and $var[foobar]? I recall having to use one or the other but I'm not clear on the difference. Hard to goog this kind of stuff b/c the punctuation gets ignored.
  8. I swear, I'll never grasp the use of ', `," in php & phpmyadmin (in particular)! I need to do some googling! Thanks!
  9. I'm trying to do a simple left join of two table on a common column. For some reason, the joined table values are all coming back NULL. What am I missing? SELECT * FROM surveyview_staging LEFT JOIN surveyallanswers_staging ON 'surveyallanswers_staging.response_id' = 'surveyview_staging.response_id'
  10. I need some help with the query for a form that selects values across multiple columns, and allow users to select multiple values in several columns. http://brinsterinc.com/tpa/tpasearch.php I assume you build the where clause for the sql by determining if there is an option value has been selected in the single-value select boxes. But how do I handle the multi-select list boxes? I'm desperate for help! Need to get somewhere with this over the weekend! TIA!
  11. I suspect the problem may be in the if (isset($_POST['submit'])) { because I can't even echo something. Any ideas?
  12. I want to let users select and upload a file. The select form and upload sritp work when they are on different pages, but I want them on the same page with the upload script executing only if the form has been submitted. Here the upload form <!--select the file --> <form enctype="multipart/form-data" action="manage_files.php" method="POST">Please choose a file to upload: <input name="uploaded" type="file" /><input type="submit" value="Upload" /></form> ... and here's the upload code... <!--upload the file --> <?php if (isset($_POST['submit'])) { $target = "safes/"; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; //This is our size condition //if ($uploaded_size > 350000) //{ //echo "Your file is too large.<br>"; //$ok=0; //} //if (!($uploaded_type=="application/zip")) { //echo "You may only upload ZIP files.<br>"; //$ok=0; //} //Here we check that $ok was not set to 0 by an error if ($ok==0) { Echo "Sorry your file was not uploaded"; } //If everything is ok we try to upload it else { if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else { echo "Sorry, there was a problem uploading your file."; } } } ?> What am I missing? Thanks for any help!
  13. Awesome! Thanks again!
  14. OK, I got the $exp_date to come straight out of the query. Thanks! But, yes, the days remaining has to be calculated from the date + one year. Is that what you noticed? I assume the DATE_ADD value is not available within the query, right? Thanks, guys, for the help!
  15. Both solutions look great. I stuck with manipulating the date after the query and it works great. Final piece is getting the number of days remaining until the expiration date. I now have... $orderdate = $orders['date_purchased']; $exp_date = date('F j, Y', strtotime("$orderdate +1 year")); And I found this code to calculate days remaining to a date... $cdate = mktime(0, 0, 0, 12, 31, 2009, 0); $today = time(); echo $today; $difference = $cdate - $today; if ($difference < 0) { $difference = 0; } echo "There are ". floor($difference/60/60/24)." days remaining"; How do I get my expiration date ($exp_date) expressed in a way consistent with the $cdate var so the subtract operation works? Or is there another way to do the days remaining calculation from the way the $exp_date var is already formatted? Thanks again to the board... I am actually sarting to get some date() & time() knowledge!
  16. I made some progress using strtotime to convert the db result to a timestamp. Here's where I'm stuck: Any idea why this works... $convert_date = date('U', strtotime($orderdate)); But this fails... $convert_date = date('U', strtotime("+1 year", $orderdate)); ...and returns 31538010 (the date for which is 12-31-1970) What am I missing?
  17. I must admit that dates and timestamps really confuse me! I have a query that gets a field named "date_purchased" and returns it like this "2010-09-05 09:58:12" What I need to do is add one year to the date, and display it like this "September 5, 2011" Basically, it's displaying the end date of a one year subscription. The database captures the purchase date with the order, so I want to grab that, add a year, and display it to the customer. Any help would be most appreciated!
  18. trying to exclude . and .. files from a dir listing and getting Fatal error: Call to undefined function isDot() with the follwing code $files = scandir($dir); $counter = 0; foreach($files as $file) { if (!$files->isDot()) { echo $file; $counter++; } } I'm a bit buzzed so I prob should not be working but... ...what am I missing?
  19. thanks for the replies! I'll try them and post back.
  20. I need an if statement that works like this... if the datetime in the database is less than a year earlier than the current date account is good; else your account has expired. I suspect it is something like... if (curtime() - $datetime_in_dbase <= 365 days) { ok } else { not ok } Can't seem to find exactly how to code it. Suggestions?
  21. I'm looking for a script that allows for scheduling and paying for blocks of time at a sports facility. Any suggestions?
  22. You could do a form with checkboxes next to each feature. Submitting the form would return a web page populated with only those features you checked. Then simply save the web page as a pdf (built into print function on a mac but can be done on win with a pdf-maker utility. This approach would have the added benefit of being able to create a url that could be entered to call up the same feature-specific page on your site. The various features would be in the url as parameters like http://www.mystore.com/brochure.php?features=1_6_7_11.
  23. got it... I was not getting the variable from the url. This works... <?php $dir = $_GET['dir']; $dir = "images/" . $dir . "/"; $images = scandir($dir); $counter = 0; foreach($images as $curimg) { if (strpos($curimg, '.jpg')>0) { echo "<td align=\"center\" class=\"items\"><img src=\"$dir$curimg\"></td>"; $counter++; if ($counter % 3 == 0) { echo '<tr></tr>'; } } } ?>
  24. Trying to display images using scandir(). Works local, but fails @ godaddy (PHP5). Here is the code... <?php $dir = "images/" . $dir . "/"; $images = scandir($dir); $counter = 0; foreach($images as $curimg) { if (strpos($curimg, '.jpg')>0) { echo "<td align=\"center\" class=\"items\"><img src=\"$dir$curimg\"></td>"; $counter++; if ($counter % 3 == 0) { echo '<tr></tr>'; } } } ?> I'm calling the page like this... http://www.brinsterinc.com/ct&s/fashion-beauty-novelty.php?dir=novelty But the variable is not being passed, as you can see by the echo of $dir on that page... images// Locally, it works fine and the echo is... images/novelty/ What am I missing?
  25. Trying to test form submission at GoDaddy and it does not seem to work. Here's the page... http://brinsterinc.com/tireclick/test.php Here's the source... <html> <head></head> <body> <?php if ($submit) { echo "Submitted"; } else { echo "Nope"; } ?> <form action="test.php" method="post"> <input name="submit" type="submit" value="Submit" /> </form> </body> </html> Have they shut down all form submissions that don't use their scripts?
×
×
  • 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.