Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





List Last Entries On Database


I'm looking for a script that will list the last 20 entries from a mysql database, can anyone on the list help me ?




View Complete Forum Thread with Replies

Related Forum Messages:
Database Design For Multiple List Meny Entries
I have a database called nottsvcs with a design as follows:

refno (primary key)
organisation (char50)
telephone (char50
activities (list menu)**

My list menu of activities allows the user to pick more than one activity. My question is how do I change my db design to allow for storage more than one list menu selection?

View Replies !
List The The Entries Of The Dropdown Box
How can I list the the entries of the dropdown box (which are all populated) according to the time they are populated.

View Replies !
Multiple Entries In On Column/List Box
I'm creating a page where members can edit their research information. I'm going to have 12 List Boxes, each with about 20-25 words. I want the user to be able to choose as many as they need (by control+click) - and store them all in the database. I expect each member to only have about 4-5 .. but you never know.

The information they submit, all 4 or 5 or however many keywords, will need to be easily searchable on the main page. I also am going to need to make it easy for them to edit/update their keywords. My question is - which is the best way to do this? Do I dumb all the selected values into one column of a table? then when doing a search just do a text search?

And how do I implement the update page? I know how to show previous text in a text form field, but is there a way the options they chose can be pre-selected when they go to update their research?

View Replies !
Dynamic List Has Multiple Entries
On an input form there is a dynamic drop down list to select from a dozen different categories. The form inserts correctly into the database.

The problem is that every time a category is selected the drop down menu list it an additional time. For example if the list has: apples, pears, oranges. If pears is selected the drop down list will display: apples, pears, pears, oranges. Code:

View Replies !
Produce A List Of Tables Currently Within My Database And List Them In A Drop Down Box.
I need to produce a list of tables currently within my database and list them in a drop down box.

View Replies !
Deleting Entries In A Database
I've got the reading and writing to a database working but want to delete entries ..... how would this be done?

View Replies !
Extracting Database Entries
I have a non-profit's web site that wishes to allow their members to
fill out information regarding summer camp information (name, contact
info, mailing info, physician's name, etc) online and submit it. I can
handle taking the info with PHP and putting it into a mySQL database easily.

But what has me stuck is that they want the ability to print out hard
copies of selected submissions (their choice) if they need to.

Would I have to display all the database entries in a form on a new page
with a select box next to each entry and have them pick that way, then
loop through and print out the selected ones or is there a better, more
direct (read: easier) way to accomplish this?

Does this sound like something for which there may be a pre-written PHP
script that can be altered?

View Replies !
Array From Database Entries
All I need is to create an array with the results from a database column.

View Replies !
(PDO) Database Entries Are Not Possible, Even Without Errorfeedback!
I am trying to insert with PDO-Sqlite rows through a form. I can do
whatever I want, I don't find the sollution where I made the error.
Perhaps somebody of you could help me?!

However, the database is created with sqlite, and the entries should be
done with PDO_SQLITE. However, no entries are done anyways and I am one
step going nuts, specially because I don't receive no warning or
errormessage on the screen.

Code:

<?php
require_once('HTML/Form.php');
require_once('I18N/UnicodeString.php');
require_once('HTML/Table.php');

class Formular
{
private $ServerVar = array("Auswahl","Betreff","Eingabe");

function __construct()
{

$this->ServerVar["Auswahl"] = $_GET['Auswahl'];
$this->ServerVar["Betreff"] = $_GET['Feld'];
$this->ServerVar["Eingabe"] = $_GET['Eingabe'];
$this->MeinFormular();

//$this->sqdb();
if(($this->ServerVar["Betreff"] === null) or
($this->ServerVar["Eingabe"] === null))
{
$this->MeineDB();
$this->TextFeld();
}
elseif (($this->ServerVar["Betreff"] === "") or
($this->ServerVar["Eingabe"] === ""))
{
$this->MeineDB();
$this->TextFeld();
}

else
{
$Auswahl = $this->ServerVar["Auswahl"];
$Betreff = $this->ServerVar["Betreff"];
$Eingabe = $this->ServerVar["Eingabe"];
$this->MeineDB2($Auswahl,$Betreff,$Eingabe);
$this->TextFeld();
}

View Replies !
Edit The Entries In The Database
I have a script that allows you to edit the entries in the database. All is working fine except when you pull up an entry for editing the subject field only prints out the first word of the subject??? I know the entire subject line is in the database, but only this part of the script won't print it out. All the other fields work fine. Code:

View Replies !
Limit Entries In Database?
Im using a guest book script that uses a Mysql database. Id like to limit the number of entries it will save in that database to say, 100. I emailed the fella who wrote the script and he replied with:

Just make a simple if the id is bigger than 100 or how many entries you want ... then just redirect to the index page. I dont know a whole lot about PHP although Im learning and this is what Im trying which isnt working.

if ($id > 100){
echo "<meta http-equiv=refresh content=1; url=http://www.mysite.com/blah>";
}

View Replies !
Comparing Database Entries
I have two table in a database, one with products one with reviews. The reviews are linked to the product via a unique id but I'm looking to write a script which can see if a product in the database has been reviewed or not but I hit a "coders block" . I was going to use a loop to see if the id in the review table matched any in the products table but I would prefer the script to only show the ones which haven't been reviewed and so that would not be the best way since it would chuck out a 'False' every time it didn't match up.

View Replies !
Show Last 5 Database Entries
I just set up a database with tutorials (id, title, description, image, url, cat)
id is auto_increment, so the highest id should always be the last tutorial. I want to show the last 5 tutorials on a page, so I tried to use this: PHP Code:

<?php
include("connect.php");
$sql=mysql_query("SELECT * FROM tutorials ORDER BY id DESC LIMIT 0,5") or die(mysql_error());
$x=0;
while($row=mysql_fetch_row($sql))
{
echo ($x+1).')&nbsp;'.$row[title].'<br />'
$x++;
}
?>

But I got this output:
1)
2)
3)
4)
5)

