Jump to content

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


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);
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.