Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PHP $ syntax problem

Featured Replies

I have a little bit of code that i need to take the date from my database and ad 1 year to it. So far I have found this code

 

<?php

$date = "binding goes in here????";

$newdate = strtotime ( '+1 year' , strtotime ( $date ) ) ;

$newdate = date ( 'Y-m-d' , $newdate );

echo $newdate;

?>

 

but when I try inserting the database binding into the "" in the first line it all goes wrong.

 

The binding in its simplest format looks like this <?php echo $row_renew_list['date']; ?>

 

So what is the syntax for inserting this into the ""

Do you need to format the time as a string - $strDate= date ( string $format [, int $timestamp ] ) where 'timestamp' comes from the database?

 

See date() in PHP manual.

easyer to just select with the additional year;

 

mysql_query("SELECT DATE_SUB(`date_field`, INTERVAL -1  YEAR) as `new_date_field` FROM `date_table`");

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.