ik heb hulp nodig met een include

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Ventilatiesysteem Productontwikkelaar HBO WO Verwa

Samengevat: Zij bieden flexibele ventilatiematerialen, geluidsdempers, rookgasafvoer producten en industrieslangen. Ben jij een technisch productontwikkelaar? Heb jij ervaring met het ontwikkelen van nieuwe producten? Vaste baan: Technisch Productontwikkelaar HBO WO €3.000 - €4.000 Zij bieden een variëteit aan flexibele ventilatiematerialen, geluiddempers, rookgasafvoer producten, industrieslangen en ventilatieslangen voor de scheepsbouw. Met slimme en innovatieve materialen zorgen wij voor een gezonde en frisse leefomgeving. Deze werkgever is een organisatie die volop in ontwikkeling is met hardwerkende collega's. Dit geeft goede ontwikkelingsmogelijkheden. De branche van dit bedrijf is Techniek en Engineering. Functie: Voor de vacature als Technisch Productontwikkelaar Ede Gld HBO WO ga

Bekijk vacature »

Willem van weesenbeek

willem van weesenbeek

21/12/2007 00:10:00
Quote Anchor link
wat doe ik verkeer let niet op de backtickes etc als het maar werkt

ik wil met een database een include aansturen en zodat als er onderhoud aan de site word gepleegd dat dan de site offline gaat tot dat de vooraf ingevoerde datum die in de database staat is verlopen.

nu heb ik het met
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
"SELECT DATEDIFF(eind,NOW()) FROM Admin_onderhoud WHERE eind > 0 ORDER BY id DESC";


opgeloste de query werkt prima hij rekend de aantal dagen uit tot het einde van het onderhoud. en als de waarde negatief word dan wil ik dat de uiteindelijke pagina gastenboek.php word weergegeven.

dat heb ik zo opgelost:

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
<?php
if($var_domeinnaam['domeinnaam']== 'gastenboek'){
include('gastenboek.php');
}
else{
include('onderhoud.php');
}

?>


maar gastenboek word niet weergegeven ook al verwissel ik gastenboek.php en onderhoud.php dus dat gastenboek.php onderaan staat.

volledige pagina zie hieronder:

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php virtual('/gastenboek/Connections/gastenboek.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function
GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{

  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case
"text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case
"long":
    case
"int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case
"double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case
"date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case
"defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }

  return $theValue;
}
}


mysql_select_db($database_gastenboek, $gastenboek);
$query_onderhoud = "SELECT DATEDIFF(eind,NOW()) FROM Admin_onderhoud WHERE eind > 0 ORDER BY id DESC";
$onderhoud = mysql_query($query_onderhoud, $gastenboek) or die(mysql_error());
$row_onderhoud = mysql_fetch_assoc($onderhoud);
$totalRows_onderhoud = mysql_num_rows($onderhoud);
?>
<!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" />
<title>Untitled Document</title>
</head>

<body>
<?php
if($var_domeinnaam['domeinnaam']== 'gastenboek'){
include('gastenboek.php');
}
else{
include('onderhoud.php');
}

?>

</body>
</html>
<?php
mysql_free_result($onderhoud);
?>


u kunt ook eventjes kijken voor de errors op http://www.weesenbeek.nl/gastenboek/
Gewijzigd op 01/01/1970 01:00:00 door Willem van weesenbeek
 
PHP hulp

PHP hulp

25/04/2024 18:08:50
 
- -

- -

21/12/2007 00:19:00
Quote Anchor link
waar haal jij nou $var_domeinnaam vandaan?
 
Willem van weesenbeek

willem van weesenbeek

21/12/2007 00:30:00
Quote Anchor link
ff wat aanpassingen gedaan maar het probleem blijft het zelfde

als de ingevoerde waarde -1 is dan moet hij gastenboek weergeven.
als de ingevoerde waarde 1 is dan moet hij onderhoud weergeven
je kunt van te voren invoeren hoeveel dagen het onderhoud gaat plaatsvinden

dus als

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2

if($var_onderhoud['DATEDIFF(eind']
1 of meer tenopzichte van
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
$row_duur['duur'])
dan moet de pagina onderhoud.php weergeven.

dan krijg je deze code

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
<?php
if($var_onderhoud['DATEDIFF(eind'] > $row_duur['duur']){
include('onderhoud.php');
}
else{
include('gastenboek.php');
}

?>


of niet want ik kom er niet uit.
 
Willem van weesenbeek

willem van weesenbeek

21/12/2007 01:15:00
Quote Anchor link
ik krijg nu een foutmedling of in de index maar ik weet niet wat het betekend misschien een spate ergens maar ik zie het niet.

Warning: mysql_free_result(): 9 is not a valid MySQL result resource in /home/weesenbeek/domains/weesenbeek.nl/public_html/gastenboek/index.php on line 61