View Replies !
Counting Entries In Database
I have a database with various fields... one of them is "region"

REGION
r1 = Scotland
r2 = North East
r3 = North West
etc etc

then on my html/php page i want to list the regions, then in brackets add how many entries there are in the database for that region.

Scotland (?)
North East (?)
etc etc

The question is how do I count how many entries for each region and then show the result.

View Replies !
Deleting Old Database Entries
I'm trying to make a code that searches a database to check for entries that are 3 months old and then erase them.

My problem is that I got no idea on how to make a variable that checks the current date so that I might compare it with the entry date, and also how should I make my If or While loop so that it works, I mean it's obvious that it must compare the two dates but how do this.

View Replies !
Preventing Multiple Database Entries.
I am trying to make my form processor detect if an item name submitted to the database already exists I would like to display a message saying the item is already in the db.

I tried something like this

if ($Item_Name == "$row["Item_Name"]") {

print "That item is already in the database";

}

Now I know this is wrong but if someone could point me in the right direction it....

View Replies !
Don't Display Duplicate Database Entries?
I have a restaurants database that has a lot of restaurants listed with the same name in the same city with only the category changed. This is the code that I have that displays the list of restaurants. Can someone tell me what to add to it so that it will only display one of each restaurant of a certain name? PHP Code:

View Replies !
Fastest Way To Print All Database Entries?
Say I have a database with 1000 entries. What's the fastest, dirtiest way to do that.. Like this? PHP Code:

View Replies !
Output Database Entries In A Table
I'm trying to display the entries in a table of two columns, one entry per table cell - in other words, two entries per row, number of rows based on number of entries in the database. But it still doesn't seem to work. It displays one entry per row... I don't know where the problem is. Here's my code:

