Try looking at Inner join and count()

http://www.w3schools.com/sql/sql_join_inner.asp

ribrahim commented: Thank you for the link +0

WOW thats it? holycow im stuck on that for 2 days and you answered it very casually with

Yes exactly put line 17-18 inside while loop.

Where are you d past days men?heheheh

ITs WORKING FINE NOW!!!

THANKS ALOT

NEIL:)

happygeek commented: Tell your friends :) +13

Got it! Line 45 is the one causing the problem..i just remove that line and everything working fine.

jkon commented: It says that I answered that one but you did. +1 because you answered the questions (although the error was in the use of this external class) +8

Hi as cereal been pointing out you just need to add your "phpmailer " /sending code on your form action like

<form action="phpmailer.php" method="post">

after that you need to pass the data from your form to the phpmailer.php script that you wrote like this

<?php
require 'PHPMailerAutoload.php';

//======= this is the data form your form====
$name=$_POST['name'];
$email=$_POST['email'];
$website=$_POST['website'];
 $query=$_POST['query'];
//===========end=======

$mail = new PHPMailer;
//$mail->SMTPDebug = 3;
$mail->isSMTP();
$mail->Host = 'localhost';
$mail->SMTPAuth = true;
$mail->Username = 'reply_office@---.com';
$mail->Password = '---';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->From = 'reply_office@---.com';
$mail->FromName = 'Mailer';
$mail->addAddress('office@---.com');
$mail->isHTML(true);
$mail->Subject = 'Here is the subject';
$mail->Body    = 'My name is $name. you can send me an email at $email and visit my webpage at $website and my asdfghj is $query';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
    echo 'Message has been sent';
}

?>

after you made the changes you are ready to Go.

can you run this script?

<?php
echo phpinfo();
?>

please read http://php.net/manual/en/function.date-diff.php to better understand why you are getting that error message. Another thing your date_default_timezone is not correct please refer to this list for the correct timezone.

ronjacob012 commented: will help you as soon as possible +0

hi check your form action you are sending your data in a .html file try making a .php file

Hi one simple solution is use windows.confirm javascript just put your delete query inside the js like

<script>
    if (window.confirm('are you sure you want to delete this data?')) {

    .. your delete query    
    }else{
    do anything
    }
</script>

Hi you can use a condition statement inside your query that check whether your row contain the data that you wanna count..

SELECT
  COUNT(DISTINCT CASE WHEN approved = '0' THEN  id END) 'zero',  
  COUNT(DISTINCT CASE WHEN approved = '1' THEN  id END) 'ones'
FROM business_details

Hi Try something like this

$mysql_hostname="localhost";
$mysql_database="";
$mysql_user="";
$mysql_password="";

$con = mysqli_connect($mysql_hostname,$mysql_user, $mysql_password, $mysql_database);

$name=trim(mysql_real_escape_string($_POST['name']));

$sql=("CREATE TABLE IF NOT EXISTS `$name` ( `sender` varchar(30), `message` varchar(300), `dateposted` date )");

if (mysqli_query($con,$sql)) {
  echo "Table $name created successfully";
} else {
  echo "Error creating table: " . mysqli_error($con);
}

and refer to this link

Got It..

I use IF statement inside the query like this

SELECT  SDate,
    SUM(IF(Payment_type = 'Cash', Grand_total, 0)) AS 'Cash', 
    SUM(IF(Payment_type = 'Credit', Grand_total, 0)) AS 'Credit Card', 
    SUM(IF(Payment_type = 'Bill', Grand_total, 0)) AS 'Bill', 
    SUM(Grand_total) AS Total FROM info WHERE SDate BETWEEN '2014-05-18' AND '2014-05-19' GROUP BY SDate

Hi if your gonna insert new data in the db why are you using UPDATE query?

you need to use INSERT query like

$query= "INSERT INTO studio(name,phone,`date`,time_from,time_till,studio) VALUES ('$name','$phone','$date','$time_from','$time_till','$studio')";

also mysql_real_escape_string is already deprecated refer to this link and you better use mysqli or pdo for the same reason

ok no prob..the array is not really the issue but my IF and OR statement

this part or specifically the $service

if ((in_array($destination, $destination_10_to_12km_away) && ($branch=="Davao International Airport") && ($service=="Transfer In") || ($service=="Drop Off") && ($vehicle=="Vios")))

the correct statement is this one

if(in_array($destination, $destination_10_to_12km_away) && ($branch=="Davao International Airport") && ($service=="Transfer In" || $service=="Drop Off") && ($vehicle=="Vios"))

notice the $service it is included in just one ( )

and also i just combine the two if statement in one

pritaeas commented: Thanks for sharing. +14

Geezz "sheepish" thanks pritaeas didn't notice that im so focus on the query itself that i didn't look on the whole script..now its working fine just need to integrate it to the actual page..

Hi double check this part

  • "" -make sure it has a opening and closing
  • ; - make sure you put it at the end of your variable and at the end of every echo

hi nevermind my first post i think this is what your looking for

<?php

$contact_name = $_POST['contact_name'];
$contact_email = $_POST['contact_email'];
$contact_text = $_POST['contact_text'];

if (!empty($contact_name) && !empty ($contact_email) && !empty ($contact_text))
    {
echo "ok";
} else{
echo "All fields are required.";
}

?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">

Name:<br><input type="text" name="contact_name"><br><br>
Email adress:<br><input type="text" name="contact_email"><br><br>
Message:<br>
<textarea name="contact_text" rows="6" cols="30"></textarea><br><br>
<input type="submit" value="send">
</form>

ok i got it
instead of this
if($origin=="NAIA 1" && $vehicle=="Vans" && $destination=="Manila" || $destination=="Cam Sur" || $destination=="Boracay" )

i put
if(($origin=="NAIA 1" && $vehicle=="Van") &&( $destination=="Manila" || $destination=="Cam Sur" || $destination=="Boracay" ))

and its working now..

pritaeas commented: Thanks for sharing +13