Page 2 of 2
Posted: Sun Oct 15, 2006 2:58 pm
by volka
Code: Select all
<?php
$var = $arr['xyz'];
// but
$var = " ... $arr[xyz] ...";
// or
$var = " ... {$arr['xyz']} ...";
see also:
http://www.php.net/manual/en/language.t ... tax.double
http://www.php.net/manual/en/language.t ... rray.donts
Posted: Sun Oct 15, 2006 3:24 pm
by AshrakTheWhite
ddragas wrote:Thank you all for reply
volkas code goves me what I need, and my next problem is how to insert values from form into db ?
I've tried what you've suggested me, but with no result of course with changed sql query
I get error in sql query, and error is
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Program Files\Apache Group\Apache2\htdocs\skola\Untitled-2.php on line 14
SQL QUERY WITH ERROR
Code: Select all
$sql = "INSERT INTO ocijene SET
ocijena_usmeno = '$array['pawn']',
ocijena_pismeno = '$array['verbal_testing']',
ocijena_zalaganje = '$array['written_testing']',
ucenik = '$array['student_id']'";
what are you setting? are you overwriting the one line in the DB table? i dont think insert code has a "SET" function
Code: Select all
INSERT INTO *where* (*TABLE NAMES*) VALUES(*VALUES FOR EACH COLUMN*);
Posted: Sun Oct 15, 2006 3:34 pm
by ddragas