View Replies !
Get Some Data From A Database And Then Add All Of The Entries In Each Column
Im trying to get some data from a database and then add all of the entries in each columb to get the total for each columb.  I tried it with the following code but got the error: Warning: Invalid argument supplied for foreach() Code:

View Replies !
How Do I Display All Database Entries Between Two Dates
I have two dates in a form " startdate" and enddate"

when i display the results i would like to show all results between, and including the two dates. how do i do this... this is my current query:

My Variables:

$userid = $_GET['idr'];
$fromdate = $_GET['fromdate'];
$todate = $_GET['todate'];

The query:

$result = mysql_query("SELECT date, status, time, notes FROM timeclock WHERE userid='".$userid."' ORDER  BY time");

View Replies !
How To Delete Multiple Entries From Database?
I ran this script Im working on twice by accident which caused a ton of duplicate entries. I dont want to start over so how would I delete multiple entries in a database?

View Replies !
Select Entries From A Database Where The First 3 Characters
I want to select entries from a database where the first 3 characters of one of the fields (title) are equal to 'BMX'. Is there a way of doing something similar to this as a query?: PHP Code:

substr($row['title'],0,3);

View Replies !
Getting Form Entries To Mysql Database
Here's the scoop after 2 days of screaming profanities at my monitor I need Help... I built a web form looks good but worthless...I also set up a msql database with a table and all the rows I need using mysql admin also worthless unless I get the entries from the form to save to the database. I have tried a hundred different scripts and variations thereof. Warning I am a real estate agent not a computer whiz so the php and mysql documentation is like reading a dead language the jargon is useless to me....

View Replies !
Splitting Articles / Database Entries
Sometimes when I read websites they split their articles over multiple pages. Now that I'm doing my own site I'd like to do this with my lengthier articles. What I want to know is how people would approach this with respect to the PHP/mySQL side of presenting the information? How would you decide how many pages to split the article into and how would you actually split it so that the user can click page 1, 2, 3, or n ?

View Replies !
INSERT Adding Too Many Entries To Database
I have the following code to add an entry to my visitors table to track referers and what pages they visited, etc.

$sql_ref_update = "INSERT INTO visitors (refdate, referer, refpage, refip) VALUES ('$refdate', '$referer', '$refpage', '$refip')";

if(!mysql_query($sql_ref_update)) die(mysql_error());

I just found that when I do this, where I expect one entry to the databasae, I'm getting three (two of which have are the same IP). I'm assuming that the second IP I'm getting might be a firewall or caching server but why two entries for the one IP on one visit?

UPDATE: I found that one of the IP "visitors" is caused by the Google toolbar being on. I didn't know that the toolbar counted as a referer. Why is this? Is this well known because I didn't know about this until now.

View Replies !
Averaging Entries In A MySQL Database
I have an array of numbers in one column of my mySQL database. I've extracted them into an array. How do I find and display the average and total of all of them?

View Replies !
Getting Data From Database - Entries Not In Right Format
I am running an online job search site and employer are able to post their job vacancies under multiple categories.

Example - Accounting,Administrative,Hospitality
The example above is taken from the category table in the database.

The problem is, I am trying to create a script that lists al the jobs available in each category and its not listing the jobs that employers have selected multiple categories, its only listing the jobs that have been added into only one category. Code:

View Replies !
Save The Checked Entries To Database.
I have checkboxes in my script and i need to save the checked entries to my database.
i made the checkboxes an array. the problem is, when i try to print the array, what prints is the name of the array itself and not the content of the array. here's the code:

$check_entries=array();
$check_entries=$_POST["check_entries"];

$check_count = count($check_entries);
print($check_count);

for($a=0; $a<$check_count; $a++)
{
print($check_entries[$a]);
}

output:
check_entriescheck_entries.

View Replies !
Skipping Database Entries Using A Loop
I am using this code to read from a paper database and display the result in a dropdown menu in out website. What I am trying to do is skip the entries that have the resolution field less than 2880 (elseif($paper_types_4800[$x+5]) < 2880 in the code below).

