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.





1 Record In Database But 2 Records Were Selected?


i'm retrieving a record from database. below the record, i have a yes and no button, where i can let user click and then count the number of yes and no.

everything works fine, but when i start to click the yes or no button, my record ,becomes two records. i only have one record in my database, but two same record was displayed.
this is the code: PHP Code:




View Complete Forum Thread with Replies

Related Forum Messages:
Display Selected Record That Has Been Passed To URL
I have a page which can list all records from a table in my local database.

For each record that is displayed there is link next to it. When the link is
pressed another page opens up and the ID (automated primary key in my table)
of the record selected is passed to the URL.

So now the URL looks something like this:

http://localhost/Webpages/newpage.php?recordID=3

How do I display the details of the record that has been selected on this
new page?

View Replies !
Display Selected Records
I have a table on a form which contains records that can be multiple selected by checkboxes. A submit button sucessfully sends the record IDs of the checked records to the next page. I want to display the records that were selected via the checkboxes, but the problem is that I get only the first of them.

View Replies !
Transferring The Selected Record From The List Box To Textbox
Breifly, I've 3 list boxes.Select a record from the first one, click a button, the second list box is filled and select a record now and then click a button, the third list box is filled.Now, select the record, the selected record has to be shown in the text box.But, I also want to show one more field related to this one in another text box.How can i do??

well, the first list box shows the topic names, 2nd one the sub-topic names and the third one the article names. Now, when i select the article name, the article name and the article content has to be shown in the text boxes.

If its just article name, i know how to do it by java-script but i also need article content to be shown. Could somebody please help me how should i modify my code and where should i insert the text boxes?? Also, one more question, If i make any changes to the data in the text boxes, i would like to update.How can i do that?? PHP Code:

View Replies !
Way To Pass The Selected Records To The New Page?
I have a dynamic table and use a check box in every record. I want the selected ones to open in a new page. What shall I do? I mean, what is the way to pass the selected records to the new page?

View Replies !
Show All Records For The Selected Month & Day
I have a query that shows all appointments of a chosen day using the following format:

$eventid=2007-05-21

WHERE starttime LIKE '".$eventid."%'

I have a calendar and am trying to make it show all records for the selected month, or display all records from a specific day if a day is selected from the calendar.

So far I have it where I can show records from specific day, but want selected months records as default.

View Replies !
Delete Selected Records From Table.
Can anyone see why this connection doesn't work? It's suppose to delete selected records from my table.

<?php

