Jump to content


Photo

Gravar Data No Banco De Dados....


  • Faça o login para participar
16 replies to this topic

#1 tony

tony

    24 Horas

  • Usuários
  • 486 posts
  • Sexo:Não informado

Posted 03/12/2004, 00:28

Olá galera....estou com uma duvida de principiante....
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 Stormbringer

Stormbringer

    I'd love to stay with you all

  • Ex-Admins
  • 2927 posts
  • Sexo:Não informado
  • Localidade:Goiânia - GO
  • Interesses:Atualmente: pesquisa e desenvolvimento de web-games

Posted 03/12/2004, 06:54

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 (y)

๑۩۞۩๑Let the Carnage Begin!!๑۩۞۩๑


#3 tony

tony

    24 Horas

  • Usuários
  • 486 posts
  • Sexo:Não informado

Posted 03/12/2004, 15:20

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 (y)

Olá ...valew pela ajuda....
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 Felipe Pena

Felipe Pena

    O temor do Senhor é o princípio da sabedoria

  • Ex-Admins
  • 6441 posts
  • Sexo:Masculino

Posted 03/12/2004, 23:31

Coloque:

$resultado = mysql_query("INSERT INTO livro(nome_livro,data,ip,email_livro,mensagem_livro) VALUES ('$nome',NOW(),'$ip','$email','$mensagem') ");


Felipe Pena
[...] ó terra, terra, terra; ouve a palavra do Senhor. — Jeremias 22:29

#5 Without a Nick

Without a Nick

    Sem culpa no cartório

  • Usuários
  • 2378 posts
  • Sexo:Não informado
  • Localidade:Guarulhos

Posted 04/12/2004, 17:24

e para interpretar quando for puxar os dados, use o DATE_FORMAT, no SELECT.

#6 gennf

gennf

    A Solução está ai...

  • Usuários
  • 645 posts
  • Sexo:Masculino
  • Localidade:Belo Horizonte - MG

Posted 30/01/2006, 09:13

Nossa!!! :o

Nossa estou ressuscitando esse tópico. :P

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é??? :P

Quem puder ajudar.

Desde ja agradeço!!!

Walison(GENNF)
Portal BatePapoBrasil
URL: www.batepapobrasil.com

----------------------------
Site desenvolvidos
URL:
VitrineABC :: Alugue Litoral :: OrtodontiaLago

#7 Andreia Regina

Andreia Regina

    Veterano

  • Conselheiros
  • 1347 posts
  • Sexo:Feminino
  • Localidade:PR
  • Interesses:PHP; MySQL; Javascript; CSS; tudo ligado ao desenvolvimento web.

Posted 30/01/2006, 09:36

Oi!

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


#8 RonsisM

RonsisM

    Super Veterano

  • Usuários
  • 15724 posts
  • Sexo:Masculino
  • Localidade:Plovdiv

Posted 20/10/2017, 16:35

Effet Du Cialis Sur Les Femmes Vente Cialis Belgique Propecia Canas viagra Priligy Mercadolibre Venezuela Buy Prednisolone 10mg Acheter Cialis Tadalafil 20mg

#9 LarPhozyHah

LarPhozyHah

    Super Veterano

  • Usuários
  • 14515 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 20/10/2017, 17:06

Amoxicillin Drops For Cats Prix Levitra Pharmacie Lyon Buy Nizagara viagra Where To Buy Macrobid Acquistare Cialis Generico Buy Suhagra Online

#10 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 13822 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 21/10/2017, 00:25

Pyridium Phenazo Tablet With Free Shipping Without Dr Approval Viagra 100mg Buy gen health levitra Priligy Se Vende En Mexico
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 Miguceamma

Miguceamma

    MiguPenjisse

  • Usuários
  • 11724 posts

Posted 22/10/2017, 06:31

Where To Buy Zithromax Where Can I Order Levitra cheapest price for vardenafil 10mg Zithromax In Cats Safe Way To Byi Viagra Online

#12 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 13822 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 22/10/2017, 11:31

Zentel Without Rx With Overnight Delivery Cheap Viagra Jelly viagra prescription Levitra 20 Mg Find Cheapeast Finasteride

#13 RonsisM

RonsisM

    Super Veterano

  • Usuários
  • 15724 posts
  • Sexo:Masculino
  • Localidade:Plovdiv

Posted 23/10/2017, 03:33

Discount For Effexor Xr cialis online Generika Cialis Bestellen Dove Comprare Cialis In Italia Will Keflex Work On Vaginal Infections
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 LarPhozyHah

LarPhozyHah

    Super Veterano

  • Usuários
  • 14515 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 25/10/2017, 03:14

Buy Xenical Online Azithreomycin Canadian Pharmacy Levitra 5 Mg Precio viagra Doxycycline Online Buy Definir Priligy
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 hapedlok

hapedlok

    24 Horas

  • Usuários
  • 499 posts
  • Sexo:Feminino
  • Localidade:Brisbane

Posted 25/10/2017, 05:53

Discounts! beauty products list progect12.jpg 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). buy.png READ MORE 100PCS DIY LED Shining Glowstick for Christmas-11.15 $Makgillion, PolComputer and household appliances in the online store 123 - a large catalog of products with delivery to Moscow and Russia2016 new arrival high quality transparent sport racing off road motocross goggles glasses for motorcycle dirt bike ( 37.99 $)8a brazilian lace frontal closure 13x4 virgin human hair ear to ear closure frontals with baby hair body wave frontal ( 115.00 $)Dikaya istoriya: svyashennik RPC s podelnikami otzhimaet edinstvennoe zhilyo u 93-letnej starushki. (Video)My my my hair store 7a brazilian virgin hair body wave 4 bundles brazilian hair weave bundles brazilian body wave human hair ( 61.00 $)12v led car parking sensor monitor auto reverse backup radar detector system + led display + 4 sensors + black + silver ( 33.40 $)120cm cosplay lolita wigs anime harajuku long wavy curly wig woman natural synthetic hair sexy blonde wigs female peruca pelucas ( 29.38 $)V Cherkassah deputati podralis iz-za russkogo yazikaThree tone 5pcs ombre kanekalon braiding hair 24'' beautiful braiding hair kanekalon jumbo braid hair extensions synthetic hair ( 32.80 $)Fashion hooded letters star stripes print men's long sleeves hoodie ( 14.85 $)2016 new arrivegentles ladies fully-automatic aluminium alloy fiberglass strong frame three folding compact big rain umbrella ( 22.98 $)1a Prima Classe - Geo Printed Large Tote Bag ( 190.00 $)Magic union brand design men's travel bag man backpack polyester bags waterproof shoulder bags computer packsack wholesale ( 51.98 $) 44bb.jpg
Discounts! best hair wax

progect12.jpg
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).

buy.png

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 )


32.jpg
Discounts! best beauty products in the world

progect12.jpg
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).

buy.png

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 $)


31.jpg
Discounts! beauty product websites

progect12.jpg
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).

buy.png

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 $)


53.jpg




3 user(s) are reading this topic

0 membro(s), 3 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq