Jump to content

Query won't work- but when tested in phpmyadmin, it fetches results.. ?


kernelgpf

Recommended Posts

Very simple code-

 

$tdate=date('h:00:00');
$tday=date('Y-m-d');


$queryed=mysql_query("select bondID,requestingdragon,requesteddragon,outcome from dragonsbonding where endbondingtime='$tday tdate'")or die(mysql_error());
$number=mysql_num_rows($queryed);

 

I've already got a connection to the DB, and tested the variables by printing them out- they are what they should be, and when I test this query in the DB with what the variables are supposed to be, the query fetches results.. but in my script, $number == "0", and I can't figure out why.

 

Any opinions/ideas? Thanks!

<?php
$tdate=date('h:00:00');
$tday=date('Y-m-d');
$queryed=mysql_query("select bondID,requestingdragon,requesteddragon,outcome 
from dragonsbonding where endbondingtime='$tday $tdate'")or die(mysql_error());
$number=mysql_num_rows($queryed);
?>

<?php

$date=strtotime(date("y-m-d h:i:s"));
$queryed=mysql_query("select bondID,requestingdragon,requesteddragon,outcome 
from dragonsbonding where endbondingtime='$date')or die(mysql_error());
$number=mysql_num_rows($queryed);
?>

 

<?php
$date=strtotime(date("y-m-d h:i:s"));

echo date("y-m-d h:i:s" ,$date);
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.