son.of.the.morning Posted August 30, 2010 Share Posted August 30, 2010 Hey, I want to selected the most recent update in my sql database, i am using this at the moment $sql="SELECT * FROM $tbl_name WHERE id='6'"; $result=mysql_query($sql); Which is just selecting the record that has the id "6" any suggestions...? Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted August 30, 2010 Share Posted August 30, 2010 What do you mean by "most recent update"? Is this something you're wanting to do immediately after inserting a new record? Quote Link to comment Share on other sites More sharing options...
son.of.the.morning Posted August 30, 2010 Author Share Posted August 30, 2010 No the insert new record is on a totally different page. I just want to selected the post recently added record. For example: if I added a new record to the database and went on the news page were i am trying to select a record it would show only the last record i inserted. Do you understand me? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted August 30, 2010 Share Posted August 30, 2010 You'd use the following query to grab the last record (most recent) SELECT * FROM $tbl_name ORDER BY id DESC LIMIT 1 Quote Link to comment Share on other sites More sharing options...
son.of.the.morning Posted August 31, 2010 Author Share Posted August 31, 2010 That worked like a charm, thanks allot man. I wonder if you can help me with a another php issue, i am going to be building a tutorial site and i want a search utility within it, how would i come about doing this? Quote Link to comment Share on other sites More sharing options...
jayarsee Posted August 31, 2010 Share Posted August 31, 2010 Though my personal bias is speaking, I would say the method of implementing full-text search for a website that strikes the best balance between accessibility to a PHP programmer and performance is the Search_Lucene component of the Zend Framework: http://framework.zend.com/manual/en/zend.search.lucene.overview.html Using this, however, would require spending some time learning how to implement the framework overall. If using a framework or external sever (like the original Apache Lucene) is not something you want to learn right now, the easiest option is to use Google Site Search: http://www.google.com/sitesearch/ Quote Link to comment Share on other sites More sharing options...
son.of.the.morning Posted September 1, 2010 Author Share Posted September 1, 2010 Am i able to format it the way i want though? Quote Link to comment Share on other sites More sharing options...
fortnox007 Posted September 1, 2010 Share Posted September 1, 2010 Searching for words in column of your table can be done with LIKE Just google it, I dont know the exact stuff by heart Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.