Jump to content

Ryan_w

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Ryan_w's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. revraz, That did the trick...thanks for the help guys.
  2. I still get multiple errors about date wanting a long int....because it is interpreting it as a string I am only a couple months into using PHP....I would love to use an object....but I really don't want to spend 5 hours learning a whole new concept right now to fix this :/ There has to be a simple way to either tell it to pull this as an integer like it is stored in the database or to convert it properly I would think.
  3. Nope....it still converts it to an alpha/numeric string with single quotes
  4. $row["timestamp"] contains a unix timestamp inserted by another application....but php pulls it as a string into the array instead of an integer....and date() won't have it. Warning: date() expects parameter 2 to be long, string given in /root/php/test.php on line 19 If I echo the entire array it shows the timestamp file....but when I echo($row["timestamp"]; it converts the string into a set of alpha numeric chars and that is what the date function sees.
  5. Hey Guys, Need a bit of help with a problem pulling data from a mysql database. I have timestamps stored in an integer field in mysql. I am pulling those rows out in a foreach statement, and I need to run the date function to output that timestamp in a human readable format in a table. When I pull that field with the rest of the row it is entered into the array as a string. I have tried the normal ways (intvar, (int)) to convert this to an integer to be used in the date command and none seem to do so properly. How can I go about converting that string into a proper integer without changing the timestamp? Basic jist of what I am trying to do: $sql = ("SELECT * FROM database WHERE field = '" . $variable . "';"); $result = mysql_query($sql); foreach (mysql_fetch_assoc($result) as $row) { echo(date('format string', $row["timestamp"])); }
  6. Nevermind, I finally figured it out....chr(10) is my friend Thx for the help guys.
  7. Cool....thanks for the advice on incrementing the counter. I have only one more problem.....the data is now being outputted properly with the exception that it is coming out all on one line in the file rather than one set of values per line. eg: rather than this: 123456 jf0mklf9 12 123456 jkfldjioenklf 12 123456 j40fGF4jnf99 12 I get this: 123456 jf0mklf9 12123456 jkfldjioenklf 12123456 j40fGF4jnf99 12 Any Suggestions? Thanks in advance, Ryan
  8. Hey, New to the whole PHP ting, so I am muddling through. Trying to write the output of 3 array values to a file with fwrite(). Right now I am getting a never ending loop outputting "264" all on the same line. $fp = fopen('text.file', 'a'); $count = 1; while ($count < $finish) { fwrite($fp, "$idarray[$count] $pwarray[$count] $rankarray[$count]"); } fclose($fp); the values coming out of the arrays are: idarray - 6 character integer pwarray - 6 to 20 character alpha numeric rankarray - 2 character integer I am attempting to get a text file like: 123456 jf0mklf9 12 123456 jkfldjioenklf 12 123456 j40fGF4jnf99 12 etc.... Any help would be greatly appreciated. Ryan
×
×
  • 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.