Jump to content

complex05

Members
  • Posts

    124
  • Joined

  • Last visited

    Never

Everything posted by complex05

  1. Hello, How do I remove an element from an array? Here is my current code $sql = mysql_query("SELECT suitenos FROM gssettings WHERE id=1"); $row = mysql_fetch_assoc($sql); $suites = split(",",$row['suitenos']); $number_of_suites = count($suites); for($i=0;$i<$number_of_suites;$i++) { if($suiteno == $suites[$i]) { $selected = "SELECTED"; } else { $selected = ""; } echo<<<endhtml <option value="$suites[$i]" $selected>$suites[$i]</option> endhtml; } Now I have another table in my database called "gsdays" that holds values of suite numbers that are already booked. What I want to do is remove any suite numbers that are already booked from my $suites array. To get the booked suites, I would do the following query. $query = mysql_query("SELECT suite FROM gsdays WHERE date='2007-03-24'"); $row = mysql_fetch_assoc($query); $booked_suites = $row['suite']; so basically what I want to do is remove $booked_suites from $suites. I tried using array_splice but I don't know what I'm doing
  2. Well since nobody helped me I managed to research it and find it myself... here are the answers.. no cache: Header('Cache-Control: no-cache'); Header('Pragma: no-cache'); then to get all the checkboxes to another page, name them as follows <input type=checkbox name=checkbox[$id]> then in the php page, treat $_POST['checkbox'] as an array. Hope this helps someone in the future.
  3. Two part question: #1. I've built a little AJAX app, but the problem is anytime I do an update, I have to delete my temp files before I can see the update. Is there anyway around this? #2. Is there a way to know all the variables submitted to a form without knowing what the variables are before hand? For example, I have a form, where there are checkboxes. Each checkbox's name is an ID value from the database. When I submit the form, I need to know all the rows that were checked...
  4. I highly recommend you read PHPFreaks' tutorial on file uploading. I have been using this class for years now and it works perfectly... and has a function to specify the file formats you want to allow. http://www.phpfreaks.com/tutorials/85/0.php Hope that helps!
  5. yeah I can't use move_uploaded_files() because the perl script has already uploaded it and moved it. I'm aware of the open, read, copy, save and delete method but some of these files are 25MB+... don't wanna break my server :(
  6. [code]$textarea = "this is some text with 15 words in it"; $words = split(" ",$textarea); for($i=0; $i<15; $i++) { echo $words[$i]; }[/code]
  7. what does your form look like? Are you sure you have the correct enctype?
  8. what does your 'stripurl' function look like?
  9. [code] $total = $amount1 + $amount2 + $amount3; $totalamount = number_format($total); mysql_query("INSERT INTO table (amount1,amount2,amount3,totalamount) VALUES ('$amount1','$amount2','$amount3','$totalamount')"); [/code]
  10. Hello, I'm currently using a perl script to upload files (i'm using perl so I can use an AJAX progress bar) however since I don't know perl at all and have no desire to, I would like to use a PHP script to do what I want to do. Right now, the perl script uploads the files to /uploads/ then redirects to a page called finished.php. I need the files to go to different directories depending on who is logged into the system. I need to know how to move a file to a different directory in PHP. Is there a function to do this? Thanks, Barry
  11. omg that saddens me to know that perl > php in this department :(
  12. Hello, I've searched all over the internet for an upload progress meter bar, and I found a few... but unfortunatley I can't get any of them to work because they all need different extensions and libraries that my server won't allow... so I need to write my own. I know how to do everything except, get the progress/status of an upload. Is there a function in PHP that lets you know how many bytes have been uploaded... or a way to constantly check the filesize of a file while it's being uploaded?
  13. well noone replied and i figured it out... if anyone was curious here was my solution: [code] if ($handle = opendir('/home/dtech/public_html/whereisit/maps/')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { //echo $file; $image = exif_read_data("maps/$file",0,true); $images = array(); $images[$file]["lat"][0] = str_replace("/1","",$image['GPS']['GPSLatitude'][0]); $images[$file]["lat"][1] = str_replace("/1","",$image['GPS']['GPSLatitude'][1]); $images[$file]["lat"][2] = str_replace("/1","",$image['GPS']['GPSLatitude'][2]); $images[$file]["log"][0] = str_replace("/1","",$image['GPS']['GPSLongitude'][0]); $images[$file]["log"][1] = str_replace("/1","",$image['GPS']['GPSLongitude'][1]); $images[$file]["log"][2] = str_replace("/1","",$image['GPS']['GPSLongitude'][2]); print_r($images); } } } [/code]
  14. Hello, I've built a script but am getting a little confused when it comes to all these arrays. What my code is doing right now is reading images in a directory and grabbing their EXIF data (GPS specifically) [code] <?php if ($handle = opendir('/home/dtech/public_html/whereisit/maps/')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { //echo $file; $image = exif_read_data("maps/$file",0,true); foreach($image as $key => $section) { foreach($section as $name => $value) { if(is_array($value)) { foreach($value as $axis => $coordinate) { $coordinate = str_replace("/1","",$coordinate); $latitude = array(); if($name == "GPSLatitude") { echo "<li>" . $coordinate; } $longitude = array(); if($name == "GPSLongitude") { echo "<li>" . $coordinate; } } } } } } }   closedir($handle); } print_r($longitude); print_r($latitude); ?> [/code] Each image has GPSLatitude and GPSLongitude, both are arrays. Each array contains 3 values; they look like this GPSLongitude[0]: 1 GPSLongitude[1]: 2 GPSLongitude[2]: 3 GPSLatitude[0]: 4 GPSLatitude[1]: 5 GPSLatitude[2]: 6 So each image has 6 gps coordinates in total. I am able, so far, to get all the coordinates, but I cannot group them properly into an array. Basically I want it like this: $image["image1"]["longitude"][0] = 1; $image["image1"]["longitude"][1] = 2; $image["image1"]["longitude"][2] = 3; $image["image1"]["latitude"][0] = 4; $image["image1"]["latitude"][1] = 5; $image["image1"]["latitude"][2] = 6; Any suggestions? I am sort of drawing a blank here. Thanks
  15. no not code. lets say i'm just talking on this forum right now, and i say a cool article can be found here: www.google.com www.google.com should automatically be converted into a link, without me putting any code around it.
  16. sometimes MySQL is weird, try changing your table name from order to client_orders. It may sound strange, but I bet it works. Also it is good practice to always list the column names INSERT INTO client_orders (column1, column2) values ('$var','$var')
  17. Even though your code does contain PHP, this is an HTML problem and you will need to post this thread in the  HTML Help forum. Please try to be more clear. I still don't see or understand what your problem is.
  18. What errors are you getting? post them please.
  19. well first you will need to either post your code or attach your php file for us to see what is going on.
  20. If they are only going to be using the test right after purchasing, on the purchase page you should set a $_SESSION variable and check for it. If they purchase and use it 3 days later, I would recommend setting a cookie and checking for it. If all else fails, generate a username/password when they purchase and have them login to access your test page. Any unprotected page will eventually get hit by the googlebot.
×
×
  • 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.