I've gotten it to just echo blank spaces in the dropdown menu but they can still be selected and submitted. How to I skip these entries entirely in the dropdown menu? Code:

View Replies !
Update Multiple Database Entries
I want to make a quick to-do list script. I can handle entering the info, etc.

What I have a question about is when I go and view the list of to-do items, once they are complete, I want to be able to mark them "Done"

So I'd have a list of all the items and a checkbox for each item. If 3 of 10 are done, I'd select the checkbox for those three, click the submit button and I'd like it to update one field for each entry.

So, I'd have todo_ID, todo_DONE and want to UPDATE todo_list SET todo_DONE = 1 WHERE todo_ID = '".mysql_real_escape_string($_POST['todo_ID'])."'

My question is how can I do this for multiple entries all at once?

View Replies !
Using Checkboxes To Update Multiple Database Entries
I have a query that shows a list of options that a user can toggle on
or off using a checkbox.

query...
form...
while($row = mysql_fetch_array($result))...
<input name="menu_show_attribute[]" type="checkbox"
class="checkbox"');
if ($row['menu_show_attribute'] == 1) {
echo (' value="'.$row[menu_id].'" checked />
} else {
echo (' value="'.$row[menu_id].'" />');
}

The list is generated from boolean values in a DB. This populates my
form with checkboxes, some are checked and others are not. I'm using
an if statement to sort it (checked). This works fine.

The problem is when the user un-checks a checkbox, the value does not
get passed and the DB does not update - set/change it to 0. The only
values that get passed are the checkboxes that are checked. Below is
the query / code after the submit button has been pressed. Are radio
buttons the answer? Any help / suggestions would be very much
appreciated.

//process form
for ($i = 0; $i < count($menu_show_attribute); $i++) {

if (isset($menu_id) == 'checked') {
$menu_show_attribute = 1;
} elseif ($menu_show_attribute != 'checked') {
$menu_show_attribute = 0;
}

$query = 'UPDATE menu SET menu_show_attribute = "'.
$menu_show_attribute.'" WHERE menu_id = "'.
$menu_show_attribute[$i].'"'
echo("<br>");
echo $query;
$result = mysql_query($query, $db) or die(mysql_error());
}

View Replies !
Archiving Versions Of Database Entries And Diff
I'm looking to change a database application so that when users make changes, a certain number of versions get archived so that users could potentially see previous versions and, preferably, get some diff output.

The goal is really to version one large text field, though I would probably archive the entire record from that table. Code:

View Replies !
Form Generating Blank Entries In Database
I have a form which will be used to add entries to an SQL database. However, when you load the page it generates a blank entry in the database (not just refresh but on initial page load too).

What's the best way to stop the submission happening on every page load so that only by clicking the button will an entry be created?

View Replies !
Text Formatting - Print Out Entries In A Database
im trying to print out entries in a database. it prints out okay but im having trouble formatting the text- changing colour, font etc. The following code works ok if i just use a variable, but it doesnt work here

echo "<td><font face="Verdana" color="#E5E5E5" font size="+4">{$row['productName']}</font></td> ";

View Replies !
Deleting Duplicate Entries From MySQL Database Table
The topic is related to MySQL database.

Suppose a table "address" contains the following records

-------------------------------------------------------
| name | address | phone |
-------------------------------------------------------
| mr x | 8th lane | 124364 |
| mr x | 6th lane | 435783 |
| mrs x | 6th lane | 435783 |
| mr x | 8th lane | 124364 |
-------------------------------------------------------

Quote:

View Replies !
Duplicate Entries - Check To See If When Someone Enters A Movie Into The Database
I have a sql table called MovieDB that has a column called 'name'. I need to check to see if when someone enters a movie into the database, if that movie already exists. if it does, i will not add it. It should be pretty simple. so far my code is

$duplicate = mysql_query("SELECT * FROM MovieDB where name='$name'");

Where $name is what the person enters into the form. Should this be in quotes? And what do I do with result to see if it returns anything?

View Replies !
Sort Results By Date/time, Limit 5 Database Entries Of Today &/or Upcoming Days
I'm designing a website for my fraternity and in the database I have entries which contain past events, todays events, and upcoming events.  My problem is that I can not figure out how to sort the query results to display:
 
1) only past events based on the CURRENT DATE
2) only the events which fall on the CURRENT DATE or after, limiting the results to 5 entries
3) all events that fall on CURRENT DATE or afterwards

