Need Help Extracting Specific Records In An Array
I am using a pc of code that is as follows:
while ($row = mysql_fetch_array ($result))
{
echo "user_id: ".$row["file_name"]."<br>";
echo "user_id: ".$row["file_author"]."<br>";
echo "fullname: ".$row["file_keywords"]."<br>";
echo "fullname: ".$row["file_description"]."<p>";
}
This will extract all the data from the records that have been stored in $row.
The question I have is how to take out slective informtion? Let's say I have a complete $row array (40 finds) but only want to show the first 3-6 records. How do I access hose specific miages?
View Complete Forum Thread with Replies
Related Forum Messages:
Extracting A Specific Part Of An URL
If I have links in these formats... 1) http://www.somewebsite.com/IWANTTHIS/ 2) http://www.somewebsite.com/IWANTTHIS/this-is-unwanted-and-variable/ ...and I'd like to extract the IWANTTHIS part (which is not constant) from the permalinks, how do I go about doing this? I'm trying to find a way to achieve context sensitive menus in wordpress and this seems to be the only way to access the page-slug of pages and posts.
View Replies !
Extracting Specific Data From A File
I have a text data file with the following fields. item and file Example item1 | file1 item2 | file2 item3 | file3 How can I get a variable called $item_name to choose and print the file name that's in the same row where the item field matches the $item_name variable. For instance if the $item_name variable is "BOOK NUMBER ONE" and these field values exist BOOK NUMBER ONE | book_1.pdf I want to choose and print book_1.pdf.
View Replies !
Count Specific Records In DB
I am making a private messaging script as an addon for a script I have already made and was wondering how I would go about counting the number of messages in a table that are to a certain user.... eg... the database +--------------------+ |todj | message | --------------------- | |User 1 | Blah blah... | |User 2 | Blah blah... | |User 1 | Blah blah... | +--------------------+ Now what query would I use to ask it how many messages are there for User 1 and then echo it in text form? Something like this maybe? <?php $result = mysql_query("COUNT to WHERE to="$_SESSION['username']"); ?> The table also contains a subject, date, and fromdj field if it makes any difference.
View Replies !
Delete Specific Records
On clients machine, currently to delete on trainee record it runs 10 queries to delete records from 10 tables. At the time of running all queries, server shows (104) Connection reset by peer. An error condition occurred while reading data from the network. I think it because of running 10 queries at a same time. Is there any possibility that through one line of query we can delete record from 10 tables. I've tried following query DELETE FROM table1, table2, table3, table4, table5, table6, table7, table8, table9, table10 WHERE empID = 11; But it gives ' error in query.
View Replies !
Grabbing Specific MySQL Records
I have set up a target page to pull information out of a mySQL database to populate the page. The problem is that it is only pulling from the first record and not the record specified. What do I have to do to pull from a specific record? I am using Dreamweaver MX to administer the site on WinXP using PHP if that information will help.
View Replies !
How To Control Access To Specific Mysql Records For A User
I am just trying out a php form, when posted submits data to database. The system is we allow everyone to submit the form. As administrator I can view and edit the records. But whoever submits the form should be a registered user and he should be able to only view his records but not edit.
View Replies !
Extracting Info From An Array
I have an array named Task and inside the array is another Array it looks like this [task] => Array ( [0] => prr [1] => tyh [2] => rfd [3] => sds [4] => yui [5] => rtr [6] => wer ) I need to find out how to extract the initials prr, tyh, rfd,sds,yui,rtr,and wer is there any way possible to do that so i can send each set to my database.
View Replies !
Extracting Values From An Array Session!
I am working in a project to add personal info into DB. For some fields I use session to keep values before putting them into DB. So I wrote a test code to insert phone numbers into a session and at the end put it into DB. The problem is, I can wirite into the session but don't know how to extract them, as it's an array. My sesison is writen like this: /tmp/session_file: n_array|a:5:{i:0;a:1:{i:0;s:6:"VALUE1";}i:1;a:1:{i:0;s:6:"VALUE2";}i:2;a:1:{i:0;s:6:"VALUE3";}i:3;a:1:{i:0;s:6:"VALUE4";}i:4;a:1:{i:0;s:6:"VALUE5";}} My code that generates this info is:
View Replies !
Extracting Range Url Values In Array
I need to extract range-url values in an array. The range-url may contains multiple range. Range-Url For eg. http://www.remotesite.com/images/img[01-15].jpg http://www.remotesite.com/images/img[01-15][20-23].jpg Extracted array value for http://www.remotesite.com/images/img[01-15].jpg http://www.remotesite.com/images/img01.jpg http://www.remotesite.com/images/img02.jpg http://www.remotesite.com/images/img03.jpg .......................................... http://www.remotesite.com/images/img15.jpg or for http://www.remotesite.com/images/img[01-15][20-23].jpg http://www.remotesite.com/images/img0120.jpg http://www.remotesite.com/images/img0221.jpg http://www.remotesite.com/images/img0322.jpg http://www.remotesite.com/images/img0423.jpg http://www.remotesite.com/images/img0520.jpg
View Replies !
Extracting Array Data With Loops
I have a SQL query which returns values from two tables. It matches one record of table a with three records from table b. When I use print_r($array) in a loop to view the contents, I get this: PHP Code: Array (    [0]data x from table b    [1]data y from table b    [2]data z from table b    [3]data from table a    [4]data from table a    [5]data from table a    [6]data from table a ) For each 3 arrays the data from table b (x, y, z) is different, but the data from table a is the same. I want to extract the b data 3 times, and the a data once. Can I do this using a loop within a loop?
View Replies !
Extracting Info From Array Problem
I am having problems trying to solve an issue with something I would like to do with a site I am creating. I would like to store a bunch of words into an array. Then, I would like to be able to extract all of the words that, say, are repeated at least two times inside of the array. For example, $test_array = array("butter", "bread", "milk", "butter", "bread", "yoghurt", "butter", "eggs", "eggs"); I would like to be able to extract the words that are repeated at least twice, as well as extract the info about how many times they had appeared. So I would have something like butter - 3 times bread - 2 times egss - 2 time I am trying to extract this information, and thought about using a 'foreach' statement, followed by a 'for' statement that would go through the array and try and match the current array value (as retrieved from the 'foreach' statement) with the rest of the values of the array. If there was a match i would increase a counter variable by one. However, I am having lots of troubles with this, and because my knowledge of php is very basic, I am not sure of what to do, or if there is an easier way for me to achieve my aims.
View Replies !
Extracting Unique Values From An Array
Let's say I have a series of values: PHP Code: $list = "milk, bread, cheese, milk, milk, eggs"; If I explode these: PHP Code: $exploded = explode("," $list); Is there a way that I can then filter out the duplicate values, so that the resulting list will look like: PHP Code: Array ( [0] => milk [1] => bread [2] => cheese [3] => eggs )
View Replies !
Creating An ARRAY And Extracting The Month Of The Date
After a long look at over 200 posts I cannot find what I am looking for: I have a table (baggage) which has a number od fields two of which are f_baggae and f_date. The f_baggage f_baggage will contain "YES" or it will be emptyand the f_date hold dates in the format of "0000-00-00". What I am trying to do is to extract the data from the table in a format where I can use it in jpGraph. So far I have only managed to extract the number of rows that contain data which is fine as far as it goes. My query is as follows: Code:
View Replies !
How To Add An SPECIFIC Array
sorry if the subject isint really good to understand, now i will try to explain my best. I recently installed a hack in phpbb and that particular hack allows only 1 variable, but i want to add more than one, and i thought the best thing to do it is in an ARRAY, but i dont know how to do it in an array, the code looks something like this:
View Replies !
Find A Specific Value In An Array
What I want to do is compare a value against an array and perform a specified action if the value is in the array. Specifically, I want to preselect an option in a list based on whether or not the option id is in a field (a 'set' column) of a specific entry in a db. My code so far is: PHP Code:
View Replies !
Finding Specific Array Key
I have an array with sub arrays, example: $an_array = array([0] => ([id] => 152 [otherstuff] => blah... ) ([1] => ([id] => 167 [otherstuff] => yadda... ) ([2] => ([id] => 17 [otherstuff] => stuff... ); I have a variable that stores an id, how can I get the key of the specific array, ie: $x = 0; $var = 152; if($an_array['id'] == $var){ $x = get_this_array_key; } I don't know how to get the key of the array where I have the 'id' value of that array.
View Replies !
Sort By Specific Array Addresses
I have a file containing lines of information about files. Each piece of information is separated by a "|" character. I want to extract the information and then sort it based on some of the information (for example it contains the filename as the second piece of information) PHP Code: $array = file("files.txt"); foreach ($array as $line) { $info = explode('|', $line); //filename is in $info[1] $order[] = $info[0].",".$info[1].",".$info[4].",".$info[5].",".$info[6].",".$info[8]; } I have no idea where to start or which sort function to use. I will be needing to sort by specific array addresses. I'll need to sort $order according to $info[1] values or $info[8] values.
View Replies !
Accessing Specific Array Values
I'm struggling with performing some calculations on array values. What I'm trying to do is get some values from an array that holds shopping cart details than add them together but only for certain items. Say I have an array that has 4 entries: [0]([product_id] => 100 [quantity] =>1) [1]([product_id] => 104 [quantity] =>3) [2]([product_id] => 117 [quantity] =>4) [3]([product_id] => 100 [quantity] =>2) and a variable that holds a pre-determined value: $prod_id = 100; I want to get all the quantities where the product id is equal to the variable value, so in this case it would be 1 and 2, then i want to total these values so 1+2=3.
View Replies !
Completely Delete A Specific Array Index
I was wondering if anyone could tell me if there is a way to completely delete a specific array index once it has been set. For instance, I have an array with 50 indexes (0 - 49) sizeof = 50. Now, I want to eliminate 10 indexes, making my array sizeof 40 and having array indexes 0-39.
View Replies !
Summing Specific Values In A Cookie Array
I am building a simple shopping cart and I am having problems trying to add the costs of the items to generate a total cost. I am new at this so forgive me if my technical verbiage isn’t the greatest! I am trying to sum specific values in my arrays (or the price portions of the arrays). I have tried every imaginable way with the array_sum command and nothing has worked for me! Here is what my cookie information looks like after I put 2 test items into the cart that cost 18.00 each. Code:
View Replies !
Recursively Searching Array For Specific String
Simply put, I'd like to find a string such as �' in an array. The string is not strictly �', but would be 508429_501_21.jpg, 508429_601_18.jpg, etc. - multiple occurences are possible. I found a great function that recursively scans through a directory structure; I've attached it here, and it results in the following output. Code:
View Replies !
Group Array Records
Some of them are to be sent to only one customer list while others are to be sent to multiple customer lists. (The customers have paid to receive these newsletters.) Some customers subscribe to more than one newsletter list. I store the newsletters and the customer lists in a MySQL database on a Linux server. With each newsletter, I have a field that holds the ids of all the lists to which that newsletter should be sent. Code:
View Replies !
How To Save Array Of Records Into The DB
I have these codes below for you to refer on what is going on with it but i think my problem is during saving only... Well anyway, basically I had a row with 3 elements or columns(Partname,Partnumber,version). Everytime I clicked the "Add Part" button, it will call the javascript addPart() function in which it will add another row of elements. The values on each element of every row is stored in an array variable. When Im going to click submit button, all the data inputted to every columns should be saved into the database. The problem is, it doesn't work.... maybe there something wrong with my code during saving. This my Javascript code: ....
View Replies !
Updating Records With An Array
I'm trying to update records using values selected from a multiple selection select box. Here's the code i'm using in the update page: if (isset($_POST['team_id'])) { foreach ($_POST['team_id'] as $value) { $sql4 = "UPDATE team_members_x SET date_id = '".$_POST['date_id']."', team_id = '".$value."' WHERE date_id= '" .$_POST['date_id']."'"; $result4 = @mysql_query($sql4,$connection) or die(mysql_error()); } } This doesn't seem to update my records correctly though.
View Replies !
Extract All The Records With Id Array Problem
I have an assoc array with the following; id,type myArr[0] = array('id' => 1, 'type'=>ds) myArr[1] = array('id' =>1, 'type'=>dd) myArr[2] = array('id' =>2, 'type'=>gt) myArr[3] = array('id'=>2, 'type'=>rt) myArr[4] = array('id'=>2, 'type'=>xx) myArr[5] = array('id'=>3, 'type'=>ds) myArr[6] = array('id'=>3, 'type'=>dd) myArr[7] = array('id'=>4, 'type'=>xx1) myArr[8] = array('id'=>4, 'type'=>dd) myArr[9] = array('id'=>4, 'type'=>xx) I want to extract all the records with id = 2, 4 because atleast one or the records with these id's has the type 'xx'.
View Replies !
Convert Records From Database To Array
I read 10 lines of data from the database and I'd like to put it in an array. My problems are: (1) if the way of putting values inside an array is like this : $arr = array(1 => "string1", 2 => "string2", 3 => "string3"); or $arr = array("string1", "string2", "string3"); then how can I insert the values inside an array coming from : while(list($stringdata)= mysql_fetch_row($result)) { --------------------- }
View Replies !
Echo To A Specific Div On A Specific Page
Is it possible to echo something from a php file to a specific div in a different specific html file?If so, can you let me know how to specify where the data should displayed. $myName="john"; echo '$myName'//but i want to echo to a different page on a certain part of that page.
View Replies !
Displaying Priorty Records And Normal Records In The One Dataset.
I have a page which displays the records from the database and uses paging to display the records in groupes of 10 per page. I now want to be able to show results depending on the database field (display) in the database (can be set to either "full" or "limited"). If the record and the field display is equal to "full" i want to then display this record at the top of the record set and display all the fields. If the record is equal to "limited" i want to display different results and they must show after all the records which are equal to "full". I can't output two different recordsets as i use paging and only want to show 10 records per page. Code:
View Replies !
Reading An Array Of Records From MYSQL Then "Save As" Them Back As Copy
Hi all, Ok here is what I want to do then I will show you what I have. I have some records in a MySQL DB that I want to store in an array and then immediately copy them back where the only thing that would change would be one field - the date. So here is my table: ------------------------------------- |userName | date | value | -------------------------------------- | theDano | 200005 | 123 | -------------------------------------- | theDano | 200005 | 345 | -------------------------------------- | theDano | 200004 | 678 | -------------------------------------- | joeUser | 199908 | 897 | --------------------------------------- So if I am querying for the user "theDano" on a specific date (format yyyymm) in this case 200005 (year 2000 month of May) Here is my array to query all records to fullfill this request: if ($update=="future") { if ($month!="01") { $db = mysql_connect("localhost", "dbuser"); if($db) { mysql_select_db("dbName",$db); $result = mysql_query("SELECT * FROM tableName WHERE userName = '$userName' AND date = '$date' ORDER BY value DESC ",$db); if ($result) { $num=mysql_numrows($result); $i=0; while($i < $num) { $userName = mysql_result($result,$i,"userName"); $value = mysql_result($result,$i,"value"); echo "<tr>"; echo "<td width=Ê×'>" . $userName . "</td>"; echo "<td width=ï`'><div align='right'>" . $value . "</div></td>"; echo "</tr>"; ++$i; } } } } } Now I want to take the array of records queried which was: | theDano | 200005 | 123 | -------------------------------------- | theDano | 200005 | 345 | and copy them to look like this back into the database: | theDano | 200006 | 123 | -------------------------------------- | theDano | 200006 | 345 | so you can see that the only thing changed was increasing the month by one. Would seem simple to most but I am having a tough time wirting the code to read the array and increase each date value by "1". Thank you in advance for anyone that replies. ) Dano
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 !
Problems With The Listing Of Records, Editing Of Records
I'm having problems with the listing of records, editing of records, and deleting of records. I'm not sure what I'm doing wrong. The listing script is calling the add entry script. So I add the record, the database is updated, and nothing else happens. I don't get a list of records from that table. When I did SQL programming off the mainframe, you did a simple select statement. I'm not sure why the PHP list script is calling the add entry script. Code:
View Replies !
Sending People To Specific Pages That Are Coming From Specific Pages...
I want to show some specific pages to people that comes to my site from specific urls, I know the variable $_SERVER['HTTP_REFERER'] will be used but how? For ex if the visitor comes from a site that is like: I want to send this person a specific.php . I used below code but not worked: <?php if($_SERVER['HTTP_REFERER'] == "www.cominghost.com" || $_SERVER['HTTP_REFERER'] == "cominghost.com" || $_SERVER['HTTP_REFERER'] == "www2.cominghost.com"){ // Specific page html goes here } else { header("Location: index.php"); } ?> This code not worked for some cases like if the visitor comes from http://www.cominghost.com/account/targeturl.php or http://cominghost.com/account/targeturl.php Ok I know the if statement not working but How?
View Replies !
Extracting URL
I am try to write a script using PHP and Ajax that is able to extract information from the URL. Says, web page 'A' will call this url using Ajax with information attached at the end of it So, I am just wondering how to extract the information from fname onwards. How will be the coding looks like in check.php?
View Replies !
Extracting The End Of A URL
I am trying too make a script that can check URL's, which I managed too do with no problem at all. I was wondering was there a way my users can enter multiple urls into a textbox and have the script extract the end of each URL. For example, the user submits: http://mydomain.com/files/13039621/2k5pro.part28.rar.html I want the script too delete the first part so it is left with: /13039621/2k5pro.part28.rar.html and place it in an array. It would also need to be able to take a bunch of links at one time, such as: http://mydomain.com/files/35539621/2k5pro.part28.rar.html http://mydomain.com/files/13242343/2k5pro.part29.rar.html http://mydomain.com/files/13423621/2k5pro.part30.rar.html http://mydomain.com/files/13044421/2k5pro.part31.rar.html http://mydomain.com/files/13252331/2k5pro.part32.rar.html http://mydomain.com/files/12449621/2k5pro.part33.rar.html
View Replies !
Extracting Data From XML ?
The following is the sample XML file from which I want to extract the data of which availabity ="Available" using php. The XML file will be generated dynamically from the URL http://www.upc.nl/zipcode.php?zipcode=3565BG <UPC-Results> <DateTime>05-12-2005 02:08:26</DateTime> <Errors/> <Products> <Product name="CaTV" availability="NotAvailable"/> <Product name="Chello Starter" availability="NotAvailable"/> <Product name="Chello Easy" availability="NotAvailable"/> <Product name="Chello Light" availability="NotAvailable"/> <Product name="Digitale telefonie FreeTime" availability="NotAvailable"/> <Product name="Chello Classic on DSL" availability="Available"/> <Product name="Chello Plus on DSL" availability="Available"/> <Product name="Chello Extreme on DSL" availability="Available"/> <Product name="Digitale telefonie Basis on DSL" availability="Available"/> <Product name="Digitale telefonie FreeTime on DSL" availability="Available"/> </Products> </UPC-Results> from the above XML, I need to get data of Product name which has the status of "Available"
View Replies !
Extracting Words
I'd like to extract the first 5 words from a blurb of text. I can't find an easy way to do that. Example. If I were to do that for this message I'd extract "I'd like to extract the"
View Replies !
Extracting XML & RDF Data Using PHP
I have an XML file that contains metadata in the form of RDF. The file is something like this: <?xml version="1.0" encoding="utf-8" ?> <xmpData> <WavXmpInfo path="C:.....................................") <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="" xmlns:xmpDM="http://ns.adobe.com/xmp/1.0/ DynamicMedia/" xmlns:xap="http://ns.adobe.com/xap/1.0/" xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/" xmlns:xapRights="http://ns.adobe.com/xap/1.0/rights/" xmlns:dc="http:// purl.org/dc/elements/1.1/" xmpDM:audioSampleRate="16000" xmpDM:audioSampleType="8-bit" xmpDM:audioChannelType="1" .......... .......... .......... <dc:rights> <rdf:Alt> <rdf:li xml:lang="x-default">HHHHHHHHHHHHHH</rdf:li> </rdf:Alt> </dc:rights> </rdf:Description> </rdf:RDF> </WavXmpInfo> </xmpData> I want to extract data such as audioSampleRate, audiosampleType etc, so that i can insert them into a database. I'm having problems accessing this data. I'm using DOMXML. Can this type of data be extracted using DOMXML? If not how would one go about accessing it?
View Replies !
Help With Extracting Please Folks.!
I have this: a variable like: <a href="http://www.some_html.com/text.html" >some text</a><br> I heed to extract the "http://www.some_html.com/text.html " and put it in var "link" And extract "some text" and put it var "text",. So basically extract all between <a href=" and " > plus extract all between " > and </a><br>.
View Replies !
Extracting Text From Pdf
I have to index the text of a pdf document. Does any of you know of a PHP script/extension or a binary that is able to extract the text ? The pdf extension mentioned in the php.net docs seem to indicate that it's for _creation_ of documents only, is that so? Same with all the PHP classes i have found.
View Replies !
Extracting Information
Does anyone know where I should start with this. Im trying to extract the information in: $_SERVER['HTTP_USER_AGENT' But I dont know how to get the information out? What functions should I be looking at. I want to get the OS, Browser, IP etc..
View Replies !
Extracting A Rar File
i try to extract a rar file via php but i get an error: Fatal error: Call to undefined function: rar_open() in --parksdiary.com/httpdocs/rar2.php on line 8 Code:
View Replies !
|