4dim arrays ??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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
AshrakTheWhite
Forum Commoner
Posts: 69
Joined: Thu Feb 02, 2006 6:47 am

Post 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*);
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

Post by ddragas »

Post Reply