Gravar Data No Banco De Dados....
#1
Posted 03/12/2004, 00:28
Gostaria de salvar datas no banco de dados MYSQL....estou criando um livro de visitas...e nas mensagens postadas pelos visitantes...gostaria que fosse gravado a data que o visitante postou a mensagem...e minha duvida é que cód uso para pegar a data e hora....e o tipo de campo no MYSQL.....
Agradeço a todos pela atenção....
#2
Posted 03/12/2004, 06:54
timestamp, que é a quantidade de segundos rodados desde 01/01/1970 as zero horas...
ou datetime
se vc precisa fazer comparaçoes de segundos constantemente, a primeira forma se torna mais rapida... se vc faz poucas comparaçoes, a segunta é mais facil de converter pra mostrar na tela
๑۩۞۩๑Let the Carnage Begin!!๑۩۞۩๑
#3
Posted 03/12/2004, 15:20
Olá ...valew pela ajuda....tem varios jeitos...
timestamp, que é a quantidade de segundos rodados desde 01/01/1970 as zero horas...
ou datetime
se vc precisa fazer comparaçoes de segundos constantemente, a primeira forma se torna mais rapida... se vc faz poucas comparaçoes, a segunta é mais facil de converter pra mostrar na tela
entao...eu vou postar o script que estou criando..para o livro...é bem simples...
<?
$nome_form = $_POST['nome'];
$email_form = $_POST['email'];
$mensagem_form = $_POST['mensagem'];
$ip = getenv("REMOTE_ADDR");
$data = date("l dS of F Y h:i:s A");
$nome = htmlspecialchars($nome_form);
$email = htmlspecialchars($email_form);
$mensagem = htmlspecialchars($mensagem_form);
include "conecta.php";
$resultado = mysql_query("INSERT INTO livro(nome_livro,data,ip,email_livro,mensagem_livro) VALUES ('$nome','$data','$ip','$email','$mensagem') ");
echo " <b> Sua mensagem foi inserida com sucesso ! <b> ";
mysql_close($conexao);
?>
Entao....essa pagina pega as informaçoes do formulario e grava no banco de dados...junto com o IP e data que o visitante postou...O ip tá funcinando certinho...mas a data na visualização aparece assim..
Data: 0000-00-00 00:00:00
Esta dando algum problema pois aparece só zeros...e nao a data e hora ... o que pode estar acontecendo..?? O tipo do campo no MYSQL é DATETIME...
Agradeço a atençao de todos...
#4
Posted 03/12/2004, 23:31
$resultado = mysql_query("INSERT INTO livro(nome_livro,data,ip,email_livro,mensagem_livro) VALUES ('$nome',NOW(),'$ip','$email','$mensagem') ");
[...] ó terra, terra, terra; ouve a palavra do Senhor. — Jeremias 22:29
#5
Posted 04/12/2004, 17:24
#6
Posted 30/01/2006, 09:13
Nossa estou ressuscitando esse tópico.
Mas é que vi uma coisa interessante ali em:
$resultado = mysql_query("INSERT INTO livro(nome_livro,data,ip,email_livro,mensagem_livro) VALUES ('$nome',NOW(),'$ip','$email','$mensagem') ");
O que seria aquele NOW()???
A pergunta é porque estou criando um sistema de noticias e estou fazendo uma pesquisa sobre datas pois ainda não mexi com isso não.
Ele por acaso pega a data do dia e insere no banco de dados sem que seja necessário um campo no formulário para fazer isso???
Devo estar falando abobrinha né???
Quem puder ajudar.
Desde ja agradeço!!!
Walison(GENNF)
URL: www.batepapobrasil.com
----------------------------
Site desenvolvidos
URL: VitrineABC :: Alugue Litoral :: OrtodontiaLago
#7
Posted 30/01/2006, 09:36
Isso mesmo Walison, grava a data atual no bd.
Fórum WMO - Conselheira - Na equipe desde 31/01/2006.
Links importantes: Regras de conduta - Busca do fórum
#10
Posted 21/10/2017, 00:25
Amoxicillin Dosage For A Kitten Amoxicillin 500 Mg Price Viagra Espana Contrareembolso viagra Kamagra Instructions Zithromax Pediatric Dosing Chart
Viagra Costo A Confezione Cialis 5mg Anwendung Kamagra Jelly Orale 10 Bustine viagra Tadalis Sx Ordonnance Diclofenac Online Pharmacy Us No Rx Valuepharmaceuticals
Propecia 2 Months Tadalafil 100mg Reviews Cialis 10 Mg Effets Indesirables generic viagra Trusted Online Pharmacy
Non Us Pharmacies viagra Keflex Cystitis
Zithromax Side Effect Propecia Side Effects How Long Efficacia Finasteride Propecia viagra Propecia Free Trial Cheap Ed Pills Priligy Approuve Par La Fda
Afin Amoxil Necesito Tomar Cialis buy vardenafil online cheap Ciprofloxacin Eye Drops Propecia Generique 50mg First Medicine Online Pharmacy Store
Propecia Liver Enzymes Metabolized Vega H Amoxicillin Dose Strep Throat viagra vs cialis vs levitra samples Clomid 50mg Achete
#11
Posted 22/10/2017, 06:31
#12
Posted 22/10/2017, 11:31
#13
Posted 23/10/2017, 03:33
Confezione Viagra levitra 10mg Vitamins Interfere With Amoxicillin Precio Proscar Propecia
Kamagra Gel France Viagra Anwendung Wirkung viagra Buy Zithromax With Mastercard
Order Shipped Ups Stendra Medication Virginia Beach Levitra Produit Cialis Originale Miglior Prezzo viagra online Propecia Online Pharmacy Xenical Astymin
Buy Celebrex Cvs Propecia Does It Work Women viagra cialis Buy Plavix No Prescription Is Viagra Safe
Kamagra Anwendung Cephalexin Diclofenac Effects Bladder Infection Zithromax realcheaplevitra Levitra Prix Belgique Prezzo Viagra 50 Mg
#14
Posted 25/10/2017, 03:14
Non Prescription Advair Best Life Rx viagra online prescription Pastilla Cialis Efectos
Propecia Testicle Pain Swelling Of The Lips order levitra at walmart Lozol
#15
Posted 25/10/2017, 05:53
Discounts! best hair wax
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).
READ MORE
Online shop chandeliers and lamps in Moscow and Saint-Petersburg (SPb). Buy chandelier on Voltoff.ru - Voltoff.ru
Genuine Leather Game Box ( 185.00 $)
2pcs stylish solid color necklaces for women ( 1.99 $)
Crystal Cuff Links ( 87.78 $)
Iconic Woven Stainless Steel Mens Bracelet ( 109.00 $)
Women's handbags shoulder handbag high quality canvas shoulder bag for women lady bags handbags famous brands big bag ladies ( 37.21 $)
Hot brazilian loose wave virgin hair 4 bundle deals rosa hair products human hair soft loose wave brazilian hair weave bundles ( 87.15 $)
Original converse classic all star canvas shoes men and women sneakers low classic skateboarding shoes 4 color ( 66.50 $)
Casual plus size turn down collar striped shirts for men ( 17.21 $)
8A Peruvian Virgin Hair Body Wave 3 Bundles Tissage Peruvian Body Wave Wavy Human Hair BodyWave Unprocessed Peruvian Virgin Hair ( 67.45 $)
Fineco FX - 6ci WiFi FPV 2.4G 0.3MP CAM 4 Channel 6 Axis Gyro Quadcopter 3D Rollover Headless Mode-62.34 $
Dioufond New Floral Long Sleeve Vintage Blouse Cherry Turn Down Collar Shirt Blusas Feminino Ladies Blouses Womens Tops Fashion ( 10.17 $)
VCHOK M8 4.5 inch Android 5.1 4G Smartphone MTK6735 Quad Core IP68 Waterproof NFC SOS 16GB ROM 13.0MP Camera 275.39$
New 2016 baby boys girls velvet children clothing sets boys Cartoon hoodies pants suits for autumn newborn kids wear costume ( 10.16 $)
2pcs Silicone Thumb Grip Cap for PS4 / Xbox 360 ( $0.48 )
Discounts! best beauty products in the world
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).
READ MORE
2016 new men's fashion business travel shoulder bags,men messenger bags,pu leather briefcase men,men bag free postage ( 25.90 $)
8a brazilian virgin hair with closure 3 brazilian straight human hair weave bundles with closure rosa hair products with closure ( 51.00 $)
VVS SShA pozhalovalis na rossijskih pilotov v nebe nad Siriej
XuanWheel X1 Colorful Bicycle Wheel Spoke Light-62.35 $
Fashion autumn dresses women hoodie dress pocket long sleeve mini dress casual dress women clothing vestidos ( 14.52 $)
Kabden 3804 4L Men Multifunctional Fashionable Canvas Single Shoulder Bag 19.99$
Adjustable DC Regulated Power Supply DIY Kit (0 - 30V, 2mA - 3A) ( $9.76 )
2016 new synthetic wigs long wave body black hair wig for african americans women free shipping ( 18.88 $)
Pharmaceutical cosmetics and medicines at manufacturers ' prices with delivery in Russia in the online store creation
Jacquard Siamese sack netting perspective sexy one-piece fishnet stockings stockings sexy lingerie suit exotic apparel accessory ( 3.78 $)
WEIDE WH-1104 Multifunctional Japan Movt Male Military Watch-9.52 $
Skinny White Leather Belt ( 132.00 $)
2016 New Girls Clothing Sets Dress + Short T shirt 2 Pcs Set Summer Kids Clothes Fashion Girls Clothes Knitted Children Clothing ( 9.48 $)
Fashion Women Drawstring Backpack Diamond Lattice Geometry Quilted Ladies Backpack Sac Bag For Teenage girl Bao Bao School Bags ( 53.72 $)
NEW Baby Flannel Set Winter Girl boy Cartoon animal Suit Super Thick Warm Coat+Pants+Clothing (Three Piece Sets)Velvet Clothes ( 28.77 $)
Discounts! beauty product websites
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).
READ MORE
Kali - Murano Glass Charm Pendant Necklace ( 78.00 $)
Screw Decorated Gold Plated Tie Clip ( 61.00 $)
Sterling Silver Detachable Charm Bracelet ( 93.00 $)
Ograff men messenger bags genuine leather bag casual small business vintage luxury handbag designer shoulder crossbody bag men ( 40.98 $)
Junsun 2016 car camera dual lens rearview mirror dvr full hd 1080p recorder video registrar camcorder night vision black box ( 87.55 $)
16pcs SB417A Electric Brush Heads ( $8.32 )
Serseya Lannister
HL - 69 Soil Humidity Moisture Detection Sensor Module with Dupont Wires (Arduino Compatible) ( $3.14 )
YY610 Bicycle Cycling Anti-theft Alarm ( $6.82 )
Ulefone Tiger 4G Phablet ( 89.99 $)
Aevogue newest alloy temple sunglasses women top quality sun glasses original brand designer gafas oculos de sol uv400 ae0269 ( 13.98 $)
2015 new fashion genuine leather bags tote women leather handbags women messenger bags shoulder bags hot vintage bags popular ( 69.00 $)
Chuwi Vi8 Plus Tablet PC-92.71 $
Brazilian virgin hair straight 7a virgin brazilian straight hair 4 bundles mink brazilian straight virgin human hair bundle deal ( 76.80 $)
Summer women european t shirt 2016 vibe with me print punk rock fashion graphic tees women ( 6.40 $)
0 user(s) are reading this topic
0 membro(s), 0 visitante(s) e 0 membros anônimo(s)