Example:   
Today is  September 15, 2007

Problem 1) Displaying all events that happened before September 15, 2007
Problem 2) Displaying only 5 results that fall on September 15, 2007 or after
Problem 3) Displaying all events that are happening on or after September 15, 2007

And obviously I would like the CURRENT DATE to change depending on what date it is, currently.

Ok so now I've been very redundant in my explanation of my problem here is the code and a link to what that particular page looks like. Code:

View Replies !
Read Entries From DNS Servers And Ping The Entries
i need to build a script that will let the website i'm currently building to read entries from DNS servers and ping the entries to see if they're alive. the problem is i have no idea how to 'read the DNS entries'.

View Replies !
Selecting The Database Value In A List
I am doing a PHP website using Dreamveaver built in server behaviors, and am getting my hands wet on PHP now. I have a list of countries in a drop down menu list in a form. A user selects a country, and it is saved in the database.

now on the Edit Screen, I want to show the list of countries again to the user for any changes, but I want to pre-select the value that was selected originally, and was stored in the database.

so this time, the dropdown menu box should show the saved country by default, which could be changed. how do I do this in Dreamveaver. If it is not straightforward, please suggest the PHP code to do this, and I will try to update it myself in the code window.

View Replies !
Database Into A Drop Down List
I'm trying to pull data from my database and display this data in a drop down list. I have 3 drop down menus, when a sourcre is selected in the first menu. only the destinations available from that source should be displayed in the 2nd drop down and then the destinations of the next selection displayed in the 3rd drop down.

View Replies !
Select List From A Database
I'm trying to dynamically generate a html select list from a MS Access database using the code below:

<?php
$conn=odbc_connect('customer','','')or die('Could Not Connect to ODBC
Database!');

$queryexe="SELECT * FROM types";

$rs=odbc_exec($conn , $queryexe)or die("Query failed: $sql<br />Error:
".mysql_error()."<br />");

echo "<SELECT name="typeId">";
while(odbc_fetch_row($rs))
{
echo "<option>".odbc_result($rs,"typeId")."</option>";
}
echo "</SELECT>";
?>

View Replies !
Inital Value In List Taken From Database
I have a form in which i want to the initial value of a select box set so when the page loads it is already selected. The values in the list box are taken from a databse though and arent listed. Here's the code:

View Replies !
Autopopulate Dropdown List From Database
An events-registration page with a form containing a dropdown list for upcoming events, the events will be pulled from a table which is updated by...?

what i've gathered so far is that this can be done with PHP. I am a little unclear on the concept of how this is done. How does the updated information get input into the table?

1) can this be done (updating database) through a web interface by the client, or is it something i would have to do locally and then upload. If done by the client, can he delete/edit existing information--assuming he is not familiar with code.

2) what other things aside from html(good), sql(so-so), and php(newb) will i have to know?

i've seen a lot of good tutorials here and will have access to the necessary software. I just want to know if there is anything else i should know before i dive in head first without testing the PHP water, which i assume is frigid.

View Replies !
2 Drop Down List Where Need Query Database
there is drop down list box linked to the database where it displays the state of a country and once the user clicks on the particular state, there purpose to be radio button displaying the locations available of that state, the location displayed in radio buttons are from the database. currently the source code i'm using is (which uses a submit button to query the database but i does not want the submit button it purpose to work using Code:

