Wednesday 15 June 2011

php - Notice: Undefined index: id in -


I have written the code but I am still working:

Notice: Undefined Index: C: \ xampp \ htdocs \ Portfolio \ periode4 \ graden \ array.php on line 35

Do anyone know what I have to do to remove the notice?

  & lt ;? Php function connect () {// Create a MySQL connection $ link = mysqli_connect ("local host", "root", "", "school") or die (mysqli_error ()); $ Link returned; } If ($ _GET) {$ id = $ _GET ["id"]; } // Select query $ query = "SELECT * FROM graden"; $ Result = mysqli_query (connect (), $ query); // tableclick macen $ table = "& lt; table range = '1' & gt;"; $ Table = ". & Lt; tr & gt; & lt; th & gt; id & lt; / th & gt; & lt; th & gt; Graden celsius & lt; / th & gt; & lt; th & Gt; Aanduiding & lt; / gt; & lt; th & gt; Image & lt; / th & gt; & lt; / tr & gt; "; // The next line goes as long as there are no more to receive ($ line = mysqli_fetch_assoc ($ result)) {$ table = "& lt; tr". ($ _ Get ['id'] == $ line ['id']? Style = 'background-color: yellow' ":" ")." & Gt; "; // Print the content of each line in a foreign currency ($ line = $> $ value as $ line) {if ($ key ==" image ") {$ table. =" & Lt; Td> & Lt; Img src = '$ Value' / & gt; & Lt; / Td> ";} Elseif ($ key ==" id ") {$ table =" & lt; TD & gt; & Lt; A href = 'array.php id = $ value?' & Gt; $ Value & lt; / A & gt; & Lt; / TD & gt; ";;} and {$ table. =" & Lt; Td> $ Value & lt; / Td> ";}} $ table. =" & Lt; / Tr & gt; ";} $ table. =" & Lt; / Table> "; Echo $ table; // OptiList // Select the MacKey query $ query =" SELECT id, temp FROM graden "; // uitvoeren select the query $ result = mysqli_query (Connect ()) $ Query); // tonel alle gegevens $ selection = "& lt; Form action = \ "array.php \" method = \ "received \" & gt; \ N & LT; Selection name = \ "id \" & gt; \ N & LT; Option value = 'id' & gt; --- All --- & lt; / Options & gt; \ N "; while ($ line = mysqli_fetch_assoc ($ result)) {$ selection =." & Lt; Option value = '"$ line. [' Id '].' '' & Gt;" .. $ line ["temporary"] "& lt; / Options & gt; \ N ";} Select $. =" & Lt; / Select & gt; \ N "; Select $. =" & Lt; Input type = \ "submit \" & gt; \ N "; Select $. =" & Lt; / Form & gt; \ N "; Select $ counter;    

If any Id parameter, it will definitely fail:

  $ table. = "& Lt; Tr "($ _GET ['id'] == $ line ['id']? Style = 'background-color: yellow'": ""). "& Gt;";   

Try

  $ table. Style = 'background-color: yellow' ":" = "& lt; tr (Isset ($ _gET ['id']) and $ _GET ['id'] == $ row ['id']? ")" & Gt; ";   

But he probably will break the argument a bit, you have to check ..

No comments:

Post a Comment