notsoevilgenius
MIS
Hello,
I have a simple connect, query and display db rows that needs to be upgraded. Everything was working last week when I was last using my website now I'm getting errors because mySQL is finally dead.
I now have
some html...
Now on that first row line where I try to echo the date and time I'm getting a syntax error, unexpected quoted-string and whitespace (T-ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING). I'm not convinced my error is in that actual line of code. I think the code I actually changed in the query or while loop is the issue, but I'm not certain.
Also if anyone notices anything else I should change I'd appreciate the help.
Thanks.
I have a simple connect, query and display db rows that needs to be upgraded. Everything was working last week when I was last using my website now I'm getting errors because mySQL is finally dead.
I now have
Code:
<?php
$db = new mysqli("$host","$username","$password","$database") or die("couldn't connect to the database!");
if($db->connect_errno > 0){
die('Unable to connect to database [' . $db->connect_error . ']');
}
$sql = <<<SQL
SELECT *
FROM 'workshops'
WHERE 'wDate' >= CURDATE() AND type = 'edu' ORDER BY 'wDate', 'wTime'
SQL;
if(!$result = $db->query($sql)){
die('There was an error running the query [' . $db->error . ']');
}
?>
some html...
Code:
<?php
while($row = $result->fetch_assoc())
{
?>
<dl>
<dt><?php echo date('m/d/Y', strtotime($row['wDate']))?> - <?php echo date('g:i A', strtotime($row['wTime']))?></dt>
<dd><?php echo $row['Location']?></dd>
<div itemscope itemtype='schema.org/PostalAddress'>
<dd><span itemprop='streetAddress'><?php echo $row['Address']?></span></dd>
<dd><span itemprop='addressLocality'><?php echo $row['City']?></span>, <span itemprop='addressRegion'><?php echo $row['State']?></span> <span
itemprop='postalCode'><?php echo $row['Zip']?></span></dd>
</div>
<dd><?php echo $row['Presenter']?></dd>
</dl>
<?php
}
mysql_close($db);
?>
Now on that first row line where I try to echo the date and time I'm getting a syntax error, unexpected quoted-string and whitespace (T-ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING). I'm not convinced my error is in that actual line of code. I think the code I actually changed in the query or while loop is the issue, but I'm not certain.
Also if anyone notices anything else I should change I'd appreciate the help.
Thanks.