General Zone > The Lounge

Helping Roumlus to stop his prof calling him a noob tomorrow :D

(1/5) > >>

hellfire:
Yo,

Story: Romulus cannot play unreal as his deadline for a code is tomorrow and hence we are missing the deemer scares in base. Lets help him debug :D

Post your problem in here so 100 brains can work together. I do not read Hungarian and so your variable names are not making sense and also you used blue.

In short,

1. Can you run the script and inspect it to show the HTML output. If the output is showing the colour we will know something atleast. I quickly checked escape character issues but the best way is to run it in local host to debug. To help others, can you please show the output html after code is run.

Thanks ;)

hellfire:
Very quickly since I am at work:

1. Run your script here : https://sandbox.onlinephpfunctions.com/

2. Run output here : https://codebeautify.org/htmlviewer

In link 2, basic HTML errors are highlighted. This way you can quickly check if the error is format error vs logic error in the php. Let me know ;)

Romulus:
Thank you @Hellfire

" kihúzott szám " =
" kihúzott szám " =
" kihúzott szám " =
" kihúzott szám " =
" kihúzott szám " =

English:
"drawn number"=
"drawn number"=
"drawn number"=
"drawn number"=
"drawn number"=

as you can see in the picture ... the number 4 is included in the solution ... and I would like the number 4 in the table to change to red when it is among the randomly generated numbers ... and so is 1, 2, 3,4,5 numbers .... their base color is green ... and if it's listed above for random generated numbers then switch from green to red ... I need specific help...everything help I appreciate .... I don't ask for help often because I want to improve myself, but I really need a specialist now...  :(

https://ibb.co/1K8LR3p



this is my code:

--- Code: ---<html>
<head>
<title>Lottó</title>
</head>
<body>

<center>
<form name="lotto" action="index.php" method="POST">
<h1><u>Lottó</u> &nbsp;
<input type="submit" name="ujra" value="Újra" />
</h1>
</form>
 
<?php
$tipp=array(0,1,2,3,4,5);
function kepre($tomb){
$tipp=array(0,1,2,3,4,5);
            print "<table border=\"2\" bordercolor=\"black\" cellpadding=\"5\" cellspacing=\"0\" >\n";
            for ($i=1; $i<91; $i++)
            {
                print "<font size=\"6\">";
                if($tipp[1]==$i || $tipp[2]==$i  || $tipp[3]==$i || $tipp[4]==$i || $tipp[5]==$i)
                    print "<td bgcolor=\"#47FF00\">";
                else
                    print "<td bgcolor=\"#eeeeee\">";
                print $i;
                print "</font>";
                if($i%15==0)
                {
                    print "<tr>\n";
                }
            }      
            print "</table>\n";
            return true;
}
$tomb = array();
//tömbfeltöltés
for ($i=1; $i<=90; $i++){
            $tomb[$i] = 0;
}
//lottóhúzás
for ($i=1; $i<=5; $i++){
            do{
                  $v = rand(1,90);
            }while ( $tomb[$v] == 1 );
            $tomb[$v] = 1;
            $t[$i]=$v;
}

print "A nyerőszámok a következőek: <br />";
for ($i=1; $i<6; $i++)
{
 echo $i.". kihúzott szám: ".$t[$i]."<br />";
}

print "Az általam tippelt nyerőszámok a következőek: <br />";
for ($i=1; $i<6; $i++)
{
 echo $i.". tippelt szám: ".$tipp[$i]."<br />";
}

kepre($tomb);
?>
</center>
</body>
</html>
--- End code ---

Romulus:

--- Quote from: hellfire on April 21, 2022, 16:15 ---Very quickly since I am at work:

1. Run your script here : https://sandbox.onlinephpfunctions.com/

2. Run output here : https://codebeautify.org/htmlviewer

In link 2, basic HTML errors are highlighted. This way you can quickly check if the error is format error vs logic error in the php. Let me know ;)

--- End quote ---

actually yes, the deadline expires today, but i did my job ... my teacher is very pleased with my diligence ...
i couldn't incorporate this one function alone ...

there are still new things for me ... I only started learning computer science about half a year ago ...
i am just very curious to solve this task .... i would be very interested ... i searched the net for several days but unfortunately i didn't find anything useful ... i tried many code variations but unfortunately it failed.

hellfire:
Can you use a css class and check if the code works with that. Eg: If number ==4,  print "<td bgcolor=\"#47FF00\">" is not good coding as bgcolour will probably be depreciated soon? Instead, why not assign a class and define the class separately in a css file. In short, try doing this using css and let me know results.

Eg: echo '<td class="HellFireRocks">something</p>';

.HellFireRocks {
    color: red;
}

you get the idea?

Navigation

[0] Message Index

[#] Next page

Go to full version