Jump to content

Need help on Returning a Custom Message when Mouse Over


quantumdecipher

Recommended Posts

Basically I have a page which returns data from a SQL database. Column results have a mouseover javascript which pops up a message when hovered. I highlighted the code which gives me problem. What i want to do here is that when a the sql query for the field errorMessage has no value, it returns a popup (which functions properly so far), but returns the content of the field errorMessage if it has value in the database.

 

Here's my code :

 

  <?php

$conn = mysql_connect("localhost", "root", "123456") or die(mysql_error());

mysql_select_db("test") or die(mysql_error());

$sql = mysql_query("SELECT * FROM buccaneer ORDER BY portNumber ASC")

or die(mysql_error());

 

if(mysql_num_rows($sql) == 0) {

  echo "<center><b>No ORDER/S in Queue</b></center>";

} else {

 

while($result = mysql_fetch_array($sql)) {

                echo"<tr><td class='tableContent'>".$result['portNumber']."</td>";

                  echo"<td class='tableContentDate'>".$result['dueDate']."</td>";

                  echo"<td class='tableContent'><span onmouseover=\"tooltip.show('Click to search ".$result['workObject']." at Shop Floor');\" onmouseout=\"tooltip.hide();\"><a href='http://*******?object=".$result['workObject']."&search=Overview'>".$result['workObject']."</a></span></td>";

                  echo"<td class='tableContent'><span onmouseover=\"tooltip.show('Click to search ".$result['salesOrder']." at Shop Floor');\" onmouseout=\"tooltip.hide();\"><a href='http://*******?object=".$result['salesOrder']."&search=Overview'>".$result['salesOrder']."</a></span></td>";

                  echo"<td class='tableContent'>".$result['systemStatus']."</td>";

                 

if ($result['errorMessage'] = "") {

echo"<td class='tableContent'><span onmouseover=\"tooltip.show('Click to add Error Message to ".$result['workObject']."');\" onmouseout=\"tooltip.hide();\"><a href='addRemarks.php'>".$result['systemRemarks']."</a></span></td>";

}

else {

echo"<td class='tableContent'><span onmouseover=\"tooltip.show('".$result['errorMessage']."');\" onmouseout=\"tooltip.hide();\">".$result['systemRemarks']."</a></span></td>";

}

                 

echo"<td class='tableContent'>".$result['orderType']."</td>";

echo"<td class='tableContent' id='customerName' name='customerName'>".$result['customerName']."</td>";

                echo"</tr>";

}}

?>

 

Please help as this is my project. I'm still a newbie in PHP and I have been coding for a few months only. Thanks!

Archived

This topic is now archived and is closed to further replies.

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