Selasa, 13 Agustus 2013

PHP Indonesia - Facebook: HAI,, WHEN I USING THE BELOW SCRIPT FOR INSERTING ...

PHP Indonesia - Facebook
PHP Indonesia is a community for everyone that loves PHP. Our focus is in the PHP world but our topics encompass the entire LAMP stack. Topics include PHP coding, to memcached handling, db optimizations, server stack, web server tuning, code deploying, hosting options and much much more. Youtube Channel : http://www.youtube.com/user/OurPHPIndonesia Twitter : @php_indonesia NOTE: Rules for Wall posting: https://www.facebook.com/groups/35688476100/doc/10151597056316101/ Daftar Keanggotaan : http://www.facebook.com/groups/35688476100/doc/10150671770741101/ 
HAI,, WHEN I USING THE BELOW SCRIPT FOR INSERTING ...
Aug 13th 2013, 12:25, by Renu Philip Puthenpurackal

Renu Philip Puthenpurackal 12:25pm Aug 13
HAI,, WHEN I USING THE BELOW SCRIPT FOR INSERTING VALUES INTO THE DATA BASE THE NUMBER "1" IS INSERTED IN DATA BASE,WHY..? NO OTHER VALUES DONOT ENTER INTO THE DATA BASE
<?php
$con=mysql_connect("localhost","root","") or die (mysql_error());
mysql_select_db("hotel",$con);
$name=isset($_POST['name']);
$sub=isset($_POST['subject']);
$email=isset($_POST['email']);
$phone=isset($_POST['phone']);
$comment=isset($_POST['inquiry']);
if(isset($_POST['submit']))
{
$sql="INSERT INTO contact(name,subject,email,phone,comment) VALUES('".$name."','".$sub."','".$email."','".$phone."','".$comment."')";
$result=mysql_query($sql);
if($result)
{
echo "<script type='text/javascript'>javascript:alert('message send.');
window.location='contact.php';</script>";
exit;
}
}
mysql_close($con);
?>

M Anggi Perdana 12:31pm Aug 13
. is problem

Gunawan Mujur Wibisono 12:37pm Aug 13
isset is the problem.. isset is conditional not return string...
btw.. USE mysqli

Imam Bazoka 12:39pm Aug 13
check your variable, or replace your code as below.
<?php
$con=mysql_connect("localhost","root","") or die (mysql_error());
mysql_select_db("hotel",$con);
$name=$_POST['name'];
$sub=$_POST['subject'];
$email=$_POST['email'];
$phone=$_POST['phone');
$comment=$_POST['inquiry'];
if(isset($_POST['submit']))
{
$sql="INSERT INTO contact(name,subject,email,phone,comment) VALUES('$name'','$sub','$email','$phone'','$comment')";
$result=mysql_query($sql);
if($result)
{
echo "<script type='text/javascript'>javascript:alert('message send.');
window.location='contact.php';</script>";
exit;
}
}
mysql_close($con);
?>

Yoshua Joo Bin 12:51pm Aug 13
isset returns boolean, it gives you either 1or 0.

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions

Tidak ada komentar:

Posting Komentar