if (isset($_POST['delete'])) // && isset($_POST['delcus']))
{

foreach ($_POST['delcus'] as $val)
{
echo "$val";
$conn= mysql_connect( "localhost", "user", "password" );
$sql = mysql_select_db( "snow" );
$del = mysql_query("DELETE * FROM request WHERE qid =" .$val);
//$rows = mysql_num_rows($del);
$rs = mysql_query($conn, $sql, $del);
if($rs)
.........................

View Replies !
Limit Record Returns And Next Records
I have my script limiting the number of records returned from a search to 10...

then I provide a link to another php page adding 10 to the offset to return the next 10 records...

however, the next 10 records that are being returned are not of the same query that the person searched for... the 10 records that are returned are starting from the 10th record in the entire dataset...

any ideas on how to bring up the next 10 records from what was already searched for?

View Replies !
DELETE RECORDS - Database Adding New Records
iv got the database adding new records, and now I want it to display all of the records that are there buy name and id number, then i want u to be able to type in the id number of the customer u wish to delete and it shoudl delete it, sounds good buts its not actually deleting the record. it says it does, but its not doing it. Code:

View Replies !
Looping Through Records(show First Record And Then Loop)
I am trying to display the first record seperately before looping through the rest of the records in the mysql array. PHP Code:

View Replies !
Moving Through Records In Table In A Single Record Page
I'm trying to create a updates pages that I can move either to the previous
record or the next record within a recordset without having to return to the
repeating list of records after each up date.

Assuming I have done the recordset correctly, which I have and the update
records command as well here is the code I'm trying to use: Code:

View Replies !
View The Query Results One Record At A Time And Cycle (step) Through The Records
I need to know how to use PHP to step (one by one) through the records of MySQL database query result. I am able to connect to the DB and perform a query. I am able to print the results of the query for the ENTIRE query result.

What I need now is to be able to view the query results one record at a time and cycle (step) through the records by using a control (button or link) on the page itself. (The first record of the query result displayed on page entry, a "next" link/button to see the next row of information).

View Replies !
No Database Selected
Im running twice the same website:

- one for the public
- one for private testing

Everything is moreless the same, except some config variables in the php and the replacement of css directories. However on the test server im getting a no database selected:

mysql_query('sqlhere') doesnt work
mysql_query('sqlhere',$conn) does work

So somehow on my test server it is not taking the only open connection, but wants it specified. Code:

View Replies !
Database Selected Error
I built a web application for our IT department to handle PC Cases. I used PHP/MySQL for the application. Everything for the most part works fine except every once and a while when you are navigating the pages I get a blank white page with the error "No Database Selected" in the top left hand corner. It seems like the database is timing out or something, or maybe its getting too many queries, I'm just not sure.

View Replies !
Selected Value In Dropdown Dependent On Database Value
i need a way to make the selected value of a drop down dependend on a result from a database query. PHP Code:

View Replies !
Error In Query. No Database Selected
I have an error, not a php syntax error, everything is working fine but I get this error "Error in query. No database selected", does anyone have any idea on how to solve this. 

View Replies !
No Database Selected - Simple System That Includes Pages
what I've got it a simple system that includes pages the reference to which are in a database. This bit worked a treat. until i tried to put something that did some work in one of the included pages. PHP Code:

View Replies !
Make Selected Option Stay Selected In A Combo After Submit
I have 3 comboboxes, one for the day, other for the month and another one for the year. Every time i select a value for the three of them and press the "Submit" button, they reset to the default option. Anyway this can be solved?

View Replies !
Getting Last Record From The Database
I have the following table :

----------------------------------
Studnet_id | Reg_no | Std_name | etc....
----------------------------------

- Initially all records are Null.
- Student_id is Primary key.

I want to read last record from the field Student_id i-e NULL and then add +1 to it to get new Student_id. Code:

View Replies !
Display Database Record
i have a php script that read from mysql and display then in textbox.
I have problem with the way textbox display the data.

<input type=text name="package_name" size=20 maxlength=10
value='.$package['package_name'].'>

when the package_name is 'china tour' it will only show china in the
text box. How can i show all the content of the record?

View Replies !
Not Displaying First Record In Database
this code is not showing up first record in database:
the table should start off by clan id = 1 and clan name = name1
page: PHP Code:

View Replies !
Pulling Only 1 Record From A Database
$query = "SELECT widget_type FROM $database WHERE widget_type = 'A'";
$result = mysql_query( $query );
$row = mysql_fetch_array( $result );

if( $row[ 'widget_type' ] == '' ) { $has_widget_type = false; }
else { $has_widget_type = true; }


Lets say I have 300 parts that have widget_type A, will the query find the first one and then just stop or will it continue to search the whole database until it finds all widgets with widget_type A?

If it is searching the whole database, is there a way to make it stop as soon as it finds the first instance of widget_type A?

View Replies !
Database Record Linking
I develop websites on the side, it is basically a hobby. An organization has approached me to develop a site for them which I may or may not take depending on one thing. This organization would like individuals within their organization to be able to access their individual information via a password protected area.

The information will contain their hours worked, hours needed for next level, credits earned,and test scores.The individual should only be able to access their information only. I use MS Front Page, and NetObjects. Is this possible with these programs and if not what is reccomended?

View Replies !
Database Record Update
i have about 10,000 records that contains this link in a record "http://site/directory" now i want to replace it all with "http://site2/directory"..

i cannot do a update set command because the position of the link is not always the same ex.. text text text text <link> text text text.

View Replies !
Writing A Record To The Database
I've been running a dating site written in php/mysql. Most of it was built by someone else and I've done some minor modifications. It works fine 99% of the time, but occassionally it makes small errors when writing a record to the database. For example, it might post a record for a new member and all of the info is correct except it doesn't post the "M" or "F" for male or female. Or it might be a logical field and it posts a "N" instead of a "Y".

Like I said, it posts most of the record correctly with a small exception like the ones above. Also, it might post 99 records correctly, but then one day I get a glitch.

I've only got about 500 members right now, so it's not a big deal. But when I get up to 5,000+ members, these glitches will become a daily occurance!

Do anyone know why this might happen? Is there any way of keeping this from happening? I've only been using PHP and MySQL for a year, so I'm not expert, but I'm assuming this isn't normal.

View Replies !
Select One Record From A Database
I am trying to select one record from a database. This databse has like 10 tables. I do not know which table this record is in. What php and mysql syntax would I use to accomplish this?

View Replies !
Add A Record Into My Mysql Database
I have the following code to add a record into my mysql database: Code:

View Replies !
Select Last Record In The Database
I need to select the last record in a table. What is the query?

table = xyz

The data from this one row needs to be echoed on the page. Rather than have to write out every field, I'd rather have it just take each field's data and echo it on successive rows. How do I make it automatically do this?

Ex:

Fieldname1: Fielddata1
Fieldname2: Fielddata2

and so on.

View Replies !
Displaying Only One Record From Database
For some reason it is only displaying one entry from the database insted of all 13.

$sql = "SELECT * FROM search ORDER BY search_id asc";
$result = mysql_query($sql, $conn) or die(mysql_error());
while ($newArray = mysql_fetch_array($result)) {
$search_id = $newArray['search_id'];
$search_word = $newArray['search_word'];

}


echo "$search_id<br>";

View Replies !
What To Do If There Are No Records In The Database
I am pulling data from the database and displaying it using the code below:

$db = mysql_connect("localhost", "root");

mysql_select_db("pyramid",$db);

$result = mysql_query("SELECT * FROM table where area='Wales'",$db);

while ($myrow = mysql_fetch_row($result)) {

echo "blah blah";

}
?>

What do I do if there are no records? At the moment it just doesn't display anything. How do I get it to display a message saying there are no records?

View Replies !
Updating A Record In A Mysql Database
I am sorry if this is a simple oversight, but I have been struggling for many hours over something which seems dead simple.

I need to update a record in a table with more info. I am using the code below which soen't give me any errors but nothing happens.

include("link.inc");
$db=connect_db();
$db_name=db_name();
mysql_select_db($db_name,$db);

$sql="UPDATE data SET age='age',live='live',whatdo='whatdo',drinkalcohol='drinkalcohol',takedrugs='takedrugs',firstdrug='f irstdrug',seconddrug='seconddrug',medicine='medicine',alcohol='alcohol' WHERE id='$id'";
$result=mysql_query($sql,$db);

View Replies !
Insert New Record To Database Without Duplicating
Is there a simple way when inserting a new record to a database to only execute if it is not duplicating an existing record? The way I would currently do this is to query the database first with the new values and see if I get a match, but is there simpler way?

View Replies !
Can't Insert Record Into Access Database
I'm trying to create a registration/login script using Access 2003. I'm using ADOdb to connect through ODBC.

The problem is that I get the little custom error Could Not Connect to Server when I try to insert a record, yet when I use the form with a username I inserted through Access it reads it just fine and returns if the username has been used. Also if I removed line line 23 or die('<b>Could Not Connect to Server</b>'); and it'll complete the script, but it won't insert the record. Code:

View Replies !
Multiple Record Form To Database
I have a form that has header information on the top such as dates, city, state, event, etc. The detail information of the form has several rows, 32 to be exact. Each row has 4 fields (name, gender and association). 

I named them 1name, 1 gender, 1 association for row 1.  2name, 2gender, 2association for row 2, etc etc etc. I need each row to be a separate record within the sql database but also carry in the header fields.

View Replies !
Upload Pictures But It Does Not Record It In The Database
im trying to upload pictures but it does not record it in the database that a file has been attached for a particular bulletin.  Dont want to view it, just record that its been attached. Code:

View Replies !
How To Figure Out What Position A Record Is In The Database?
However I would like to be able to figure out what position each user is on the fly. For example, if the user "lisam03" wanted to know what position she is in, I would like to be able to tell her she is #6.

At the moment I cannot do this. I can only tell she is #6 by displaying the results for everyone and finding her position.

Does anyone know any way I can find out, on the fly, what position a record is in a database?

View Replies !
Using Checkboxes To Delete Record From Database
i would like to use check boxes to delete records from the database. my problem is, the records belong to different tables. how do i indicate in my code "DELETE from blah blah... " from which table to delete from..

View Replies !
Update Certain Records In Database
I would like to update certain records in database so they are all written in lowercase....i have tried with it but doesn't work:

<?php
$db = mysql_connect("$host", "$user");
mysql_select_db("albums",$db);
$result = mysql_query("SELECT * FROM albums",$db);
while ($myrow = mysql_fetch_row($result)) {
$al_artist = strtolower($myrow[1]);
$al_name = strtolower($myrow[2]);
$site = strtolower($myrow[4]);
$sql = "UPDATE albums SET al_artist='$al_artist', al_name='$al_name' site='$site' WHERE id='$myrow[0]'";
$query = mysql_query($sql);
}
mysql_close($db)
?>

View Replies !
Deleting Records From Database
I have another question about record deletion from
database.

For example, my database has 10 records with ids 1
through 10. If I delete id #10 then everything is good
and all the records are still 1 through 9. However, if
I delete record id #4, then in my db I would have
records 1 through 10 with id #4 missing.

Is there a command that syncs the database? How do I
go about this to keep all the ids in the right order
after the deletion? or What do I need to do to prevent
that from happenning?

View Replies !
Insering Records Into Database
I am trying to insert some records through a form into my database(INTERBASE).I have test1.php where i have two include files, namely:connection.ini and aim.ini
In connection.ini, i have the db connection details and aim.ini, i have the form fields and the sql statements.Now, when i run my program, i am able to see the output, but, they are not inserted into my db.could some body please figure it out. Code:


View Replies !
Retrieve Last Ten Records From The Database
using LIMIT I know how to easily retrieve the first 10 records from the database. But is there an easy way to retrieve the LAST 10 records  from the database? e.g

$sql = "SELECT * FROM employees";

How would i retrieve the last 10 records.

View Replies !
Wont Add Records To My Database
can u check my codes and tell me whats wrong because for some reason it wont add records to my database, im using phpadmin v4.23 here are my codes

<htmL>
<body>
<form action="insert.php" method="post">
First Name: <input type="text" name="first"><br>
<input type="Submit">
</form>
</body>
</html>

here are my php codes

<?
$username="root";
$password="";
$database="trial";

$first=$_POST['first'];


mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
....

View Replies !
Database Records Query
Can anyone help me with the following mySQL code. Probably a simply solution but i cant find the answer anywhere. I have a table called news full of articles each one has an associated news_id. What i need to do is query the database and pull out the last article. Then i want to pull out the second to last article and finally the third to last article.

View Replies !
Show All Records From Database
How to show all records from database. (i mean row by row).for my code, i can only show the last record.

$query = "SELECT * FROM tblpatient";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
while ($row = mysql_fetch_assoc($result)){
echo $row['Name'];
echo '<br/>'
echo $row['Address'];
}

View Replies !
Batch Add Records To Database
I would like to create an option on my admin page to add batch records to Mysql database.

I guess I need a textarea, a field limiter and a line break :)

After the form has been submitted, the script should parse the data into arrays and add each array value to the database, most probably with a loop.

Can someone help me here? Example:

books

title | year | author

And what if I want to upload and insert CSV format (without phpmyadmin)?

View Replies !
Checking If A Value Is Not In An Array And Deleting Record From Database
I have been trying to figure this one out and have come up against a brick wall although I know it should be relatively simple. I have a form that passes an array to a php script from a multiple select box that is created dynamically.  If a user deselects an item then I want to delete the record from the database but am having a big problem with it. The table in the dbase is quite simple with just three fields:

id
classid
formid

Basically, the form send through a classid and a formid value and I want to delete any records that have a classid that are not in the form array and have a formid which is passed as a hidden value. I suppose really what I want is to know how to see if a classid is not in the array that is passed.

View Replies !
Duplicate Entry - Insert A Record To My Database
When I am trying to insert a record to my database I get this error: Duplicate entry ?' for key 1

but when I check my database from phpMyAdmin I dont have any record with this ID. show me 17866 for Next Autoindex in Row Statistics section too. What's the problem?

View Replies !
How To Insert Record In Database Using Text-area
i need to insert record using textarea. but this is not working. my function for insert is function InsertRecord($fieldarray) Code:

View Replies !
Update A Record On The Db It Update ALL The Records
When iam trying to update a record on the db it update ALL the records their, i don't know where is the erorr ! Here is the action file.

$select="UPDATE dir_all SET wbname='$sitename', wbdisc='$sitedisc', wblink='$sitelink' WHERE id='$id'";
mysql_query($select) or die($select);
?>

View Replies !
Sort Pages Of Records From Database
When I sort dates from my sql database, the records sort all in one time.I would like to sort only 20/25 records and after to clik a button and sort other 20/25 records and so on.

View Replies !
Flash Next Button For Database Records
Im making an student profile in flash. The database has already been created for us by our tutors at uni. I need help with my previos and next buttons. my work is due this friday I also have dynamic text boxes for car/bus/train/and bicycle. These data are s'posed to be loaded from the database either as a Yes/No. I cant figure these bits out.

View Replies !
Does PHP Have A Way To Export Records Of A MySQL Database?
Quite by accident, I found the mysqldump utility, that comes with MySQL,
which dumps/backsup a database, table, or record. It looks very versatile!

Does PHP have a way to export records of a MySQL database? Anything that
does the same independent of the database used?

View Replies !
Password Protected Database Records
Let's say that I have a MySQL database with 1 record for each client.

Now one client wants to modify his own record, how do you do just that using PHP?

I created a htaccess form for my clients but the problem I have is that they can edit the records of ALL my clients.

Anybody have a php script to paste here for me?

View Replies !

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