[Resolvido] Inserir dados na tabela
Caros,
tou tentando inseri alguns dados em uma tabela porém o sistema não estava gravando na tabela e nem dando erro, vocês podem me ajudar?
teste.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<script type="text/javascript" src="ckeditor/public/js/ckeditor/ckeditor.js"></script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head><form name="form1" method="post" action="insere_noticias.php">
<input name="titulo" type="text" /><br /><br />
<textarea class="ckeditor" name="texto"></textarea>
</form></body>
</html>
insere_noticias.php
<?php include('../config.php'); ?>
<?php
$qid = $_POST['id'];
$qtitulo = $_POST['titulo'];
$qtexto = $_POST['texto'];
$sql = "insert into noticias (titulo, texto) values ('$qtitulo','$qtexto')";
mysql_query($sql, $conexao);
header("Location: ./teste.html");
exit;
?>
Escrutura da tabela
-- phpMyAdmin SQL Dump
-- version 2.10.3
-- http://www.phpmyadmin.net
--
-- Servidor: localhost
-- Tempo de Geração: Fev 07, 2011 as 10:06 PM
-- Versão do Servidor: 6.0.4
-- Versão do PHP: 6.0.0-dev
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Banco de Dados: test
--
-- --------------------------------------------------------
--
-- Estrutura da tabela noticias
--
CREATE TABLE `noticias` (
`id` int(50) NOT NULL AUTO_INCREMENT,
`titulo` varchar(250) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
`texto` varchar(500) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
--
-- Extraindo dados da tabela noticias
--
Discussão (2)
Carregando comentários...