eburlea 23 Junior Poster
@charset "utf-8";
/* CSS Document */

html, body {margin:0; height:100%;}
p {font-family:Verdana; font-size:12px; color:#000088; margin:5px;}
li {font-family:Verdana; font-size:12px; color:#000088; margin-left:25px;}

#main_table{width:1048px; height:100%; border-collapse:collapse;}
#center{width:718px; vertical-align:top; border-bottom:1px solid #0000CC;}
#left {border-left:1px solid #0000CC; border-bottom:1px solid #0000CC;}
#right {border-right:1px solid #0000CC; border-bottom:1px solid #0000CC;}

#menubar_a{padding:3px; padding-left:7px; margin:0; white-space:nowrap; list-style-type:none; height:25px; border-left:1px solid #0000CC;}
#menubar_a a{font:bold 12px Verdana; color:#FFFFFF; padding:3px; text-decoration:none;}
#menubar_b{padding:3px; margin:0; white-space:nowrap; list-style-type:none; height:25px; border-right:1px solid #0000CC;}
#menubar_b span{font:bold 12px Verdana; color:#FFFFFF; float:right; margin-right:3px;}

#menu{margin-top:10px; margin-left:5px; margin-right:5px;}
#menu a{font:bold 12px Verdana; color:#000088; text-decoration:none;}
#menu a:hover{color:#AA00AA; text-decoration:underline;}

#select_form {margin-left:5px; margin-top:10px; margin-bottom:10px;}
#select_form select {font:12px Verdana; color:#000088; margin-right:5px;}
#submit1 {font:12px Verdana; color:#000088;}

#menubar2 {width:718px; border-collapse:collapse;}

#cell1 {width:78px; height:20px; text-align:center;}
#cell2 {width:2px; height:20px; text-align:center;}
#cell3 {width:78px; height:2px; text-align:center;}
#cell4 {width:2px; height:2px; text-align:center;}
#cell5 {vertical-align:top; text-align:center; height:1000px;}
#cell5 p {font:bold 14px Verdana; color:#000088;}
#cell6 {background-color:#9FEEEE; border:1px solid #008ED1; font:12px Verdana; color:#000088; text-align:center; padding:2px;}
#cell7 {background-color:#CCFFFF;}

.blue_mb_dark {background-color:#0000CC;}
.blue_mb_dark a {font:bold 12px Verdana; color:#FFFFFF; text-decoration:none;}
.blue_mb_light {background-color:#0033FF;}
.blue_mb_light a {font:bold 12px Verdana; color:#FFFFFF; text-decoration:none;}
a.small {font:11px Verdana; color:#FFFFFF; text-decoration:none;}
.blue_header {background-color:#008ED1; font:bold 12px Verdana; color:#FFFFFF; text-decoration:none; padding:2px;}
.blue_odd {background-color:#CCFFFF; font:12px Verdana; color:#000088; text-decoration:none; padding:2px;}
.blue_odd table {margin-left:auto; margin-right:auto;}
.blue_even {background-color:#9FEEEE; font:12px Verdana; color:#000088; text-decoration:none; padding:2px;}
.maroon_header {background-color:#500000; font:bold 12px Verdana; color:#FFFFFF; text-decoration:none; padding:2px;}
.maroon_odd {background-color:#E9B67A; font:12px Verdana; color:#300000; text-decoration:none; padding:2px;}
.maroon_even {background-color:#E9967A; font:12px Verdana; color:#300000; text-decoration:none; padding:2px;}
.green_header {background-color:#006000; font:bold 12px Verdana; color:#FFFFFF; text-decoration:none; padding:2px;}
.green_odd {background-color:#96FF66; font:12px Verdana; color:#003000; text-decoration:none; padding:2px;}
.green_even {background-color:#56FF66; font:12px Verdana; color:#003000; text-decoration:none; padding:2px;}
.white {background-color:#FFFFFF;}

.myicon {border:0; border-style:none;}
.h2h {width:180px;}

#xs {width:40px;}
#xs0 {text-align:left; padding-left:5px;}
#s {width:60px;}
#m {width:90px;} …
eburlea 23 Junior Poster
<?php
include ("blocks/db.php");
$result0 = mysql_query ("SELECT * FROM settings WHERE page='index'",$db);
$myrow0 = mysql_fetch_array ($result0);
if (isset($_GET['season'])) {$season = $_GET['season'];}
if (isset($_GET['s_type'])) {$s_type = $_GET['s_type'];}
if (isset($_GET['page'])) {$page = $_GET['page'];}
?>
<!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=utf-8" />
<meta name="description" content="<?php echo $myrow0['meta_d']; ?>" />
<meta name="keywords" content="<?php echo $myrow0['meta_k']; ?>" />
<title><?php echo $myrow0['title']; ?></title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<table id="main_table" align="center" border="0px" cellpadding="0px" cellspacing="0px">
  <?php include ("blocks/header.php"); ?>
  <tr>
    <?php include ("blocks/left.php"); ?>
    <td id="center" class="white">
<?php
echo $myrow0['text_up'];
echo '<form name="form1" id="select_form" method="get" action="index.php">';
/* Creating a drop-down list to select the season */
echo '<label><select name="season">';
$result1 = mysql_query ("SELECT DISTINCT season FROM competitions WHERE status='Active' ORDER BY season DESC",$db);
while ($myrow1 = mysql_fetch_array($result1))
  {
  if (strlen($myrow1['season']) == 4)
    {
    $season_short = intval($myrow1['season'])+1;
    $season_long = $myrow1['season'].'-'.$season_short;
    $result2 = mysql_query ("SELECT DISTINCT season FROM competitions WHERE status='Active' && season='$season_long'",$db);
    if (mysql_num_rows($result2) == FALSE)
      {
      if (isset($season) && $season==$season_long)
        {
        echo '<option selected value="'.$season_long.'">'.$season_long.'</option>';
        }
      else
        {
        echo '<option value="'.$season_long.'">'.$season_long.'</option>';
        }
      }
    }
  else
    {
    if (isset($season) && $season==$myrow1['season'])
      {
      echo '<option selected value="'.$myrow1['season'].'">'.$myrow1['season'].'</option>';
      }
    else
      {
      echo '<option value="'.$myrow1['season'].'">'.$myrow1['season'].'</option>';
      }
    }
  }
echo '</select> </label>';
/* Creating a drop-down list to select the type of statistics */
echo '<label><select name="s_type">';
if (isset($s_type) && $s_type=='Home Win') {echo '<option selected value="Home Win">Home Win</option>';} else {echo '<option value="Home Win">Home Win</option>';}
if (isset($s_type) && $s_type=='Draw') {echo '<option selected value="Draw">Draw</option>';} else {echo '<option value="Draw">Draw</option>';}
if …
eburlea 23 Junior Poster
<script>
var myTable = document.getElementById("leagues_stands");
var rows = myTable.getElementsByTagName("tr");
for (var i = 0; i < rows.length; i++) {
    rows[i].onmouseover = function() {
        this.style.backgroundColor = "#FF0000";
    };
    rows[i].onmouseout = function() {
        this.style.backgroundColor = "#FFFFFF";
    };
}
</script>
eburlea 23 Junior Poster

Hi. I have a javascript code inserted before closing tag </body> that is meant to change the color of a table row when the mouse is placed over it. It works only when I remove the css file. Please advise what is the problem, I need them working together. The Javascript code is as follows:

eburlea 23 Junior Poster

Yes, you are perfectly right. getElementsByTagName returns an array. I didn't think about that. Thanks a lot. It is working.

eburlea 23 Junior Poster

I've tried this and it doesn't work:

document.getElementsByTagName('tr').onmouseover = function(){
  document.getElementsByTagName('tr').style.backgroundColor = "#FF0000";
};
document.getElementsByTagName('tr').onmouseout = function(){
  document.getElementsByTagName('tr').style.backgroundColor = "#FFFFFF";
};
eburlea 23 Junior Poster

The statement
document.getElementById('myTable').style.backgroundColor = color;
colores the whole table.
What else should be included in the code, so that only one row to be colored?

eburlea 23 Junior Poster

I have changed
myTable.setAttribute("bgcolor","#FF0000");
with
document.getElementById('myTable').style.backgroundColor = color;
and it works for the whole table.
Are there any other solutions?

eburlea 23 Junior Poster

Hello. Please advise what is wrong in the following code that align and border attributes change when mouse is over the table, except the background color.

<table id="myTable" width="200px" cellpadding="0px" cellspacing="0px">
  <tr>
    <td>One</td>
    <td>Two</td>
    <td>Three</td>
  </tr>
  <tr>
    <td>1</td>
    <td>2</td>
    <td>3</td>
  </tr>
</table>
<script>
myTable.onmouseover = function(){
  myTable.setAttribute("align","center");
  myTable.setAttribute("border","1px solid");
  myTable.setAttribute("bgcolor","#FF0000");
};
</script>
eburlea 23 Junior Poster

@LastMitch

Thank you for advice. I started to learn Ajax from 'Ajax for Dummies' by Steve Holzner and this is exactly what I was looking for.

eburlea 23 Junior Poster

Hello,

Is it possible to use a PHP code to create a drop-down list that automatically inserts a word from MySQL table after writing a character? For example when I type "a", all the entries beginning with "a" show in order, then I type "n", then all entries begins with "an" show in order, and so on.

eburlea 23 Junior Poster

I have turned off Windows Firewall and it is working now. Thank you all for help!

AndreRet commented: Well done on solving it. Some kudos for you +12
eburlea 23 Junior Poster

@uniquestar
I have tried, but it didn't work.

eburlea 23 Junior Poster

Good day,

I've created a webpage on localhost using php. I have a local network with 3 computers at home. I can access the webpage only from one computer (http://localhost/mywebpage/). What changes should I make in phpmyadmin to be able to access the webpage from all computers? Is it possible?

Thank you in advance.

eburlea 23 Junior Poster

I have just found the answer. The following code is working:

<script>window.location.href = 'view_topic.php?id=<?php print($id)?>'</script>

eburlea 23 Junior Poster

Hi all.
Please help. How is it possible to transfer a variable from PHP to JavaScript.
I have the following code.

<?php
$id = 5;
?>
<script>window.location.href = 'view_topic.php?id=VAR'</script>

Instead of VAR should come the value of $id from PHP.

Thanks in advance.

eburlea 23 Junior Poster

Thank you for the link. The following code is working:

<?php
$str1 = "   This is a sentence.  ";
$str2 = ltrim(rtrim($str1," ")," ");
?>
eburlea 23 Junior Poster

Hello,

Please advise how to remove white spaces before and after a sentence only. Example: " This is a sentence. " should be "This is a sentence."

Thanks.

eburlea 23 Junior Poster

I have created a site on localhost using php and mysql for soccer statistics. And now I am learning javascript to be able to create a code to take soccer results from another site. I am not sure if it is possible to do it just using the address and the 'source code' of that site:

<table id="blocks" class="gteam team2432-1 team10818-1" onmouseover="rowOver('2432-1','10818-1')" onmouseout="resetOver()">
  <tbody>
    <tr class="even">
      <td class="kick">20:45</td>
      <td class="status"><span title="Final Time">FT</span></td>
      <td class="home uc winteam"> <span class='yellowcard'></span> Tottenham</td>
      <td class="score"><a title="Match Details" class="score_link" href="javascript:popup('771395-1')">2 - 0</a></td>
      <td class="away uc ">Everton FC <span class='yellowcard'></span><span class='yellowcard'></span><span class='yellowcard'></span> </td>
      <td class="halftime">(1 - 0)</td>
      <td class="tools"><span class="toolBox"><span title="Rescheduled from 13.08.2011." class="info">&nbsp;</span></span></td>
      <td class="fav"></td>
    </tr>
  </tbody>
</table>

As you can see, this is the reason I cannot modify the code, because it's not mine.

eburlea 23 Junior Poster

Thank you for reply. I would like to know what code to use leaving Tottenham as it is.

eburlea 23 Junior Poster

Hello. I want to get data from a table. I wrote the folloing JavaScript code:

var homeTeam = document.getElementById('home').firstChild.data;

The html code for the table is:

<table>
  <tr>
    <td id="home"><span class='yellowcard'></span>Tottenham</td>
    <td id="away">Chelsea</td>
  </tr>
</table>

How is it possible to get the word 'Tottenham' in this case?
My JavaScript code is working only if 'span' tags are removed.

eburlea 23 Junior Poster

I get an error and I cannot figure out what is the problem.

Error:

Warning: Cannot modify header information - headers already sent by (output started at z:\home\localhost\www\soccerstatistics\admin\new_team.php:1) in z:\home\localhost\www\soccerstatistics\admin\lock.php on line 6

  1. <?php
  2. include("blocks/db.php");
  3. if (!isset($_SERVER['PHP_AUTH_USER']))
  4. {
  5. Header ("WWW-Authenticate: Basic realm=\"Admin Page\"");
  6. Header ("HTTP/1.0 401 Unauthorized");
  7. exit();
  8. }

  9. 11.else {
  10. if (!get_magic_quotes_gpc()) {
  11. $_SERVER['PHP_AUTH_USER'] = mysql_escape_string($_SERVER ['PHP_AUTH_USER']);
  12. $_SERVER['PHP_AUTH_PW'] = mysql_escape_string($_SERVER['PHP_AUTH_PW']);
  13. }
  14. $query = "SELECT pass FROM userlist WHERE user='".$_SERVER['PHP_AUTH_USER']."'";
  15. $lst = @mysql_query($query);
  16. if (!$lst)
  17. {
  18. Header ("WWW-Authenticate: Basic realm=\"Admin Page\"");
  19. Header ("HTTP/1.0 401 Unauthorized");
  20. exit();
  21. }
  22. if (mysql_num_rows($lst) == 0)
  23. {
  24. Header ("WWW-Authenticate: Basic realm=\"Admin Page\"");
  25. Header ("HTTP/1.0 401 Unauthorized");
  26. exit();
  27. }
  28. $pass = @mysql_fetch_array($lst);
  29. if ($_SERVER['PHP_AUTH_PW']!= $pass['pass'])
  30. {
  31. Header ("WWW-Authenticate: Basic realm=\"Admin Page\"");
  32. Header ("HTTP/1.0 401 Unauthorized");
  33. exit();
  34. }
    41.}
    42.?>

Please advise...

eburlea 23 Junior Poster

Hello, all. Please advise how to use $_POST in cycle. I have the following code:

  1. <?php
  2. if (isset($_POST['id1'])) {$id1 = $_POST['id1']}
  3. if (isset($_POST['id2'])) {$id2 = $_POST['id2']}
  4. if (isset($_POST['id3'])) {$id3 = $_POST['id3']}
  5. ?>

I have tried:

  1. <?php
  2. for ($x=1, $x<=3, $x++)
  3. {
  4. if (isset($_POST['id".$x."'])) {$id".$x." = $_POST['id".$x."'];}
  5. }
  6. ?>

...but it doesn't work. :(

eburlea 23 Junior Poster

I appologize, I am a new user and I do not know how to format the code otherwise. Please advise.

eburlea 23 Junior Poster

Ardav, thank you so much!!! Your code helped me a lot!!!

I need to say that I am a beginner at HTML, CSS, PHP, MySQL and at the moment I study them by myself (it is very difficult so...). I am creating a webpage while learning, and at the moment I am working on Admin Page, the one that inserts new teams into the DB filling a form. I need to use an array to complete this task, because the number of new teams to be inserted differs from one time to another. Your 2 lines were non-familiar to me and they are really useful:

$str[] = "('{$array1[$x]}','{$array2[$x]}')";
$s = implode(',',$str);

One change I've made to make it work:

  1. $cteam = count($array1);
  2. $cleague = count($array2);
  3. if($cteam == $cleague)
  4. {
  5. for($x = 0; $x < $cteam; $x++)
  6. {
  7. $str[] = "('{$array1[$x]}','{$array2[$x]}')";
  8. }
  9. $s = implode(',',$str);
  10. //$sql = "INSERT INTO teams (team,league) VALUES $s";
  11. mysql_query ("INSERT INTO teams (team,league) VALUES $s",$db);
  12. }

Daniweb is a really great site, people can find a lot of useful information here. Thank you!

eburlea 23 Junior Poster

Thank you for reply and the info. I have the folloing PHP code in my page now:

<?php

$array1 [0] = "Manchester United";
$array1 [1] = "Manchester City";
$array1 [2] = "Arsenal";

$array2 [0] = "England Premier League";
$array2 [1] = "England Premier League";
$array2 [2] = "England Premier League";

include ("blocks/db.php");

$cteam = count($array1);
$cleague = count($array2);
if($cteam == $cleague)
  {  
  for($x = 0; $x < $cteam; $x++)
     {    
     $str[] = "('{$array1[$x]}','{$array2[$x]}')";  
     }  
  $s = implode(',',$str);  
  $sql = "INSERT INTO teams (team,league) VALUES $s";
  echo $sql;
  }

?>

In the browser appear:

INSERT INTO teams (team,league) VALUES ('Manchester United','England Premier League'),('Manchester City','England Premier League'),('Arsenal','England Premier League')

I guess something is missing, as in the database nothing appears (maybe mysql_query function...).

eburlea 23 Junior Poster

Hi all!

I am trying to insert multiple arrays values into a MySQL table. All I can manage is to echo in the browser.

I have the following arrays:

$array1 [0] = "Arsenal";
$array1 [1] = "Barcelona";
$array1 [2] = "Bayern";

$array2 [0] = "England Premier League";
$array2 [1] = "Spain Premiera Division";
$array2 [2] = "Germany Bundesliga";

What code should I write to send them to my MySQL database?

Table: teams;
Column 1: team;
Column 2: league.

For 2 days I am trying to figure it out and I give up. PLEASE HELP!!!