Jump to content

[SOLVED] help?


dadamssg

Recommended Posts

Parse error: parse error in C:\wamp\www\PHPtutorials\showtoday.php on line 18

 

heres the whole code...im just trying to display all the info in tables

 

<?php
/* program: showevents.php*/

?>

<html>
<body>
<?php
   session_start();
   include("caneck.inc");
   
   $cxn = mysqli_connect($host,$user,$passwd,$dbname)
          or die ("Couldn't connect")
    

/*select todays events*/

$query = "SELECT * FROM test WHERE DATE(start) <= CURDATE() AND DATE(end) >= CURDATE() ORDER BY start DESC";

$result = mysqli_query($cxn,$query)
          or die ("Couldn't execute");
		  
while($row = mysqli_fetch_assoc($result))
   {    
    /*Format dates to display*/

     $startt = DATE_FORMAT($row['start'], '%b %e %Y %l %i %p');
 $endt = DATE_FORMAT($row['end'], '%b %e %Y %l %i %p');

echo " <table border='3'>";
echo " <tr> 
echo "<td>{$row['eventid']}</td>";
echo "<td>{$row['created']}</td>";
echo "<td>{$row['title']}</td>";
echo "<td>{$row['event']}</td>";
echo "<td>{$row['description']}</td>";
echo "<td>{$row['location']}</td>";
echo "<td>\$$startt</td>";
echo "<td>\$$endt</td>";
echo "</tr></table>";
   }
?>
</body></html>


Link to comment
Share on other sites

That's a php parse error. A lot of php parse errors are due to a problem in the code prior to where the error is reported. The actual error cannot be detected because the parser does not know what you intended and it is only when it encounters something that is out of place in the current context that it generates the error message.

 

You are missing a semi-colon ; on the line of code immediately prior to where the error is being reported.

Link to comment
Share on other sites

yeah i fixed that..nothin. I don't get it all... i am copying and pasting inside the quotes of the $query and putting them inside PhpMyAdmin and it works. this is driving me crazy

 

<?php
/* program: showevents.php*/

?>

<html>
<body>
<?php
   session_start();
   include("caneck.inc");
   
   $cxn = mysqli_connect($host,$user,$passwd,$dbname)
          or die ("Couldn't connect");
    
/*select todays events*/

$query = "SELECT * FROM test WHERE DATE(start) <= CURDATE() AND DATE(end) >= CURDATE() ORDER BY start DESC";

$result = mysqli_query($cxn,$query)
          or die ("Couldn't execute");
		  
while($row = mysqli_fetch_assoc($result))
   {    
    /*Format dates to display*/

     $startt = DATE_FORMAT($row['start'], '%b %e %Y %l %i %p');
 $endt = DATE_FORMAT($row['end'], '%b %e %Y %l %i %p');

echo " <table border='3'>";
echo " <tr>"; 
echo "<td>{$row['eventid']}</td>";
echo "<td>{$row['created']}</td>";
echo "<td>{$row['title']}</td>";
echo "<td>{$row['event']}</td>";
echo "<td>{$row['description']}</td>";
echo "<td>{$row['location']}</td>";
echo "<td>\$$startt</td>";
echo "<td>\$$endt</td>";
echo "</tr></table>";
   }
?>
</body></html>





Link to comment
Share on other sites

ok so i guess php didn't like the names of my variables so i changed them and it almost worked, now im getting a datetime error when i try to format the dates...the dates are in datetime in the database i dunno why im getting this error now...ive never formatted dates that come from datetime though

 

the error:

Warning: date_format() expects parameter 1 to be DateTime, string given in showtoday.php on line 25

 

Warning: date_format() expects parameter 1 to be DateTime, string given in showtoday.php on line 26

 

im also getting a session error..i dunno why thats comin up either:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at showtoday.php:8) in showtoday.php on line 9

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.