View Replies !
Adding List Items To A Database
Not sure if this is javascript or php so i put it in both newsgroups, sorry
if it's the wrong group.

I wrote (with help) a code to put several items in a list object (select)
and I would like to add the items in this list to a database.

I know how to add a selected item to the database but how can i put al the
items tot the database. I need somekind of loop wich go's through the list.

View Replies !
Sending Emails To Database List
im trying to add on somewhat of a newsletter feature onto a website. Basically I have a list of email addresses (along with their first and last names) in mysql database.

From here ive created a form, simply its one text box, in which the administrator will type their text into this text box, press submit and the email will be sent to all those in the database.

The part in red (the actual email sending bit) works only if I was sending to one person. But for some reason it doesnt like to looped and used for each row of data (ie each email sending attempt). (edit, the code below doesnt seem to want to go red, but you can see where its ment to!) Code:

View Replies !
Displaying A List Of Categories From A Database In A Select Box
Could someone please tell me why this outputs nothing

<select name=categories>
<?
$cat_array = get_categories();
foreach($cat_array as $this_cat)
{
echo "<option value="";
echo $this_cat["category_id"];
echo """;
echo ">";
echo $this_cat["category_name"];
echo "
";
}
?>
</select>

==========================================================

function get_categories()
{
//get the list of categories from the database

$conn = mysql_pconnect("localhost", "user", "pwd");
$query = "select * from categories";
$result = mysql_query($query);
if(!$result)
return false;

$num_cats = mysql_num_rows($result);
if($num_cats == 0)
return false;

$result = db_result_to_array($result);
return $result;
}

//A function that returns a query to the database as an array
function db_result_to_array($result)
{
$res_array = array();
for($count=0; $row=@mysql_fetch_array($result); $count++)
$res_array[$count] = $row;

return $res_array;
}

View Replies !
Create An Array From A List Of IDs Within A Database Table
I need to create an array from a list of IDs within a database table. The table consists of 3 fileds, a unique ID, a user ID and the last is an int value (item number)

eg
1 3 7
2 4 5
3 3 2
etc...

How would I go about using this query

$query1=mysql_query("SELECT itemnumber FROM table WHERE userid = '{$user}'");

Would i be right in thinking I can use:
$array = mysql_fetch_array($query1);

to store all the item numbers associated with the user specified in the first query?

View Replies !
Simple A-Z Link List For Searching Mysql Database
I'm trying to set-up a simple A-Z list so that people can search a mysql database by each letter. Click on "A" get all records in the DB that start with "A". I have it working no problem but i want to be able to add "#" so that the user can get all records that start with a Number.

For some reason the query i'm running won't grab any records that start with a number?

here is the query:

View Replies !
Must Database Table Be Called Up For Dependent List Box Form?
I want to produce a form which will post selections named size and drive to to a file blindsize.php. Looking around this forum and the web, it seems that the only way to do this is to set up a database table (I would set up one in MySQL) and call up that with javacript.

If setting up a MySQL table is the answer, then I would probably use this script. But as I am also new to javascript, I would now have a further learning curve with that, though at first glance the script tutorial looks very good.

But is setting up a database table the only way for a php user? When I first started looking around, I had though the way might be a series of elseif lines.

View Replies !
Displaying Data From Mysql Database In A Drop Down List On Form.
I'm trying to do is display data from two different mysql tables from the same database in a drop down list on a html form. I have a fixtures table with the player1(userid), player2(userid), gameid, game, score1 and 2, what I want is to use the userid to get the players first name and surname from the members table (as it is a unique id), I need to do this bit before displaying it in the drop down. I think i need 2 querys to do this but when I have tried it it just echo's a blank value or the userid not the forname and surname that I want. I'm using the fetch_array function but just can't see where I'm going wrong, Code:

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved