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