Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

Help po about inserting int data in php

ScreamAimsFire

Proficient
Advanced Member
Messages
228
Reaction score
13
Points
38
Help naman po kung paano mag add/insert ng data sa php na converted na sya, like mag iinput ako ng meter(m) sa field then pag inadd ko na po sya dalawa po silang papasok sa db yung isa ay original na meter at yung isa naman ay converted sya sa kilometer(km)

ex: nag input po ako ng 2000/m pag pasok nya sa db papasok sya sa meter row and converted kilometer row which is 2km.

sana po may makatulong and makapag bigay ng idea sa ginagawa ko ive tried searching pero diko po alam kung ano tamang key word sa hinahanap ko.


Thank you and God bless po.
 
Hindi muna man kailangan mag save ng dalawa. Kahit isa lang, yung meter lang. Basta meter ang ipasok mo ay integer type. Pag ilalabas muna


Pag may loop
Echo $row[$i]["meter"]."meter";
Echo $row[$i]["meter"]/1000."kilometer";

Or ito pag single data

Echo $row["meter"]."meter";
Echo $row["meter"]/1000."kilometer";


Kung e sesave mo ng converted na

$meter = $_post["meter"];
$kilometer= $meter/1000;
 
Last edited:
ty po sa info sir pero need ko po kasi dalawa silang maipasok ko sa db, yung ininput ko na value tapos yung converted po sana. pwede po sample code sir kung pano ko po sya gagawin salamat ng marami
 
ito na yun,

yung na input mo $_post["meter"]

$meter = $_post["meter"]; //yung na input mo na meter
$kilometer= $meter/1000; // divide mo by 1000 is equal to kilometer

pwede munang ma insert yan.

$query = mysqli_query("INSERT INTO table_name (meter, kilometer) VALUES ($meter, $kilometer) ");
 
ito na yun,

yung na input mo $_post["meter"]

$meter = $_post["meter"]; //yung na input mo na meter
$kilometer= $meter/1000; // divide mo by 1000 is equal to kilometer

pwede munang ma insert yan.

$query = mysqli_query("INSERT INTO table_name (meter, kilometer) VALUES ($meter, $kilometer) ");

Thank you po sir sa idea.
 
Back
Top Bottom