hieronder de index:

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php virtual('/gastenboek/Connections/gastenboek.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function
GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{

  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case
"text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case
"long":
    case
"int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case
"double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case
"date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case
"defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }

  return $theValue;
}
}


mysql_select_db($database_gastenboek, $gastenboek);
$query_onderhoud = "SELECT DATEDIFF(eind,NOW()) FROM Admin_onderhoud ORDER BY id DESC";
$onderhoud = mysql_query($query_onderhoud, $gastenboek) or die(mysql_error());
$row_onderhoud = mysql_fetch_assoc($onderhoud);
$totalRows_onderhoud = mysql_num_rows($onderhoud);

mysql_select_db($database_gastenboek, $gastenboek);
$query_duur = "SELECT duur FROM Admin_onderhoud ORDER BY id DESC";
$duur = mysql_query($query_duur, $gastenboek) or die(mysql_error());
$row_duur = mysql_fetch_assoc($duur);
$totalRows_duur = mysql_num_rows($duur);
?>
<!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" />
<title>Untitled Document</title>
</head>

<body>
<?php
if($var_onderhoud['DATEDIFF(eind'] >0){
include('gastenboek.php');
}
else{
include('onderhoud.php');
}

?>

</body>
</html>
<?php
mysql_free_result($onderhoud);

mysql_free_result($duur);
?>


onderhoud.php werkt goed maar krijg foutmelding maar ik zie niet wat het is een spatie of iets ???

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php virtual('/gastenboek/Connections/gastenboek.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function
GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{

  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case
"text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case
"long":
    case
"int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case
"double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case
"date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case
"defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }

  return $theValue;
}
}


mysql_select_db($database_gastenboek, $gastenboek);
$query_onderhoud = "SELECT * FROM Admin_onderhoud ORDER BY id DESC";
$onderhoud = mysql_query($query_onderhoud, $gastenboek) or die(mysql_error());
$row_onderhoud = mysql_fetch_assoc($onderhoud);
$totalRows_onderhoud = mysql_num_rows($onderhoud);

mysql_select_db($database_gastenboek, $gastenboek);
$query_berekening = "SELECT DATEDIFF(eind,NOW()) FROM Admin_onderhoud ORDER BY id DESC";
$berekening = mysql_query($query_berekening, $gastenboek) or die(mysql_error());
$row_berekening = mysql_fetch_assoc($berekening);
$totalRows_berekening = mysql_num_rows($berekening);
?>

<style type="text/css">
<!--
@import url("/gastenboek/css/teken.css");
-->
</style>
</head>

<body>
<table width="50%" border="0" align="center" class="teken">
  <tr>
    <td><p align="left">Er is onderhoud gepland voor deze pagina. De pagina zal gedurende het onderhoud niet naar behoren werken. Mogelijk zal dit resulteren in dataverlies. </p>
      <p align="left">Onze excuses hiervoor.</p>
      
        <p align="left">We hebben <?php echo $row_onderhoud['duur']; ?> dag(en) gepland.</p>
      <p align="left">U moet nog <?php echo $row_berekening['DATEDIFF(eind,NOW())']; ?> dag(en) wachten.</p></td>
  </tr>
</table>
<?php
mysql_free_result($onderhoud);

mysql_free_result($berekening);
?>
 
Crispijn -

Crispijn -

21/12/2007 11:10:00
Quote Anchor link
Zet eens

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
<?php
ini_set('display_errors', 1); // 0 = uit, 1 = aan
error_reporting(E_ALL);
?>


Boven aan je script. Het barst echt van de fouten. Ga dan netjs alle variablelen declareren en rare opbouw veranderen.

Succes!
 
Willem van weesenbeek

willem van weesenbeek

21/12/2007 12:34:00
Quote Anchor link
dit is het script nu geworden zullen wel fouten in staan maar ik ben niet nog niet bekwaam genoeg om deze eruit te filteren:

index.php

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php virtual('/gastenboek/Connections/gastenboek.php'); ?>
<?php virtual('/gastenboek/Connections/gastenboek.php');
if (!function_exists("GetSQLValueString")) {
function
GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{

  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case
"text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case
"long":
    case
"int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case
"double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case
"date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case
"defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }

  return $theValue;
}
}


[
code]<?php
mysql_select_db($database_gastenboek, $gastenboek);
$query_onderhoud = "SELECT DATEDIFF(eind,NOW())AS verschil FROM Admin_onderhoud ORDER BY id DESC";
$onderhoud = mysql_query($query_onderhoud, $gastenboek) or die(mysql_error());
$row_onderhoud = mysql_fetch_assoc($onderhoud);
$totalRows_onderhoud = mysql_num_rows($onderhoud);
?>

