How To Apply Css To A Table That Is The Only Item In A Php File Please
How to apply css to a table that is the only item in a php file please In the page that has just the one table that is to be included in the other 2 pages, there's some heavy css going on, plus the text in the table gets changed quite a lot on a daily basis. Usually, in my program, I can highlught the text that needs a different css applied to it and click on the css style that applies to it, but because the page only has the one table and nothing else, there's no mention of the link to the styles page?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Listing Table Data With An Option To Delete Each Individual Item.
Was wondering if anyone could help me with a PHP, MySQL problem. I am completely new to PHP and MySQL. I have been trying to find a way to list data from a table on a web page and after each individual item have a hyperlink to allow users to delete the information listed. Can anyone help? i.e. Name Age Sex ------------------------------------------ Adam 21 M delete Betty 22 F delete Chris 23 M delete Daisy 24 F delete ------------------------------------------------------------------------------------------------------------------------------ (delete after 'Sex' would be the hyperlink to delete that entire line (row) from the table).
Removing Item From Array Then Overwriting File
I have a bookings.txt file which has a list of dates each on a new line, for example: - 21/06/07 22/06/07 29/06/07 25/12/07 01/01/08 I also have a variable $event_dd_mm_yy which I want to remove from this file if found. Code:
Using PHP To Apply A Class
I'm struggling to find out how to use php to set a class based on certain criteria. Basically, I'm using a file called navigation.html to store my primary navigation links as a list, and I'm using php's include once to access this in my pages. Obviously this means that I only need to change the navigation once to change it on all pages. Trouble is I need to highlight the current page so that as users navigate around they know where they are. Is there some way I can use php to apply a class or id to the navigation link that points to the current page?
Recursively Apply Function?
I have an array with content describing a website, the position of the page in the hierarchy is relative to it's page_parent. Top level pages have a page_parent of "0". so the following array (in the code snippet) represents a site like: - Home - About Us - Services ----- Development ----- Graphics - Contact Us I have a function that takes $Parent and $Array and hands back only those nodes w/ the matching page_parent value. I then print out links to those pages. my question is: how can i make a Site Map by recusively applying this function? Any Ideas? Code:
How To Apply Permission Upon Upload
This code works fine on my server, but when I loaded it onto the production server, all the uploaded files have 600 permissions. How can I modify it so that upon uploading, the files have 777 permissions? Code:
Apply Color To B/w Image
I have a grayscale image, (just three colors) and I want to use php to apply color to it, so it turns, say, blue. I have a ton of these greyscale images and a lot of colors, so I want to use php to do it when needed instead of doing them all by hand in photoshop. I have done some searching but I'm not even sure what to call this.
Table To File
How do you transfer data from a MySQL table into a file(text or other viewable type), using PHP?
Iterator First Item?
Let's say I have the code: foreach($data as $row) { do something with each $row } Is there a way to do something specific to the first item iterated? Pseudocode: foreach($data as $row) { if first time through iteration do something with $row else do something which each remaining $row } Is this possible? I think I could use a regular 'for' loop, using the length of the $data array as a guide, and then an 'if..else' structure to see if it is the first time through the 'for' loop, but I was looking for a more elegant solution.
Trying To Split The Item...
I'm trying to make a search thru my mySQL database, so it any keywords are found then I'm adding the details to the next item in an array that I create. I've tested the array and it is storing the information into the array properly because it echoes out all of the information correctly. My problem is that, at the beginning of each item in the array I have information that tells me what part of the database it was pulled from and the id number and also how many times the a keyword was found in that specific database entry. So you have something like this.. Code:
Get Last Item In URL String
I realize how elementary this is, I apologize. Maybe that's why I can't find the right answer. I've tried everything from EXPLODEing the string to SUBSTR_REPLACE. Can anyone tell me how to just get the last item in a URL string? Like turn this: /mydirectory/myimg.jpg into this: myimg.jpg
How To Output From File Into Table?
I have this bit of code that opens a file, reads it line by line, and prints the filename into an image on screen, so i get a big list of images on the page. However I want it to output into a table so I can have 2 photos side by side as it goes through, is there any way of manipulating the code to output one line into one cell and the next line into the next cell then back to the first cell again??? <? $data = file('gallery/captions'); foreach ($data as $line) { list ($q, $a) = explode('|' , trim($line) ); echo "<img src='gallery/images/$q' height=100><br>"; echo "$a<br>"; } ?>
Mysql Table Vs Log File
I have been doing some searching for a tutorial on creating a simple tracking script to attach to each of my pages. The tutorials that I found are using a log.txt file instead of a mysql database. can anyone explain why not use a mysql database
Parsing An XML File Into A Table
I'm trying to parse an xml file into a table on a webpage. I'm using php5 which, I believe, doesn't support xsltproc anymore (since xml support was rewritten for php5). I have got it working on my home server using xsltproc and an xsl file on the command line (unix) but I want to transfer it to a host which doesn't have xsltproc installed and have the xml file parsed into a table by php because I know it can be done. The actual page that I'm trying to parse is here Can anyone give me any pointers/links/howtos for parsing xml files into a table using php?
Table To File Swap
I have been working on a form to input information into a mysql table along with the files. I would like to however put the files into a seperate folder on the server. Here is my code which I have been assisted with already but cannot figure out how to change it to send the actual file to a seperate folder but still keep the information linked so I can recall the file later based on a search of the information in the table. Code:
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?
Random Item Of An Array
What is the best way of picking out a random item of an array, regarding speed and CPU-usage ? I need a super fast way of picking out an ID from my MySQL db.
Search Item In Database
I made a function that does a case insensitive search. This works fine. But i'd like to improve that script so that it also returns items from the database that are partly similar to the search string. this is the script atm:
Delete Item From Database
I still can't figure out how to delete an item from my shoppingcart. I have tried different ways to do this, but its impossible. -a button or link that deletes a item from my database -the php script that deletes it here is a suggestion: $slett = "DELETE ID, VARE, MODELL, STR, ANTALL, PRIS, TOTALPRIS FROM USER_TRACK WHERE USER_ID = "$user_id""; But how can i assign this to a button?
Updating Item Numbers (or IDs)
After a while of deleting records in a MySQL db, there gets to be the gaps in the id numbering system. i.e. 1, 2, 3, 6, 7, 12, and so on. Is there a way to renumber the id system in a table for 1, 2, 3, 4, 5, 6, etc without manually going in and changing those numbers?
Returning Autogenerated ID On New Item
Lets say you have a form that when saved to the mysql database creates a unique incremental id. The form is just the first part of a series of things the user can do, so once the ID is created, the page would need to know immediately what this ID is. Is there a way to grab this ID instantly once it is created? Obviously if this were a sign-up for and a new user name and password are involved, you can have the user login after the initial set up and this select statement would bring back the ID. But the situation I have doesn't work like that. The way I have been dealing with this is simply to have a select statement after the initial insert that requests the record based on a couple of other fields that are likely unique. But this seems like a rather kludgy way of doing it. Is there some other solution.
What Does `Catalog`.item Like '%A-%' Mean? -MySQL?
I am looking at an old query and I cannot remember or figure out what this part of the query means: `Catalog`.item like '%A-%' It is the like '%A-%' I cannot figure out. Then entire query is:[color=blue] > SELECT * > FROM `Catalog` > WHERE `Catalog`.img_status = Ƈ' AND `Catalog`.item_type ='R' AND > `Catalog`.item like '%A-%' > ORDER BY `Catalog`.item_type[/color] And will not work without the Like part
Pulling In One Item Of Four Categories
Ive got an offers table which contains name, category_id I want to display all offers, however the first page will only display four offers (one of each category). My query is as follows so how do I do this part? Code:
Finding # Of Item From Query
I have a query that goes "SELECT item_name FROM products WHERE products.drink = 'juice'" . If I get back 12 results from this query I can make a list using a simple loop, that is fine . If I click on one of these list items I want to go to a detail page, again I can do this no probs. How do I carry over to the detail page the number that the item appeared in the original list, for example if a result was "orange" and it was the 5th one in the list, how do I carry over the number 5 to the detail page?
Import CSV File Into Database Table
Are there any programs like phpmyadmin, that allow you to import CSV files without first converting them into mysql statements? mysql front? I've created the table and fields, and it should be easy enough to import the data into its respective columns.
Create A Table Regarding A Text File
I have this .txt file : Roger|tow25$rank259 Isabelle|tow36$rank24 Pascal|tow12$rank29 Sergeď|tow45$rank5 Michel|tow1245$rank45478 Frédéric|tow1$rank125425 And this programm php3 <?php $fichier = "classeur.txt"; if($fp = fopen($fichier,"r")){ $ligne=1; echo "<table border=1 bordercolor="#00CCFF" width=500> "; echo "<tr align=center><td colspan=3>TITRE</td>"; while (!feof($fp)) { list( $name, $tampon ) = explode( "|tow", $fp ); list( $tow, $obj ) = explode ( "$rank", $tampon ); echo " <tr>"; echo "<td align=center><b>Nom".$name."</b></td><td>Tow".$tow."</td><td>Obj".$obj."</td[color=blue] >";[/color] echo "</tr> "; $ligne++; echo "</table> "; echo "$cell"; fclose($fp); }else{ echo "Error : open impossible ".$fichier; exit(); } ?> I would like to past each value of the lines in the tex file, in 3 variables $nom; $tow; $obj and create a table with 3 column ( column 1 the name, in 2 the tow, and in 3 the obj)
Tab Delimited Txt File To Php Html Table
Wouldn't you know that when I finally find a tutorial using Google that does exactly what I want, the code doesn't run when I use it ... However, when it gets to this line, for ($i=0; $i<td>$line[0]</td>, it chokes on one of the '>'. Since my php skills are very basic, and in no way include arrays, can someone assist me with this? If it's easier to do it differently, what I'd like to do is create a table in Excel/Access, export it to the server (to a tab-delimted text file, since I'll be using commas in my table cells), and have it display in an HTML table. If I can't figure this out, I'm tempted to just export to HTML from one or the other program (not sure quite yet which I would use), so ...
Populating Table With Text File
My web hosting service uses phpMyAdmin and at the bottom of the screen iis an area where I can upload a text file to populate a table. I have a table named groups with two fields: groups_idauto-increment primary groups_name So how do I create my text file to populate this table? I'm going to use MS Notepad. If it's set to auto-increment, do I need to include the number? If so, does it start at 0 (zero)? Would the file look like: 0,students 1,faculty 2, staff or just students faculty staff
Populating Form Item From SQL Enum Set Rev#2
$sql = "SHOW COLUMNS FROM table LIKE 'subject' "; $qry = mysql_query($sql) or die("Query not valid: " . mysql_error()); $res = mysql_fetch_object($qry); // This returns a row with a field 'Type' containing 'enum(...)' $res->Type = str_replace('enum('', '', $res->Type); $res->Type = str_replace('')', '', $res->Type); //now the string is something like this: one','two','three $temp = explode('','',$res->Type); //temp is an array with as much elements as the enum while ($temp) print array_pop($temp); This way is much more easier using the elements since they are elements of an array. Cleaver isn't it?
Shopping Cart Item Array
Trying to build a small simple shopping cart and I am having difficulty getting the solution. The cart is displaying each product, but it is overwriting the values. So if I have added 10 products, it shows ten items, but each item has the values of the last product I added. I think that this may be due to me trying to use a key to store both an array and string at once, but Iam not sure. I have looked at other examples but due to different methods, syntax is throwing me off. Code:
Remove A Single Item From An Array
I have gathered an array of ID's. I need to go throught the array and find a specific ID and remove it from the array. Because we want to keep that ID. Any suggestion of how to do that.
How To Replace An Item In The Url Search String
Using PHP 4, what is the most elegant way to replace a parameter value in a url query string? I want to replace the "Order" parameter, but it could occur anywhere in the query string. myfile.php?Param1=Hi+there&Order=ColumnA&Param3=Bye+Bye myfile.php?Order=ColumnA myfile.php?Param1=Anotehr+example&Order=ColumnA after applying this function, I'd like the result of the above examples to be myfile.php?Param1=Hi+there&Order=ColumnB&Param3=Bye+Bye myfile.php?Order=ColumnB myfile.php?Param1=Anotehr+example&Order=ColumnB
Add Item To Shopping Cart Problem
i have a cart link in all of my listed products on the site. when i press this link i will generate a url like this http://www.mysite.com/index.htm?loc...art&productid=3 after i press this link the site cart.php will be included and add the wanted product to the cart, and show the cart. my problem now is after the cart is showed with the new product in it, when i press the F5 key in the browser to refresh the site, the same product will added to the cart once more, because the previous generated url is unchanged in the browser. have anyone a idea how to fix this problem?
Language Depending Item Url's
I'm using a little newsflash item on my webpage, which is some text in an iframe. I have one newsflash item in English and one in another language, newsflash-english.html and newsflash-other.html How can I serve newsflash-english.html to english surfers and newsflash-other.html to not english users ? depending on the browser language ?
Redirecting To The ID Of Newest Item Created
I have a form that a user submits which creates a product. I want the user to be redirected to product.php?product_i=(the new product id) The problem i'm having is that i dont know the ID of the new product created because the table is set to auto increment. How would i go about finding out the new ID and redirecting to that new product after it has just been created?
Selected Item To Use For Multiple Variables
I've got a list of 'items' and those 'items' have unique 'categories'. I have 1 table for 'categories' that contains a list of category_ids and their 'category_names'. The other table is the 'item' list. And here's where I'm running into difficulty, I'd like to have the 'item' table contain the category_id from my 'categories' table as a Foreign Key and that category_id's 'category_name' in a 'category' field. I'm getting the Foreign Key, but I can't seem to grab the 'category_name' and assign it to my $category variable in the 'item' table. I've got a page to insert items and a page to update these items. I was working with the update first. And I'm able to grab the list of categories and select the correct one, but I'm not seeing where to assign the category_name to the $category variable. Here's dropdown list: Code:
Place File Contents Into Table On Page
Hi all. Am new to PHP and trying to get the following to work. I dont know if it is possible at all, and would appreciate any help. I have a folder called Books. It contains an htm page called books.htm which has some graphic elements on it. It also contains a file (either excel or csv, or tab delimited.... whichever will work best in this situation). This file contains two columns. 1st colums-1st row contains an image name (e.g. alice.gif). And the 2nd column-1st row contains a text discripition (e.g. Alice in Wonderland....bla bla..). And so on for the next rows. The folder also contains the actual 'alice.gif' and all images that are listed in the 1st column. What i am trying to achive is thus:- When the books.htm page is called. I want the table in the file to be recreated on the page under the existing graphic elements. In that table, instead of the image names in the first column, i want the actual image (which is present in that folder), to be planted there in that specific cell on the htm page!
Downloading File Stored In Mysql Table Through Ssl
I have a table where I store some binary data. To retrieve this information as a downloadable file, I use the following code: header('Content-Type: $mimeType'); header("Content-length: $size"); // for filename, i store the filename in the table, so this does not actually // point to a physical file name on the file system header("Content-Disposition: attachment; filename=$fileName"); header("Content-Description: PHP Generated Data"); echo $data; return true; If I go through a normal port (http), the file downloads no problem. When I try this through ssl (https), I get the following error: 'Internet Explorer cannot download / from 192.168.0.9.' Through port 80, the filename is set correctly. Through ssl, the filename doesn't seem to be getting set. Is there a problem with using 'Content-Disposition: attachment' through ssl?
Updating Passwords In A Table By Reading A File
I wrote a loop that reads a csv file which contains passwords for users in a table. and when I run my script, it reads the file fine and updates the passwords next to the appropriate user but it adds two little squares behind the passord. for example, password[][]. it looks something like that. does anybody know why this is? array for storing the values
Multiple Table Insert From Tab Delimited File
I have a page I'm coding for batch updates from a tab delimited file. Each row has data that has to be checked against and inserted/updated on different tables in my mySQL database. How would I go about parsing through the tab delimited file and then storing data between the tabs in order to insert individually into separate tables?? Here's what I have so far... $contents = file('/myfile.txt'); for ($i=0; $i<sizeof($contents); $i++) { $line = trim($contents[$i]); $arr = explode(" ", $line); $line[$i] = array('ID' => $arr[0], 'Record_Type' => $arr[1], 'First_Name' => $arr[2], 'MI' => $arr[3], 'Last_Name' => $arr[4], 'Firm' => $arr[5], 'Address' => $arr[6], 'type' => rtrim($arr[13])); I need to take the different columns.. ID, Record_Type, etc. and update different tables with each value where the IDs match.
Explicit Numeric Keys Vs Item Position
Say if I have a mixed array: $array = array("item1", "2"=>"item2", "5", "item4key"=>"item4") Is it possible while looping through the array (foreach ($array as $key=>$val)) to check if an item has an explicit key specified instead of its automatically assigned position key?
Choose Random Item From List But With Different Weighting
I want to choose an item at random, but have different probabilities for each item. One easy way is just to create an array like $a[]=1 $a[]=2 $a[]=3 $a[]=3 That way a random number between 1 and 4 would give the weighting I want, but it seems like there has to be a much smarter way to do this. I've seen some algorithms for random distributions, but they don't quite do what I want. Oh yeah - must not require a DB; this should work with values from a CSV or similar ...
|