Umbus Posted October 30, 2009 at 11:29 AM Report Share #293995 Posted October 30, 2009 at 11:29 AM Boas quero enviar um array para a base de dados ou seja tenho um array[ x ] e quero que seja enviado por um input como faço? Eu sou eu e eu sou aquele que sou eu... Link to comment Share on other sites More sharing options...
M6 Posted October 30, 2009 at 11:34 AM Report Share #293996 Posted October 30, 2009 at 11:34 AM Percorres o array e envias os valores para as colunas correspondentes. 10 REM Generation 48K! 20 INPUT "URL:", A$ 30 IF A$(1 TO 4) = "HTTP" THEN PRINT "400 Bad Request": GOTO 50 40 PRINT "404 Not Found" 50 PRINT "./M6 @ Portugal a Programar." Link to comment Share on other sites More sharing options...
Umbus Posted October 30, 2009 at 11:52 AM Author Report Share #294000 Posted October 30, 2009 at 11:52 AM Boas, Fiz assim, mas nao funciona, o que estou a fazer de mal? while ($row = mysql_fetch_assoc($result)) { $sala[$x] = $_POST[$row['siteform']]; $x++; $final1[$x] = $row['siteform']; } $sala2 = $sala[$x]; $final = $final1[$x]; for($i=1;$i<count($final);$i++) { $sql = "INSERT INTO salasnicks ("; for ($i=0; $i<count($final); $i++) { $sql .= key($info); if ($i < (count($final)-1)) { $sql .= ", "; } else $sql .= ") "; next($final); } reset($final); $sql .= "VALUES ("; for ($j=0; $j<count($sala2); $j++) { $sql .= "'".current($sala2)."'"; if ($j < (count($sala2)-1)) { $sql .= ", "; } else $sql .= ") "; next($sala2); } //execute the query mysql_query($sql) or die("query failed ".mysql_error()); return mysql_insert_id(); } APARTE: Usa o Geshi, para o post ficar mais legível. Eu sou eu e eu sou aquele que sou eu... Link to comment Share on other sites More sharing options...
M6 Posted October 30, 2009 at 01:51 PM Report Share #294028 Posted October 30, 2009 at 01:51 PM Não sei o que fizeste mal. Qual é o erro que dá? 10 REM Generation 48K! 20 INPUT "URL:", A$ 30 IF A$(1 TO 4) = "HTTP" THEN PRINT "400 Bad Request": GOTO 50 40 PRINT "404 Not Found" 50 PRINT "./M6 @ Portugal a Programar." Link to comment Share on other sites More sharing options...
Umbus Posted October 30, 2009 at 02:07 PM Author Report Share #294030 Posted October 30, 2009 at 02:07 PM Estou sem erros no servidor 😉. Eu sou eu e eu sou aquele que sou eu... Link to comment Share on other sites More sharing options...
M6 Posted October 30, 2009 at 04:01 PM Report Share #294050 Posted October 30, 2009 at 04:01 PM Isso tem de dar um erro qualquer, esse die("query failed ".mysql_error()); devolve algo? É que sem saber qual é o erro não dá para resolver o problema... Podes fazer uma coisa mais simples, que é mostrar a string que estás a enviar para o MySQL e corrê-la directamento no MySQL de forma a ver se há algum problema ai. 10 REM Generation 48K! 20 INPUT "URL:", A$ 30 IF A$(1 TO 4) = "HTTP" THEN PRINT "400 Bad Request": GOTO 50 40 PRINT "404 Not Found" 50 PRINT "./M6 @ Portugal a Programar." Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now