mysql_select_db($database_gastenboek, $gastenboek);
$query_duur = "SELECT * FROM Admin_onderhoud ORDER BY id DESC";
$duur = mysql_query($query_duur, $gastenboek) or die(mysql_error());
$row_duur = mysql_fetch_assoc($duur);
$totalRows_duur = mysql_num_rows($duur);
?>
<!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" />
<title>Untitled Document</title>
</head>

<body>

<?php
// Turn off all error reporting
error_reporting(1);

// Report simple running errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);

// Reporting E_NOTICE can be good too (to report uninitialized
// variables or catch variable name misspellings ...)

error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

// Report all errors except E_NOTICE
// This is the default value set in php.ini

error_reporting(E_ALL ^ E_NOTICE);

// Report all PHP errors (bitwise 63 may be used in PHP 3)
error_reporting(E_ALL);

// Same as error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);

if($var_onderhoud['verschil'] >0){
include('gastenboek.php');
}
else{
include('onderhoud.php');
}

?>

</body>
</html>
<?php
mysql_free_result($onderhoud);
mysql_free_result($duur);
?>


gastenboek.php

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php

// Turn off all error reporting
error_reporting(0);

// Report simple running errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);

// Reporting E_NOTICE can be good too (to report uninitialized
// variables or catch variable name misspellings ...)

error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

// Report all errors except E_NOTICE
// This is the default value set in php.ini

error_reporting(E_ALL ^ E_NOTICE);

// Report all PHP errors (bitwise 63 may be used in PHP 3)
error_reporting(E_ALL);

// Same as error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);

?>


<body>
motherfucker
</body>
</html>


onderhoud.php

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php virtual('/gastenboek/Connections/gastenboek.php');

if (!function_exists("GetSQLValueString")) {
function
GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{

  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case
"text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case
"long":
    case
"int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case
"double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case
"date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case
"defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }

  return $theValue;
}
}


mysql_select_db($database_gastenboek, $gastenboek);
$query_datediff = "SELECT DATEDIFF(EIND,NOW())AS verschil FROM Admin_onderhoud ";
$datediff = mysql_query($query_datediff, $gastenboek) or die(mysql_error());
$row_datediff = mysql_fetch_assoc($datediff);
$totalRows_datediff = mysql_num_rows($datediff);

[
code]<?php
mysql_select_db($database_gastenboek, $gastenboek);
$query_onderhoud = "SELECT * FROM Admin_onderhoud ORDER BY id DESC";
$onderhoud = mysql_query($query_onderhoud, $gastenboek) or die(mysql_error());
$row_onderhoud = mysql_fetch_assoc($onderhoud);
$totalRows_onderhoud = mysql_num_rows($onderhoud);
?>

?>
<link href="/gastenboek/css/teken.css" rel="stylesheet" type="text/css" />
<table width="75%" border="0" align="center" class="teken">
  <tr>
    <td><div align="center">Aan deze site vind onderhoud plaats. </div></td>
  </tr>
  <tr>
    <td><div align="center">Einddatum onderhoud: <?php echo $row_onderhoud['eind']; ?></div>
        <div align="center"></div></td>
  </tr>
  <tr>
    <td><div align="center">We zijn over <?php echo $row_datediff['verschil']; ?> dag(en) weer online onze excuses.</div></td>
  </tr>
</table>

<?php
mysql_free_result($datediff);
mysql_free_result($onderhoud);
?>


de database bevat een waarde dus onderhoud.php word nu weergegeven

met deze fouten.

Notice: Undefined variable: var_onderhoud in /home/weesenbeek/domains/weesenbeek.nl/public_html/gastenboek/index.php on line 1187668352
Aan deze site vind onderhoud plaats.
Einddatum onderhoud: 2007-12-22
We zijn over 1 dag(en) weer online onze excuses.

Warning: mysql_free_result(): 10 is not a valid MySQL result resource in /home/weesenbeek/domains/weesenbeek.nl/public_html/gastenboek/index.php on line 82

ik gebruik deze querys

om de dagen uit te rekenen en deze gebruik ik ook bij de include
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
mysql_select_db($database_gastenboek, $gastenboek);
$query_datediff = "SELECT DATEDIFF(EIND,NOW())AS verschil FROM Admin_onderhoud ";
$datediff = mysql_query($query_datediff, $gastenboek) or die(mysql_error());
$row_datediff = mysql_fetch_assoc($datediff);
$totalRows_datediff = mysql_num_rows($datediff);


mysql_select_db($database_gastenboek, $gastenboek);
$query_onderhoud = "SELECT * FROM Admin_onderhoud ORDER BY id DESC";
$onderhoud = mysql_query($query_onderhoud, $gastenboek) or die(mysql_error());
$row_onderhoud = mysql_fetch_assoc($onderhoud);
$totalRows_onderhoud = mysql_num_rows($onderhoud);


die zijn op alle pagina's hetzelfde
Gewijzigd op 01/01/1970 01:00:00 door willem van weesenbeek
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.