I keep getting this error when trying to load this page:

Parse error: syntax error, unexpected '=' in /home/xxxxxx/public_html/rma/view.php on line 28

I've been trying to check it, but it looks fine to me...

<?php
$username="xxxxxxxx";
$password="xxxxxxxx";
$database="xxxxxxxx";
$con=mysql_connect(localhost,$username,$password);

if (!$con)  {  die('Could not connect: ' . mysql_error());
  }
mysql_select_db($database, $con);
$query = 'SELECT *, (NOW() - date_last_called) > call_frequency) AS call_today FROM call_tracker ORDER BY call_today DESC, date_last_called ASC;'$result=mysql_query($query);

$i = 0;

echo "<table border='1'>\n
<tr>\n
<th>Store</th>\n
<th>Work Order</th>\n
<th>Customer Name</th>\n
<th>Contact Number</th>\n
<th>Date Last Called</th>\n
<th>Call Frequency</th>\n
<th>Call Today</th>\n
<th>Notes</th>\n
</tr>\n";

while($row = mysql_fetch_array($result))  
{  
$style = ((++$i % 2) = 0) ? 'style="background-color:#BFC8FF"' : 'style="background-color:#AAB2E2"';
$style= ($row['call_today'] == 1) ? 'style="background-color:#007F0E;color:#FFFFFF;"' : $style;  
$call = ($row['call_today'] == 1) ? 'Yes' : 'No';

echo "<tr $style>\n"		
. "<td>" . $row['location'] . "</td>\n"		
. "<td>" . $row['work_order'] . "</td>\n"		
. "<td>" . $row['customer_name'] . "</td>\n"		
. "<td>" . $row['contact_number'] . "</td>\n"		
. "<td>" . $row['date_last_called'] . "</td>\n"		
. "<td>" . $row['call_frequency'] . "</td>\n"		
. "<td>" . $call . "</td>\n"		
. "<td>" . $row['notes'] . "</td>\n"
. "</tr>\n";
}
echo "</table>\n";
?>
<html><head><title>Customer Call Tracker </title>
</head>
<body>
<br>
<form>
<input type="button" onclick="window.location.href='form.php'" value="Add Record"></input>
</form>

<form action="del.php" method="post">
<input type="text" name="work_order" /><input type="submit" value="Picked Up" />
</form>

<form action="modify.php" method="get">
<input type="text" name="work_order" /><input type="submit" value="Modify" />
</form>

<form action="call.php" method="get">
<input type="text" name="work_order" /><input type="submit" value="Call" />
</form>
</body>
</html>

Any help would be appreciated.

Recommended Answers

All 2 Replies

use == for comparision at line no 28
(++$i % 2) == 0

Member Avatar for rajarajan2017
$style = ((++$i % 2) = 0) ? 'style="background-color:#BFC8FF"' : 'style="background-color:#AAB2E2"';

Here you using the conditional operator var=cond?res1:res2; so the first statement should be a condition and not an assignment. follow the above reply to change that to conditional one.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.