Jump to content

Create rollover buttons from database


Cgull

Recommended Posts

Hello,

 

I've just finished an online php course and now fighting with a site I'm trying to create (of course  :))

 

I am trying to create a table with rollover buttons.

 

The buttons details are sitting in a table, but everything I try doesn't work.

 

Here are some things I tried: Please, can someone help me before I lose all my hair ?  ;)

 

1.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Ruth Rudin Designs</title>

<link href="ruthStyle.css" rel="stylesheet" type="text/css" />

<script type="text/JavaScript">

<!--

function MM_swapImgRestore() { //v3.0

var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;

}

 

function MM_preloadImages() { //v3.0

var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}

}

 

function MM_findObj(n, d) { //v4.01

var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];

for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);

if(!x && d.getElementById) x=d.getElementById(n); return x;

}

 

function MM_swapImage() { //v3.0

var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

//-->

</script>

</head>

<?php

require("/wamp/ruth.php");

$query = "select btnId, btnGrey from graphicbtns";

$result = mysql_query($query);

 

while ($row = mysql_fetch_array($result, MYSQL_ASSOC))

{

$index = $row['btnId'];

if($index == 1)

$body[$index]['Grey'] .= '<body onLoad=\"MM_preloadImages(' . $row['btnGrey'];

else

$body[$index]['Grey'] = $row['btnGrey'];

}

 

$count = 1;

 

while (count($body) >= $count)

{

if($count < count($body))

echo $body[$count]['Grey'] . ',';

else

echo $body[$count]['Grey'] . ')>';

 

$count = $count++;

}

?>

<table width="198" border="0" cellpadding="0" cellspacing="0">;

</body>

</html>

 

Gives me an error:

 

Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\rRuth\content\test.php on line 53

 

2.

<?php

require("/wamp/ruth.php");

$query = "select btnId, btnGrey from graphicbtns";

$result = mysql_query($query);

 

while ($row = mysql_fetch_array($result, MYSQL_ASSOC))

{

$index = $row['btnId'];

$body[$index]['Grey'] = $row['btnGrey'];

}

 

$count = 1;

 

while (count($body) >= $count)

{

if($count == 1) {

echo '<body onLoad=\"MM_preloadImages(' . $body[$count]['Grey'] . ',';

 

}elseif($count >1 && $count < count($body)) {

echo $body[$count]['Grey'] . ',';

 

}else {

echo $body[$count]['Grey'] . ')>';

}

 

$count = $count++;

}

?>

 

Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\rRuth\content\test.php on line 52

 

3.

<?php

require("/wamp/ruth.php");

$query = "select btnId, btnGrey from graphicbtns";

$result = mysql_query($query);

 

while ($row = mysql_fetch_array($result, MYSQL_ASSOC))

{

$index = $row['btnId'];

$body[$index]['Grey'] = $row['btnGrey'];

}

 

$count = 1;

 

echo "<body onLoad=\"MM_preloadImages(";

 

while (count($body) >= $count)

{

if($count < count($body))

echo $body[$count]['Grey'] . ',';

else

echo $body[$count]['Grey'] . ')>';

 

$count = $count++;

}

?>

 

Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\rRuth\content\test.php on line 52

 

Link to comment
https://forums.phpfreaks.com/topic/77706-create-rollover-buttons-from-database/
Share on other sites

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.