savagenoob Posted January 19, 2009 Share Posted January 19, 2009 I cant get the refresh link to include the varibles "day month year" for some reason. When I echo the varibles before the link they dont show either. the $date varible processes fine though so I'm lost.... <?php $employee = $_SESSION['SESS_MEMBER_ID']; $space = " "; $date =$month . $space . $day . $comma . $year; $nextdate = strtotime($date); $finaldate = date("Y-m-d", $nextdate); $event = $_POST['event']; $time = $_POST['time']; $user = $_SESSION['SESS_LOGIN']; $datestamp = $date . $time; $query = "INSERT INTO cal_events SET username = '$user', user_id = '$employee', date = '$finaldate', time ='$time', description = '$event'"; $result = mysql_query($query); echo $query; echo mysql_error(); echo $month; echo "<meta http-equiv=refresh content=\"0; URL=day.php?day=$day&month=$month&year=$year\">"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/141473-link-with-variables-problem/ Share on other sites More sharing options...
rhodesa Posted January 19, 2009 Share Posted January 19, 2009 where are $month, $day, and $year defined? Quote Link to comment https://forums.phpfreaks.com/topic/141473-link-with-variables-problem/#findComment-740542 Share on other sites More sharing options...
Maq Posted January 19, 2009 Share Posted January 19, 2009 Try this: $query = "INSERT INTO cal_events SET username = '{$user}', user_id = '{$employee}', date = '{$finaldate}', time ='{$time}', description = '{$event}'"; Variables don't get evaluated in single quotes. You need to either encapsulate them in french braces or concatenate to the string. Quote Link to comment https://forums.phpfreaks.com/topic/141473-link-with-variables-problem/#findComment-740544 Share on other sites More sharing options...
rhodesa Posted January 19, 2009 Share Posted January 19, 2009 Try this: $query = "INSERT INTO cal_events SET username = '{$user}', user_id = '{$employee}', date = '{$finaldate}', time ='{$time}', description = '{$event}'"; Variables don't get evaluated in single quotes. You need to either encapsulate them in french braces or concatenate to the string. i think the OP is referring to the meta refresh at the bottom Quote Link to comment https://forums.phpfreaks.com/topic/141473-link-with-variables-problem/#findComment-740545 Share on other sites More sharing options...
DarkWater Posted January 19, 2009 Share Posted January 19, 2009 @Maq: The string is in double quotes. It doesn't matter that the variables happen to have ' ' around them in the double-quoted string; they'll still interpolate. Quote Link to comment https://forums.phpfreaks.com/topic/141473-link-with-variables-problem/#findComment-740547 Share on other sites More sharing options...
savagenoob Posted January 19, 2009 Author Share Posted January 19, 2009 Yeah, the query works fine... just this pesky link wont display variables like they are supposed to... Here is more code... <?php $day = $_GET['day']; $month = $_GET['month']; $year = $_GET['year']; $employee = $_SESSION['SESS_MEMBER_ID']; if (isset($_POST['submit'])) { $space = " "; $date =$month . $space . $day . $comma . $year; $nextdate = strtotime($date); $finaldate = date("Y-m-d", $nextdate); $event = $_POST['event']; $time = $_POST['time']; $user = $_SESSION['SESS_LOGIN']; $datestamp = $date . $time; $query = "INSERT INTO cal_events SET username = '$user', user_id = '$employee', date = '$finaldate', time ='$time', description = '$event'"; $result = mysql_query($query); echo $query; echo mysql_error(); echo $month; echo "<meta http-equiv=refresh content=\"0; URL=day.php?day=$day&month=$month&year=$year\">"; } else { $comma1 = ", "; $space1 = " "; $date1 =$month . $space1 . $day . $comma1 . $year; $nextdate1 = strtotime($date1); $finaldate1 = date("Y-m-d", $nextdate1); $query1= "SELECT time, description FROM cal_events WHERE date = '$finaldate1' AND user_id = '$employee'"; $result1=mysql_query($query1); ?> Quote Link to comment https://forums.phpfreaks.com/topic/141473-link-with-variables-problem/#findComment-740549 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.