Title: strotime not working on different table
Tags: php
Question: I have this code part of a table;
echo '<td&gt;' .
$row['datum_overboeking'] = date("m-d-Y", strtotime($row["datum_overboeking"])) .
'</td&gt;';
I want to add the same piece of strtotime code to this piece of code part of another table on another page;
td&gt;' . mysql_result($result, $i, 'datum_overboeking') . '</td&gt;';
So that would be;
echo '<td&gt;' .
mysql_result($result, $i, 'datum_overboeking') = date("m-d-Y", strtotime($row["datum_overboeking"])) .
'</td&gt;';
But it doesnt work, it gives the error:
Fatal error: Can't use function return value in write context in /home/davel/www/folder1/pagina_1/view-paginated.php on line 97
Comment: You're trying to set a database resultset `mysql_result($result, $i, 'datum_overboeking'` to a date string?

Comment: Well I want the result from the database been shown in the m-d-Y format. I tought this piece of code should have done the trick but it doesnt.


Here is another answer: Mark Baker is correct, you are trying to set a value to a MySQL result - which will error. If you wish to display the results of 'datum_overboeking' please try the following:
Echo '<td&gt;'.date('m-d-Y', strtotime(mysql_result($result, $i, 'datum_overboeking')))
I am assuming that $row['datum_overboeking'] and mysql_result($result, $i, 'datum_overboeking') return the same kinda string and format.
Comment for this answer: Thanks and indeed that does work. I tought that the mysql_result was already a raw DATE value by default because its a DATE value from the MySQL database.

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 2, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2014:00:03/10/14', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<php>', 'Title': 'strotime not working on different table', 'ViewCount': 39, 'id': 22296887, 'user_AboutMe': '', 'user_AccountId': 4135434.0, 'user_DisplayName': 'user31465278', 'user_Reputation': 41.0, 'user_Views': 12.0, 'user_id': 3392278.0}}