Nao estou conseguindo inserir os dados no msql
meu codigo e o seguinte
[codebox]<?php
include "conecta.php";
if (isset($_FILES['img']) &&
isset($_POST['nome']) &&
isset($_POST['tamanho']) &&
isset($_POST['formato']) &&
isset($_POST['audio']) &&
isset($_POST['legenda'])&&
isset($_POST['descricao']))
{
$name = $_FILES['img']['name'];
$tmp_name = $_FILES['img']['tmp_name'];
$dirImg = "imgs/".$name;
copy($tmp_name, $dirImg);
$nome = $_POST['nome'];
$tamanho = $_POST['tamanho'];
$formato = $_POST['formato'];
$audio = $_POST['audio'];
$legenda = $_POST['legenda'];
$descricao = $_POST['descricao'];
$sql = "insert into seriado values ('$nome','$dirImg','$tamanho','$formato','$audio','$legenda','$descricao')";
mysql_query($sql);
header("Location: cadseriado.php");
}
?>[/codebox]
o que poderia esta de errado os nomes, dos texts areas sao todos renomeados ja todos certos.
desde ja grato

Inserindo Dados No Mysql
Started By Henrique Neto, 29/04/2009, 16:22
4 replies to this topic
#1
Posted 29/04/2009, 16:22
#2
Posted 30/04/2009, 09:30
Os objetos que estão sendo inseridos estão na mesma ordem da tabela?
Todos tem a mesma tipagem?
Todos tem a mesma tipagem?
Especialidade: Desenvolvimento e Banco de Dados.
Este post lhe ajudou? Agradeça:
#3
Posted 30/04/2009, 12:30
[codebox]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd">
<?php
include("sessao.php");
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<style type="text/css" media="screen">
@import url("../css/Parte2.css");
</style>
<link href="../css/Parte2.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form action="cadasseriado.php" method="post" enctype="multipart/form-data" id="iframecentro">
<div align="center"><a href="index.php">Pagina inicial </a> <br />
</div>
<div id="div1">
<p><br />
Nome:
<input type="text" size="40px" name="nome" />
<br />
<br />
Descrição:
<input type="text" size="50px" name="descricao" />
<br />
<br />
Imagem:
<input type="file" name="imagem" />
Tamanho:
<input type="text" size="10px" name="tamanho" />
<br />
<br />
Formato:
<input type="text" size="10px" name="formato" />
Audio:
<input type="text" size="10px" name="audio" />
<br />
<br />
Legenda:
<input type="text" size="10px" name="legenda" />
<br />
<br />
<input type="submit" value="Cadastrar" name="Cadastrar" />
</p>
</div>
</form>
</body>
</html>
[/codebox]
sim rafael, pelo menos q eu saiba. tipagem?
desculpa pois sou novo.
e o banco de dados dele
create table seriado (
nome char(50) NOT NULL,
img char(128) NULL,
tamanho float NOT NULL,
formato char(10) NOT NULL,
audio char (20) NOT NULL,
legenda char(10) NOT NULL,
descricao char(50) NOT NULL );
....
<?php
include("sessao.php");
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<style type="text/css" media="screen">
@import url("../css/Parte2.css");
</style>
<link href="../css/Parte2.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form action="cadasseriado.php" method="post" enctype="multipart/form-data" id="iframecentro">
<div align="center"><a href="index.php">Pagina inicial </a> <br />
</div>
<div id="div1">
<p><br />
Nome:
<input type="text" size="40px" name="nome" />
<br />
<br />
Descrição:
<input type="text" size="50px" name="descricao" />
<br />
<br />
Imagem:
<input type="file" name="imagem" />
Tamanho:
<input type="text" size="10px" name="tamanho" />
<br />
<br />
Formato:
<input type="text" size="10px" name="formato" />
Audio:
<input type="text" size="10px" name="audio" />
<br />
<br />
Legenda:
<input type="text" size="10px" name="legenda" />
<br />
<br />
<input type="submit" value="Cadastrar" name="Cadastrar" />
</p>
</div>
</form>
</body>
</html>
[/codebox]
sim rafael, pelo menos q eu saiba. tipagem?
desculpa pois sou novo.
e o banco de dados dele
create table seriado (
nome char(50) NOT NULL,
img char(128) NULL,
tamanho float NOT NULL,
formato char(10) NOT NULL,
audio char (20) NOT NULL,
legenda char(10) NOT NULL,
descricao char(50) NOT NULL );
....
Edição feita por: Henrique Neto, 30/04/2009, 12:31.
#4
Posted 05/05/2009, 20:39
Use mysql_error() para ter a informação do que ocorreu.
Felipe Pena
[...] ó terra, terra, terra; ouve a palavra do Senhor. — Jeremias 22:29
[...] ó terra, terra, terra; ouve a palavra do Senhor. — Jeremias 22:29
#5
Posted 05/05/2009, 23:34
use varchar!
e outra veja se a quantidade de letras e o suficiente!
e outra veja se a quantidade de letras e o suficiente!
1 user(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)