how do I get all the records for latest date. The date filed in my db is called recordEntryDate and it is in this form 2010-01-26 13:28:35
Lang: php
DB: mysql
I have searched through the google and also joomla forums but didn't got what exactly I was looking for.
My main purpose is to set the joomla session live for ever.
Many forums says its not good to keep a higher value (security issues) but I don't want to consider that right now.
My question is :
What if I set the session lifetime value to "0" (Zero), will the session be active for ever? or the user will NOT be able to login completely?
Thanks,
Tanmay
Hi everyone,
What do I need to do to call $this-two() from inside my function innerOne? Is that possible with PHP OOP?
Here's the error I am recieving:
Fatal error: Using $this when not in object context
Here's how my code looks:
class myClass {
function one(){
function innerOne() {
// Some code
$this->two($var1, $var2);
}
// Some code
innerOne();
}
function two($var1, $var2) {
// Does magic with passed variables
return $var1 . $var2;
}
}
Thanks a lot!
How would I go about ensuring that the overridden parent method exists before I call it?
I've tried this:
public function func() {
if (function_exists('parent::func')) {
return parent::func();
}
}
However the function_exists never evaluates to true.
I maintain an application where users are able to store images, and then share them. The system is powered by MongoDB at the back end. Most of the image depiction pages are cached as flat HTML files, but I can run some code just before loading the file.
I've decided to implement a view count for the system. I am wondering what is the best storage place for that. It should be like Memcached but it should save the viewcounts every hour or so, so even if our server has to be restarted we won't lose the view counts.
What is the best solution for that (preferably with a PHP extension as a client)?
I am trying to run cimyadmin(http://cimyadmin.net/) but i am getting a lot of helper depreciation errors and after looking around the web for answers i am convinced its a php issue.Is there a way to run php 5.0.2 or earlier but not less than php 5 code on latest distributions of php.
I'm trying to take a query:
SHOW TABLES;
which will display a bunch of tables with the chat_ prefix. I want to remove the chat_ prefix from the string, format the variable (with a link), and display it. How is this accomplished?
Hi,
I've inherited a project which we are trying to migrate to MySQL 5 from MySQL 4.0(!) and from myISAM to InnoDB. Queries are now falling down because they are being constructed using an ADODB connection's -qstr() on all parameters, including ints. Where no value is provided I end up with:
INSERT INTO tablename VALUES ('', 'stuff'...)
where the first column is an auto_increment. This causes an error (fair enough since '' isn't an int). Is there a switch in MySQL to make it behave as it used to (I assume it just silently converted to 0?)
Thanks.
I Have to calculate date time difference how to do that in PHP.
I need exact hours , mins and secs. any body have the scripts for that please give me :-P
I'm using wordpress, and I want to add the adsense javascript tags where the Read More tag goes in a blogpost. It's stored as <!--more--> in the database, but when you use the_content() this is automatically changed before I have the chance to use a str_replace() function.
I'm looking to place an adsense tag for each post in the single.php page where the teaser ends. Has anyone been able to do this?
I'm using this php code. but it's giving error
Deprecated: Function eregi() is
deprecated in
C:\xampp\htdocs\fuel\emailcheck.php on
line 7
<?
include_once("mastersecure.php");
$emailcheck=$_POST["member_name"];
function isValidEmail($email){
$pattern = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$";
if (eregi($pattern, $email)){
return true;
}
else {
return false;
}
}
if (!isValidEmail($_POST['member_name'])){
echo "The email is invalid!";
}
else
{
$query="select email from fuel where email='$_POST[member_name]'";
$res=mysql_query($query);
$rowcount=mysql_num_rows($res);
if($rowcount!=0)
{ echo "This mail is already exits"; }
}
?>
Any solution for this?
What I'd like is for this class
class Car {
public function __construct(Engine $engine, Make $make, Model $model)
{
// stuff
}
}
Get an array that has the types needed to construct this car (Engine, Make, Model) in the order they are needed for the constructor. I'm using this for a Dependency Injection-esque thing I'm making.
I am new to PHP & want to we send email from localhost to my gmail address.
I used:
$to = "[email protected]";
$subject = "Account Confirmation";
$headers = "From: [email protected]";
$message = "Testing";
$mail = mail($to, $subject, $message, $headers);
if ($mail) {
echo "Mail sent.";
} else {
echo "Some Error occur.";
}
And it show Some Error occur.
please help.
Thanks
?
username:
';
}
else
{
$user=$_POST['user'];
$query="select name from login where name='$user'";
$result=mysql_query($query) or die(mysql_error());
$rows=mysql_num_rows($result)or die(mysql_error());
session_start();
//echo "results";
$username=mysql_fetch_array($result) or die(mysql_error());
$fields=mysql_num_fields($result) or die(mysql_error());
echo "username:$username[0]";
$_SESSION['username']=$username[0];
$sesion_username=$_SESSION['username'];
//echo "rows:$rows"." "."fields:$fields";
echo""."username:$sesion_username";
}
?
i wanted to create a site where user can login and upload their details depending on their user name have stored their details in a database,the problem i am facing is two people 'a' and 'b' login one after other session_variable $_SESSION['username'] will have 'b's' username ,so i can't display 'a's' details now. . . .
what i want to achieve is when a user logins in i want to store his name and other details in session variable and navigate him according and display his details
I am trying to manage seasonal prices for hotel rooms.
The only way that I can think of doing it would be to use:
| DayDate |EndDate | A | B
-----------------------------------------------
| 2010/07/1 |2010/07/2 | 200 | 40
| 2010/07/3 |2010/07/4 | 150 | 40
| 2010/07/5 |2010/07/5 | 150 | 50
| 2010/07/6 |2010/07/7 | 200 | 50
| 2010/07/8 |2010/07/9 | 100 | 60
etc.. (table taken from another question).
The problem is: I don't want my seasons to be year specific.
Seasons for rooms shouldn't change year on year. I don't want my users to have to enter the seasonal information several times.
I am also going to have thousands of rooms, so I don't know a way to make this easily manageable.
I'm using mysql and php.
Hey All.
Trying to create a 1-liner to loop through a mysql result set.
Example:
$sql = "SELECT uid, role FROM usr WHERE uid = '$this-uid'";
$r = db::q($sql);
if($r-rows()) {
$q = mysql_fetch_assoc($r-result);
while(list($k, $v) = each($q)) { // would like to omit line above and consolidate here
$_SESSION['usr'][$k] = $this->$k = $v;
}
}
problem is that consolidating while loop like so:
while(list($k, $v) = each(mysql_fetch_assoc($r-result))
returns an error a la each() not getting object or array, even though of course it is. I think the problem is a casting issue, but it does not seem you can do:
each( (array) mysql_fetch_assoc($r-result))
Any ideas? I like to code as tersely as possible, and having "$q = mysql_fetch_assoc($r-result)" everywhere will annoy me, does already.
Keep posted...
Thanks!
0 down vote
hi,
I have problem in showing $date="2011-02-10 15:26:20"; in the format of Thursday 10th of February 2011 03:26:20 PM in php.
i know there is one date function in php and can be done in one line for example: but via this it will flash today date or so.
i want to do it when user check any date and want that date in the format which i mention earlier.
please revert me back as soon as posib....
thanks
How does one provide a direct URL for an image file (JPEG) that is secure?
For example, if a PHP script writes uploaded images to directory http://www.somehost.com/images, is it okay to provide http://www.somehost.com/images/someimage.jpg as the URL, or is there a more secure way to do this?
Should I look into something like the permalink feature that is a part of Wordpress? I am not sure if that is related.
The main reason I ask is that I have a custom PHP/MySQL CMS for managing images. I would like for the client to be able to copy a link to the image they want and then include it in a TinyMCE text editor for inserting the image in their website.
Thanks!