|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Ok, I have 2 tables in my database, and I'm adding entries to them like every day or so, and I want to know how can I print the newest additions to the database (for say, last week, or even better - using cookies, since the last visit) on the front page, and for each table too...?
Anyone know the syntax for that, cuz I'm really new to all this mySQL stuff. |
|
#2
|
|||
|
|||
|
If you don't have some sort of date field, you can't.
This question is way to general. You need to tell us your table schema. |
|
#3
|
|||
|
|||
|
That's what I thought, without a date field it can't be done...
let me see if I can add the date in database and I'll get back to you guys.. |
|
#4
|
|||
|
|||
|
Ok, I gave up on that date function for the time being... but I have another task:
If my table looks like this: --------------------- id|filename|url|size --------------------- and I want to pull out the total number of entries from that table (the highest ID), what should I do, what would the syntax be? |
|
#5
|
|||
|
|||
|
The highest ID and the number of rows (entries) may or may not be the same thing. If you want the highest ID use:
select max(id) as max_id from tablename; If you want the number of records: select count(*) as num_rec from tablename; |
|
#6
|
|||
|
|||
|
Shoot, I messed up something... how do I add that to my PHP3 files (regular HTML)...
I have all my database info (name, password, tablename) stored in the config.inc file already, that is included in the PHP file, and how do I print this with the rest of the HTML code now? I can't just go echo "select count(*) as num_rec from tablename"; [This message has been edited by fantom (edited October 01, 2000).] |
|
#7
|
||||
|
||||
|
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
<?php $result = mysql_query("select count(*) as num_rec from tablename"); $row = mysql_fetch_array($result); echo "The total number of entries is " . $row["num_rec"]; ?> [/code] [This message has been edited by SepodatiCreations (edited October 02, 2000).] |
|
#8
|
|||
|
|||
|
Appreciate it very much...
|
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > Database Question.... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|