Deleting Blank Entries From Array?
The resulting arrays that i get from my select statements always seem to have some blank entries, in addition to the correct ones. It is rather odd, is there any way i can scan through it and delete these blank entries? Here is the print_r of the arrays. PHP Code:
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Multiple Blank Entries?
When I go to my secondary page of results after I fill info out on a form on the first, I get 3 blank entries automatically inserted into the mysql tables. This second form has these blank entries printing up each time even if I go in to the second page w/o filling out any info on the first. Is there a way I could prevent these blank entries from being automatically entered? Like some code that says that if something is blank then not to have it entered into the tables? or something easier?
Deleting Entries From Mysql
I have business listings that I have pulled from a database(MySQL) and printed to the page, in an admin page, for review. I'm trying to write a script to add and one to delete the listing. I get an SQL error, 'check the manual for blah blah near " on line 1' Here is the 'delete script:
Deleting Blank Rows
I have some rows in my mysql table that have blank fields as part numbers. I want to delete all of the rows that have blank part numbers. would it be like: delete from table where partnumber = '0';
Deleting Blank Lines
Does anybody know of a script that will delete all the line breaks/blank lines in all my PHP scripts automatically... or how i could go about making one / easily
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:
Add Entries To Array
What I want to achieve: A select list in a form should grow with every data entry. Example: I have a list of towns to choose from for a single entry. If there is a town, not in the list, I would like to have the option to enter one in a text field. Next time I approch the input form, the newly entered town shows up in the select list. What do I have to do, to expand the select list (resp. the table behind)?
Duplicated Entries In Array
I have an array. I need to check if key (key => value) is being duplicated... I've already checked all values not to be duplicated and found out they are.. I am trying to make script which would print me which key is being duplicated.
Deleting An Element In An Array??
Here is the problem: I've got an array with the following elements $array = ("ice","ice","polka","skate","polka"); thats 2 polka, 2 ice and 1 skate Now i want someway of removing just one of the polka's from it.. so that i'd be left with: $array = ("ice","ice","skate","polka"); what i did was a basic search with for loop and break Code: for($x=0;$x<sizeof($array);$x++) { if($array[$x] == "polka") { echo("match ".$x); break; } } alls well n good till now.. now i've got the index value(2 in this case) of the element which needs to be deleted.. but what should be done now?? is there any function which'll let me delete a particular element in an array? Is there any other way to go around this?
Deleting An Array Item
I have a standard array: $foo = array( 0 => 'abc' 1 => 'def' 2 => 'ghi'); and I have a variable, $bar, which equals 'def' ... and I want to check my array to see if the value of $bar exists in the array, and if it does, delete it from the array. if (in_array($bar, $foo)) { // what goes here??? } I've done this before, but for the life of me, I'm drawing a blank now. Help a bruthah out?
Deleting Array Elements
I need to delete a single element from a one dimensional array. something like. somefunctionname $arrayname[$key]; does anyone know what somefunctionname is or how this is done?
Deleting An Element From An Array
is there some handy and short method to delete an element from an array and than shifting the rest of elements one place ahead e.g array(1,2,3,4,5,6) becomes array(1,2,4,5,6)
Deleting Multidimensional Array
if i have a multi dimentional array, eg: $arr[x][y] = ''; and i want to delete the enrite thing, does unset($arr); rowk, or so i have to delet the second arrays, or how do i do it???
Clearing/deleting $_SESSION Array?
I have a $_SESSION array in a nested loop that I need to clear for multiple passes and cannot seem to figure out how to this. I have read the manual on unset and such but there seems to be no clear technique that I can ascertain. PHP Code:
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.
Deleting A Single Item From The Middle Of An Array?
I have an array that contain objects, I want to be able to test against the id of that object and remove it from the array. In it's simplest for I want to go from this: $people = array('Tom', 'Dick', 'Harriet', 'Brenda', 'Jo'); ...to this... $people = array('Tom', 'Dick', 'Brenda', 'Jo'); The fact that the items in the array are objects should not matter right? Plus I've already written my loops and conditionals to check which item i need to remove. function removeItem ( $item ) { $len = count ( $_SESSION['basket_arr'] ) ; if ( $len == 1 ) { emptyBasket ( ) ; } else { for ( $i = 0 ; $i < $len ; $i++ ) { if ( $item->id == $_SESSION['basket_arr'][$i]->id ) { //$_SESSION['basket_arr'][$i] must go } } }}
Deleting Database Rows From An Array Of Variables
I have a form with a list of checkboxes, which are each filled with a date in the format 27012007, for example. The name of each of the checkboxes is the same as the date. Basically when the user presses the submit button I would like all rows in the database table "users" with the corresponding column "date" to be deleted when the form variables date correspond to those in the "date" rows. I think all the checked dates might also need to be put into an array. Would anyone know how to do this?
Batch File Deleting And Folder Deleting
I have a folder in my web site where I used php to create and copy in files. but now I can't delete them easily. The only way I know how that is possible is through php. I get an error the following ftp error: 550 th: Permission denied I had the chmod() set to 0777 on every file and folder. But I still seem to loss control over the files when I try and do things with them through other means. I think it is because the user I use to access the files via ftp a diffrent user. So I tryed to add a function with chown() for the new files I was posting and uploading. It didn't work on those new files. so it looks like the only thing I can do is use the unlink() function which deletes the files fine. The only problem is now I have something like 100 sub directories all with files in them. I need to figure out a way to batch delete them. I can't find a script that goes through and finds all file contents including all sub directories and unlink those things. I found some that will use a for loop to list out the contents of a folder but it is just files. No sub directories. Any body got any ideas on which functions I should use or know where a script is that I can base mine off of. I am not sure how to approach this since what I tryed with chown and chmod has failed thus far. I currently have no code and am starting from scratch on this batch flushing of my directory.
Limit The Entries
How can I limit the number of entries into the database, so after the limit is reached a text like "sorry limit is reached" is displayed, if the limit is not reached a form is displayed.
Duplicate Entries
I am currently using the form below for people to enter data into mysql, at the moment this has no methed of checking to see if the data they enter already exists, can anyone provide help as to how to this? PHP Code:
Approval Of Entries
I'm designing my first PHP and MYSQL application. It is going to be a database of singing groups. I'm going to allow individuals to enter thier groups info into the database. However, I'd like to be able to set up an admin screen that would allow me to approve each entry first before it can be viewed. As well as let me do some other admin functions, such as edit records, delete records. Any suggestions?
File Entries
I want to open a local file and add lines of text to the top of it, before any previous text in the file. How?
Duplicate SQL Entries
I have a buddy system on my site and I have found that duplicate buddies can be added into the database. Here how I have this set up: user 1 want to add user 2 as a buddy. user 1 goes to user 2's page and clicks "add as buddy" A PM goes to user 2 and asks him if he accepts or declines if user 2 clicks accept a php script is run Problem: This script need to detect if that buddy already exists, if so do nothing or overwrite the original. Right now it just adds the entry again. I am using a very simple table: UID BID --------- 1 | 2 This would mean user id 1 has a buddy with a buddy id 2 Here is the non-functional code: $query = mysql_query("UPDATE buddies SET uid='$uid', bid='$bid' WHERE uid='$uid' && bid='$bid'"); print "Buddy Has been overwritten"; //would prefer it not do anything at all if entry exists if ($query == 0) { // No records updated, so add it $query = mysql_query("INSERT INTO buddies (uid, bid) VALUES ('$uid', '$bid')"); print "Buddy Added";}
Displaying Entries In Rows Instead Of On Top Of Each Other
I'm altering a voting script for our dog rescue so that we can hold an online photo contest. I'm very new to php & mysql..kinda just muddling my way about with this. I want to display the entries in a row across about 4 or 5 photos and then keep it going that way, but I haven't a clue as to how to do this....
Selecting Duplicate Entries
I'm having the following problem: Let's assume I have a table with 3 fields: ID (type int), NAME(type varchar), EMAIL (type varchar) in a mysql db. The fields have the following data stored: 1, jack, jack@jack.com 2, tom, jack@jack.com 3, jack, jack@jack.com . 2000, jack, jack@jack.com Now let's say I have like some thousand entries like that one above with each one containing different data. So if there are entries which have the same email adress, how I can I select exclusively those entries with the duplicate data in it? So the result of a selection should look something like this: (If I want to show the selection results in html): PHP Code:
Multiple Entries For Same User?
I am creating this form, and instead of having a huge list of input boxes for visitors to fill out, I am wondering if it is possible to have the user click on add another button, and a new submittion will be added to that persons file.
Removing File Entries
I am using php3 and someone told me that php3 does not support foreach. In that matter, how would i go about grabbing lines from a file, iterating through all the entries and only delete the one that matches a string. I was thinking of a for() statement but I do not know what the php equivalent of perl's splice() is?
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?
Ignoring Duplicate Entries
I have this samll piece of code that gets the last 5 post from a forum and presents them on the home page. But i am not sure how to prevent duplicate entries from appearing on it. PHP Code:
Retaining Checkbox Entries
I have a table with entries that are ever increasing and each one has an ID number and I want to be able to associate any of those ID numbers to a file, so I created a pages that shows the ID numbers, 100 at a time. Seeing that there are over 800 entries, I have paginated the results and give the user the ability to move back and forward thru the entries to check off which of the IDs they want to use. However, if IDs on the first page are checked and then the user moves to the second page to check some more, if they go back to the first page, the IDs are unchecked. - how to keep track and display which of the IDs were checked and - how to send the information of which ones were chosen to the next step of the process for adding to the table.
Stop Repeat Entries
Can you stop pulling out exactly the same data from a database, for example, if you had 2 entries which had the name Chris,
(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(); }
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:
Some Form Entries Cause SQL Error
Some members on my site have been getting SQL errors from entries if they use any special characters (' " , etc). For sake of example, say $entry is a variable declared to hold the value of an entry. How can I adjust $entry so that any special characters will be put into the database correctly without error.
Get All Entries From Today (mysql)
I currently have a page that each time a user visits it, the pageid and timestamp is thrown into a mysql daabase. so the database looks like so: linkid time 3 2007-08-22 17:26:21 3 2007-08-20 17:26:21 3 2007-08-22 18:36:59 2 2007-08-22 18:37:21 What i need is for php to show the total amount of visits today as per a certain time zone (or if thats not possible, the past 24 hours) soo.. Search for all occurrences where linkid = 3 today for a specific timezone (or 24 hours) MORE SPECIFICALLY User 1: Lives in New York (EST -5) registers for my site and sends visitors to his linkid (3) After two days, this is what the mysql table looks like: linkid time 3 -=- 2007-08-22 17:26:21 3 -=- 2007-08-20 17:26:21 3 -=- 2007-08-22 18:36:59 But mysql time isn't Eastern time, its another timezone. So when a visitor comes to user1's page at 3pm EST, mysql registers the time as 2007-08-22 17:26:21 So... I want to first add/subtract the number of numbers in the mysql database depending upon the user, and then see the amount of visitors for the day.
Determine Number Of Entries
I have a form in which the user can add more textboxes as need be: Ing1 Ing2 Ing3 .... There could be 1 input or there could be 30... How can I, in php, determine the number of input controls so that I can then loop through them one by one and process their data?
How Do You Delete Entries From ODBC
i have an Access Database that i can read and write to no problems however, when i try to delete an entry it all seems to run with no error but the record never deletes!!!!! The '$_POST[id]' is from a previous page. Code:
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>"; }
Allow Users To Update Only Their Own Entries
I have three forms in my database, when each form is submitted the current username is automatically entered into the database, and I want the user to be able to edit only their entries. Everybody can view the entries but only them can update it.
How To Remove Entries In A DB That Are A Week Old?
I ahve a social network and I have a bulletin system, taht allows users to post bulletins that all their friedns can read... well anway, i dont want the bulletin to just sit there and take up DB space, how would i go about removing "bulletins" that are over a week old?
|