Jump to content

Rob56

New Members
  • Posts

    4
  • Joined

  • Last visited

Rob56's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you very much, I forgot the INNER JOIN ON roosterid=twid. There are no errors Undefined offset anymore. But the Undefined index in the second code stays.
  2. Here they are. -- phpMyAdmin SQL Dump -- version 3.3.0 -- http://www.phpmyadmin.net -- -- Machine: localhost -- Genereertijd: 17 Nov 2012 om 18:16 -- Serverversie: 5.1.44 -- PHP-Versie: 5.2.13 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `rooster` -- -- -------------------------------------------------------- -- -- Tabelstructuur voor tabel `rooster` -- CREATE TABLE IF NOT EXISTS `rooster` ( `roosterid` int(4) NOT NULL AUTO_INCREMENT, `ma` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `kls` text NOT NULL, `ge` text NOT NULL, `f101` text NOT NULL, `extra` text NOT NULL, PRIMARY KEY (`roosterid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; -- -- Gegevens worden uitgevoerd voor tabel `rooster` -- -- phpMyAdmin SQL Dump -- version 3.3.0 -- http://www.phpmyadmin.net -- -- Machine: localhost -- Genereertijd: 17 Nov 2012 om 18:17 -- Serverversie: 5.1.44 -- PHP-Versie: 5.2.13 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `rooster` -- -- -------------------------------------------------------- -- -- Tabelstructuur voor tabel `tw` -- CREATE TABLE IF NOT EXISTS `tw` ( `urid` int(4) NOT NULL AUTO_INCREMENT, `urma` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `urclass` text NOT NULL, `urge` text NOT NULL, `urf101` text NOT NULL, `extra` text NOT NULL, PRIMARY KEY (`urid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; -- -- Gegevens worden uitgevoerd voor tabel `tw` -- errors: first code Notice: Undefined offset: 10 in D:... on line 40 Notice: Undefined offset: 9 in D:.. on line 40 Notice: Undefined offset: 8 in D:... on line 40 Notice: Undefined offset: 7 in D:... on line 40 Notice: Undefined offset: 6 in D:... on line 40 second code Notice: Undefined index: f101 in D:... on line 47 Notice: Undefined index: urma in D:... on line 59 Notice: Undefined index: urclass in D:... on line 61 Notice: Undefined index: urf101 in D:... on line 65
  3. Thank you for your help, This is the code. Nothing is missing, now <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[url="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd[/url]"> <html xmlns="[url="http://www.w3.org/1999/xhtml"]http://www.w3.org/1999/xhtml[/url]" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf8_unicode_ci" /> <title></title> <link rel= "stylesheet" href="menu_style.css" type="text/css" /> <link href="opmaak.css" rel="stylesheet" type="text/css"/> </head> <?php include 'navigatie/nav6.inc'; ?> <div id="container"> <div id="header3"> <html> <head> <? include ("db_connect.inc.php"); $query = "SELECT * FROM rooster ";; // de SQL-query die wordt uitgevoerd $resultaat = ""; // hierin wordt het resultaat van de query opgeslagen $resultaat = mysql_query($query, $db); mysql_close($db); ?> <h2>Rooster</h2> <hr> <?php while(list($roosterid, $ma, $kls,$ge,$f101,$extra, $urid, $urma, $urclass, $urge, $urf101) = mysql_fetch_row($resultaat)){ echo "<P>$kls"; echo "<BR><a href=\"make.php?id=$roosterid\"></a><br>Fill in"; } ?> </body> </html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[url="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"]http://www.w3.org/TR...tml1-strict.dtd[/url]"> <html xmlns="[url="http://www.w3.org/1999/xhtml"]http://www.w3.org/1999/xhtml[/url]" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf8_unicode_ci" /> <title></title> <link rel= "stylesheet" href="menu_style.css" type="text/css" /> <link href="opmaak.css" rel="stylesheet" type="text/css"/> </head> </head> <?php include 'navigatie/nav6.inc'; ?> <div id="container"> <div id="header3"> <html> <head> </head> <body> <?php include ("db_connect.inc.php"); // controleren of pagina zichzelf heeft aangeroepen // via hidden field " bevestiging" van formulier if (isset($_POST["bevestiging"])){ // query samenstellen // LET OP: in werkelijkheid nog validatie uitvoeren van de gegevens in $_POST $query = "UPDATE rooster SET ma = '". $_POST["ma"] ."', kls = '". $_POST["kls"] ."', goe = '". $_POST["ge"] ."', f101 = '". $_POST["f101"] ."' WHERE roosterid='" .$_POST["id"] ."'"; mysql_query($query); $query = "UPDATE tw SET urma = '". $_POST["urma"] ."', urclass = '". $_POST["urclass"] ."', urge = '". $_POST["urge"] ."', urf101 = '". $_POST["urf101"] ."' WHERE urid='" .$_POST["id"] ."'"; mysql_query($query); echo "<h2>Rooster</h2>De volgende opdracht is uitgevoerd: <b>$query</b><br><hr>\n"; echo "Record nummer " .$_POST["id"] . " is bijgewerkt<br>\n"; echo "<a href=\"wijzigen.php\">Terug naar wijzigen.</a>"; } else{ // pagina heeft zichzelf nog niet aangeroepen, gegevens inlezen $query="SELECT * FROM rooster INNER JOIN tw ON roosterid=urid WHERE roosterid='". $_GET["id"] ."'"; $resultaat = mysql_query($query); while (list($roosterid, $ma, $kls,$ge,$f101,$extra, $urid, $urma, $urclass, $urge, $urf101 ) = mysql_fetch_row($resultaat)){ $vn=$ma; $vm=$kls; $aa=$ge; $ab=$f101; $ac=$urge; $ad=$urf101; } ?> <form action="<?php echo($_SERVER["PHP_SELF"]);?>" method="post"> <input type="hidden" name="bevestiging" value="1"> <input type="hidden" name="id" value="<?php echo $_GET["id"];?>"> <h2>wijzigen</h2> Kls:<input type="text" name="kls" value="<?php echo$vm;?>" size="50""><br> Dag <input type="checkbox" name="ma" <?php if (!empty($vn)) {echo 'checked="checked"';} ?> value="ma""/>ma <br>Eerste <input type="checkbox" name="ge" <?php if (!empty($aa)) {echo 'checked="checked"';} ?> value="ge""/>ge <input type="checkbox" name="f101" <?php if (!empty($ab)) {echo 'checked="checked"';} ?> value="f101""/>101 <br>Tweede <input type="checkbox" name="urge" <?php if (!empty($ac)) {echo 'checked="checked"';} ?> value="ge""/>ge <input type="checkbox" name="urf101" <?php if (!empty($ad)) {echo 'checked="checked"';} ?> value="utf101""/>101 <hr> <input type="Submit" value="Registreer de gegevens."> </form> <?php }// else-blok afsluiten ?> </body> </html> </div>
  4. The following code works, but I get the the error 'undefined offset' on the items of the while list. All the items are in the database. What is the problem? <? include ("db_connect.php"); $query = "SELECT * FROM rooster ";; $resultaat = ""; $resultaat = mysql_query($query, $db); mysql_close($db); ?> <?php while(list($roosterid, $ma, $kls,$ge,$f101,$extra, $urid, $urma, $urclass, $urge, $urf101) = mysql_fetch_row($resultaat)){ echo "<P>$kls"; echo "<BR><a href=\"make.php?id=$roosterid\">Fill in</a><br>"; } ?>
×
×
  • 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.