Jump to content

hitman6003

Members
  • Posts

    1,807
  • Joined

  • Last visited

Everything posted by hitman6003

  1. I just retried, and discovered that this is the most decimal places it will recognize before rounding: $a['small_float'] = (float) 4.000000000000001; Prior to that it works. It may work with more decimal places on a 64 bit system.
  2. what are you asking? I don't see a question.
  3. Use either ltrim or substr... $string = "2=http://domain.com/path/to/file.ext"; echo substr($string, 2);
  4. Perhaps some examples will help? <?php $a['int'] = (int) 4; $a['float_but_int'] = (float) 4.00; $a['normal_float'] = (float) 4.1; $a['small_float'] = (float) 4.0000000000001; $a['negative_float'] = (float) -5.00004; foreach ($a as $name => $value) { echo $name . "'s value is: " . $value . "\n"; if (is_int($value)) { echo $name . " is an integer.\n"; } if (is_float($value)) { echo $name . " is a float.\n"; } if ($value - floor($value) == 0) { echo $name . " was determined to be a whole number (integer).\n"; } if ($value - floor($value) != 0) { echo $name . " was determined not to be a whole number (float).\n"; } echo str_repeat("-", 25) . "\n"; } By subtracting floor($value) from $value and seeing if there is a remainder, you can determine if it's a whole number.
  5. I'm assuming that you are either using an abstraction layer similar to the maxdb objects, or you are using maxdb (http://www.php.net/maxdb-stmt-bind-result). In the either case, try using: $stmt->bind_result($userid, $password, $usertype); $stmt->fetch(); echo $userid; echo $password; echo $usertype;
  6. I think you mean php cli? http://www.php.net/cli
  7. InnoDB employs MultiVersioning Concurrency Controls...which is a fancy way of saying that when you initiate a transaction (and all queries are transactions, you don't have to issue "START TRANSACTION / COMMIT" because autocommit is on by default) you will see the database in that state at all times until the transaction is committed. So, if your transaction is a "COUNT" query it will return the number of rows present in the table at the start of the transaction (this behavior can be changed via the SQL mode). Additionally, while MyISAM keeps track of the current number of rows at any given time (and uses that number if the situations provided by the manual above), in any other situation it has the very real potential of locking the entire table while it does a row count. Not a big deal with 100 rows in a table, but with 100 million, you're talking a long time. InnoDB will always do a row count when a COUNT query is issued. So, if you do "SELECT COUNT(*) FROM table" it will scroll through and lock/unlock each row in sequence as it counts them.
  8. There's no reason to escape content in a text file. The whole purpose for magic_quotes_gpc was to prevent database injection attacks, because php developers, in the day of php 3, apparently couldn't be trusted to be smart enough to prevent it. It has nothing to do with text files, and should most certainly be disabled if possible. In php 6 magic_quotes_gpc won't even exist (along with register_globals), so this won't even be an issue. Darkwater's response is a viable method of removing the slashes if you can not disable the directive in php.ini.
  9. http://www.php.net/function.mail Look at any one of the examples from the manual.
  10. mysql_fetch_array returns an array with both associative (i.e. string) keys and numerically indexed keys. Use mysql_fetch_assoc or mysql_fetch_row to get associative or numeric indexes.
  11. $string would be the contents of the file... $string = file_get_contents($filename);
  12. http://www.mysql.com/select#id3386501
  13. yes, but still inside the <?php.
  14. use array_keys... $keys = array_keys($data); for ($i = 0; $i < count($keys); $i++) { echo $data[$keys[$i]];; } The example just goes sequentially, but you don't have to.
  15. on (in?) the page that is generating the xml for your rss feed.
  16. So, it's something else in your code that is causing the error...your server is capable of connecting to the noaa ftp server and retrieving the file. Perhaps you are trying to get a file that doesn't exist...for example, if your variable "$row['icao']" is empty, it would generate a string like: ftp://tgftp.nws.noaa.gov/data/observations/metar/decoded/.TXT to retrieve, which doesn't exist.
  17. in your query should be SHA1('$p') ...actually, doesn't matter: http://dev.mysql.com/doc/refman/5.0/en/encryption-functions.html#function_sha1
  18. I honestly don't know...it works fine from my fedora laptop using php5.2.5 CLI...which is weird since you are getting a server error. I used the following code: <?php print_r( file('ftp://tgftp.nws.noaa.gov/data/observations/metar/decoded/BGQQ.TXT') ); ?> Try a basic example (above) and see if it works.
  19. When the rss link is clicked, the server is delivering it in the form of a download...in other words, my browser doesn't understand that your rss file is supposed to be viewed as xml (cause it is xml). The way to fix this is to send an xml header to the browser.
  20. Is it only one of the files in the directory on the ftp server, or all of them? Also, which directory? (decoded or stations?)
  21. Check the result of the query you issue to check to a duplicate email address... $query = "SELECT user_id FROM users WHERE email='$e'"; die($query); Then execute that query in your mysql interface of choice. See if you get the expected result when executing it this way.
  22. gonna have to go with using an xml header as the first problem.... header('Content-Type: text/xml');
  23. Use simplexml to read the xml doc, loop through the items and look for the attributes you want... http://www.php.net/simplexml.examples Example 5 specifically deals with attributes
  24. Ahh, then I misunderstood your question...store the "current" state and check to see if it changed, then echo out the change the first time... <?php $current_state = ""; $display_state = ""; do { if ($row_StoresDb['state'] != $current_state) { $current_state = $row_StoresDb['state']; $display_state = $current_state; } else { $display_state = " "; } ?> <tr> <td height=19 align=CENTER valign=TOP><b><font face="Times New Roman"><?php echo $display_state; ?></font></b></td> <td align=CENTER valign=TOP><font face="Times New Roman"> </font></td> <td align=CENTER><font face="Times New Roman"> </font></td> </tr> <tr> <td height=17 align=CENTER valign=TOP><font face="Times New Roman"><?php echo $row_StoresDb['retailer']; ?></font></td> <td align=CENTER valign=TOP><font face="Times New Roman"><a href="<?php echo $row_StoresDb['url']; ?>"> <?php echo $row_StoresDb['address']; ?> </a></font></td> <td align=CENTER><font face="Times New Roman" color="#000000"><?php echo $row_StoresDb['phone']; ?></font></td> </tr> <tr> <td height=17 align=CENTER valign=TOP> </td> <td align=CENTER valign=TOP> </td> <td align=CENTER> </td> </tr> <?php } while ($row_StoresDb = @mysql_fetch_assoc($StoresDb)); ?>
  25. http://www.php.net/array_merge_recursive
×
×
  • 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.