Jump to content

Recommended Posts

if you set the default to current_time/NOW() it should be fine

 

mysql_connect(localhost,$username,$password);

@mysql_select_db($database) or die( "Unable to select database");

$query="SELECT * FROM Events ORDER BY timestamp DESC LIMIT 10";

$result=mysql_query($query);

$num=mysql_numrows($result);

 

i use this, and it works and echo's everything fine when i used the query

 

SELECT * FROM Events

 

but doesnt work with the new query despite me having a timestamp field in my database having the default as timestamp i checked my databse and when i add an entry the timestamp is added so im not sure whats going wrong

if SELECT * FROM Events ORDER BY timestamp DESC LIMIT 10 works why are you using  SELECT * FROM Events  ?

 

sorry i meant it to mean it doesnt work... but when i used Select * From Events it works fine.. so theres a problem with the query

 

ive solved this now though using a different method..i have a field for ID which is set to auto increment so just changed it to display the 10 highest ID's (which are obviously the most recently added events)

 

thanks for the help though much appreciated!

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.