Building Table By Column Rather Than By Row
I'm currently looking for a way to populate some html tables of varying lenghts and widths, pulling the data from arrays. I want to achieve this with a function in order to make this as dynamic as possible. example: function build_table($data){ ... }
$data would be an array containing a varying number of sub-arrays, the first array would populate the first row (column headings) and each subsequent array would be the data for each column rather than each row. Code:
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Extracting Database And Building A Table
I have a mySql database with tblDiary DateEmployeeClient 1/1/04SmithBloggs 2/1/04JonesUnited 2/1/04SmithCentral .....etc tblEmployee NumberName 1Smith 2Jones ....etc Thing is I need to get it to display HTML in a date table like this: MondayTuesdayWednesday...etc 1/1/042/1/043/1/04 SmithBloggsCentral_____ Jones______United_____ ....etc and if the user clicks on say Bloggs it takes them to the booking so it can be amended or if they click on _____ it sets up a new entry in tblDiary. I will be using tblDiary.Data and tblDiary.Employee as a compound primary key.
Building Dynamic Report Page On Table Data
I am posting this message to this forum because I need some advice and some help with building a page to produce a report from the database I am building. Firstly, however I will post the table structures for the involved tables..... Code:
Column Table
I have a table of records; the records belong to different user ids and are distinguishable by a reference number, Each record has a price. so theres a price column. The problem isnt getting the total of the whole column. the problem is getting the total for the specific user id and displaying it at the bottom of the price column.
Column Data From One Table To Another
im trying to get the vend_name column data from one table(manuf) into another table (products2) that has the same vend_name column which is empty but has a vend_code column as a key identifier. im wondering if theres a way to put the data from the vend_code column and vend_name column from the first into an array so that i can populate the vend_name column of the 2nd table this is what ive come up with below, it seems to be just puting the last record into those two array variables PHP Code:
Check If A Table Has A Column Or Not?
I've got a training center for a bunch of different animals, but these animals don't have the same stats. So, basically, I want all of the animals to be available to train, and if they try to train an animal, I need code that checks if there is a certain column in a table, or if that animal has a specific stat. How would I do this?
Create A One Column Table
Using the following code, how do I create a one column table, with "Firstname, Lastname & Sex" as the heading. Also, how do I display the row data (i.e Firstname etc) using the following format?: Code:
Displaying Information In A 1 Row/2 Column Table
I'm very new to php scripting and haven't quite figured out what I need to do here. I need to display information in a 1 row/2 column table. I have the MySQL query working fine, but the scripting part in php is killing me! In the first column a graphic about 70x70 will be shown (plus some additional padding). In the second column will be the description information. The second column will be around 400 pixels wide. How do I set this up in php? It's easy enough in HTML, but I've about killed myself trying to figure out how to properly lay this out in php!
SELECT * FROM Table WHERE Column IS NOT NULL
I am running the following MySQL query: <?php $sql = mysql_query("SELECT * FROM comics WHERE story_arc IS NOT NULL") or die (mysql_error()); while($row = mysql_fetch_assoc($sql)) { echo $row['title']; } ?> The problem is that it is outputting all 4000+ records, when it should only be about 100. Is there an error with my 'IS NOT NULL'?
Search Only Works With Table Column Name
I have tried several different codes to create a database search of a table that includes column name "Product," "Price" and "InStock." I am trying to search the "Product column and in each code when I enter a term I know to be in the table it comes up with an error (usually "Unknown Column 'input' in 'where' or mysql_fetch_array(): supplied argument is not a valid MySQL result resource in"). The only way the search works is if I enter the actual name of the Column (in this case "Product") and it displays the entire table.
Recursive Array From A Twin-column Table
I have a MySQL table with two columns: catagory and parent. Parent contains the parent catagory of the catagory. I need to query the db ONCE, assigning the info to an array, then create a recursive array parenting catagories and grouping accordingly.
Displaying SQL Query Results In 3 Column Table
I would like to be able to display the results of an sql query in an html table, but the results need to be displayed in three columns, for example: Column 1 Column 2 Column 3 Result 1 Result 2 Result 3 Result 4 Result 5 Result 6 Result 7 Result 8 Result 9 I've tried to find the answers on the internet but i can't find anything that suits my needs!
Valid MySQL Database/table/column Name Regexp
regular expression in PHP which could be used to check that a proposed (My)SQL database/table/column name is valid, i.e. shouldn't result in an SQL error when created? The user of my (hopefully to be opensourced) program has the ability to create database/table/column names on the fly. I'm aware of obvious characters such as ., [space], things like >, etc., which won't work, but haven't been able to source a definitive list, including having googled the MySQL site. Obviously certain characters need to be filtered out, as noted above, but I want to be as unrestrictive as possible; hence just [a-z]* isn't good enough because things like _ are acceptable. Ideally, I'd prefer a regexp that applies to _all_ vendors' databases, not just MySQL as I'm about to migrate the program to being database-independent, probably using PEAR DB, but even a MySQL-specific regexp would do the job. In the longer term, I plan some sort of entity conversion script so that theoretically any character could be used, using some sort of escaping mechanism probably.
Select From Drop List To Fill Table Column With Text -- HOW ?
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the column below. The viewer can select states from the drop down lists above the other two columns as well. If the viewer selects only one, only one column fills. If the viewer selects two states, two columns fill. Etc. I could, if appropriate, have a separate htm page with the text for each state -- california.htm for example. When the viewer selects California from the drop down list, the column below would "fill" with California.htm. Or, I could conceivably use a text or mysql database with two fields for each record: state_name and law_text -- but it would probably be easier to use separate htm files, since there will only be about 20 states involved, and the "database" would never have a large number of records. The table width would be 100% and each cell would be @33% My site is designed with FP 2002 and runs on Apache/FreeBSD. I have just had Apache-ASP installed but I have not yet configured or used the module.
Display Database Output In Mutli Column Html Table
I am building an HTML form using data from a mysql query. The data to be displayed on the form is 1 column from the db - but multiple rows. Because there are many rows (well, only about 100+) in the table I want to be able to put 2 or 3 (space permitting) rows from the result on each row of the HTML table with a checkbox beside each entry from the db table. The idea is that the user will scroll down the list and check up to 4 or 5 boxes before submitting the form and I didn't want them to have to scroll ALLLL the way to the bottom (100+ rows). I understand how to get data from a db table and put it into an html table, but I cannot figur out how to put more than 1 row from the result on to the same row of the html table. I hope I haven't confused anyone reading this -- If I am way off base with what I am trying to do please give me alternatives. I am trying to avoid paginating the data for a couple reasons a) clicking a next and/or prev button is more hassle than just scolling down a list and b) the data in the column being displayed is only about 35 - 40 characters and it seems to be if i only placed one result row on each html table row, there would be a lot of wasted space.
Why Is My MySQL Table Building An "Overhead"/what Is That/how Can I Prevent It?
I hope you'll be nice to me and let this post go through even know its mysql and not directly php. But of course my script is php. The problem is, that my Table (1,8 MIO entries/100 MB/MyISAM) is not working anymore. Everytime my script wants to write in something the number of entries decreases, and at the "Overhead" column the number is growing. How can I make my table work without that overhead problem, without any further crashes and without loosing my data? If I use the repair or optimize function (phpmyadmin) the overhead is deleted, but the data is still lost, and the next time my script trys to put in something more entries will be deleted.
How To Query From One Column Then Sort Using Another Column
I am trying to get the last 100 albums I entered into my database using the album_id (Highest being the latest entry) then sort them alphabetically using the album_title column. I can get the latest 100 easily but cannot figure out how to also sort the results by the album_title before I display them. This is what I have so far which gets what I want but not in alphabetical order. <?php $sqlquery = mysql_query("SELECT * FROM albums ORDER BY album_id desc limit 100", $db); while ($result = mysql_fetch_row($sqlquery)) { echo "<a href='music_info.php?album_id=$result[0]'><span style='text-decoration: none'>$result[1]</span><br></a>"; } ?> I have been trying to add a second ORDER BY to the query like so. $sqlquery = mysql_query("SELECT * FROM albums ORDER BY album_id desc limit 100 ORDER BY album_title", $db); but this obviously isn't the way I should be doing it.
Building PHP 4.3.3 With GD 2.0.11
All libraries were installed (precompiled) This is FreeBSD 5.1 installed zlib, installed jpeg and png libraries (in default directories) GD 2.0.11 source is in /usr/gd-2.0.11 (compiled and installed flawlesly) I configured PHP with the following: ../configure --with-gd=/usr/gd-2.0.11 --with-freetype-dir=/usr --enable-g d-native-ttf --enable-gd-imgstrttf --with-jpeg-dir=/usr --enable-png- dir=/usr -- with-zlib --with-mysql --with-apxs2=/usr/local/apache2/bin/apxs When configure came to reading jpeg header, it gave me an error about libjpeg.a I need GD, because I want to use coppermine (picture gallery) on my "future" web site. Contents of config.log file (from here to end of message): This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. configure:1618: checking host system type configure:1706: checking for gcc configure:1819: checking whether the C compiler (gcc ) works configure:1835: gcc -o conftest conftest.c 1>&5 configure:1861: checking whether the C compiler (gcc ) is a cross-compiler configure:1866: checking whether we are using GNU C configure:1875: gcc -E conftest.c configure:1894: checking whether gcc accepts -g configure:1927: checking whether gcc and cc understand -c and -o together configure:1942: gcc -c conftest.c -o conftest.o 1>&5 configure:1943: gcc -c conftest.c -o conftest.o 1>&5 configure:1948: cc -c conftest.c 1>&5 configure:1950: cc -c conftest.c -o conftest.o 1>&5 configure:1951: cc -c conftest.c -o conftest.o 1>&5 configure:1978: checking how to run the C preprocessor configure:1999: gcc -E conftest.c >/dev/null 2>conftest.out configure:2059: checking for AIX configure:2086: checking if compiler supports -R configure:2101: gcc -o conftest -g -O2 conftest.c -R /usr/lib 1>&5 configure:2159: checking for ranlib configure:2187: checking whether ln -s works configure:2212: checking for gawk configure:2212: checking for mawk configure:2212: checking for nawk configure:2246: checking for bison configure:2246: checking for byacc configure:2290: checking for flex configure:2324: checking for yywrap in -lfl configure:2343: gcc -o conftest -g -O2 conftest.c -lfl 1>&5 configure:2367: checking lex output file root configure:2388: checking whether yytext is a pointer configure:2407: gcc -o conftest -g -O2 conftest.c -lfl 1>&5 configure:2431: checking for working const configure:2485: gcc -c -g -O2 conftest.c 1>&5 configure:2510: checking flex version configure:2650: gcc -o conftest -g -O2 conftest.c 1>&5 /var/tmp//ccQc5UBs.o: In function `main': /usr/php-4.3.3/configure:2646: undefined reference to `pthread_create' configure: failed program was: #line 2632 "configure"...
Building PHP 4.2.x
I was able to build php 4.0.*, (apache 1.3.26, solaris 8) and now want to install the newest version. Here's my issue, i'm runing confgure with: configure --with-apxs=/opt/apache/bin/apxs it seems to make it through this part fine, then i run make and my output is below. I don't want mysql support or anything. The same steps work when i do it with php 4.0.* though, so i'm confused. Code:
Building Url From Variable
I am trying to do the following: I want to assign a string to a variable then use that variable in an HREF as follows: <html> <head> <title>Test Doc</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php $var = "123.htm"; ?> The variable $var has a value of:...
Building Diary
I am building a month view of a diary and am enlisting the help of some previously created script. Although I understand how the calendar1.class creates the table, I am not being clever today and stuck on how to get the data into each day with an event/appointment. The diary entrys need to be identified by thier cal_id in a SQL table and there is a start and end time to each entry. In each day I need to show the summary of the event and the start time and end time. Can you point me in the right direction? Here is the calendar class: PHP Code:
Building XML From MySQL
I'm getting 'Call to undefined function: new_xmldoc()' when I try the following script. Does this mean that new_xmldoc is not a valid function. I could not find it in the manual. Here is the script: PHP Code:
Building A Class
i'm building a class for a upload form and i want to know whats the best way to handle error in a class, like if someone enters a bad email or a bad password whats the best way to stop the class from keep going. Code:
Creating A Building Map
I am looking to impliment a digital maping system similar to google maps where I can take floorplans of my company and map assets to certain locations and search for them after. like google-maps meets an office people-finder so that when you are looking for printer 23-541-a you can just put it in the interface and it will bring up the map of where the asset is in the company.
Building An 'if' Condition On The Fly.
I would like to create the condition of the 'if' function on the fly, meaning : $condition="$a > $b"; // this variable is a string that contain the 'if' condition .... $a=1; $b=1; if ($condition) { ... } I hope you see what I mean here... In fact, I try to build the condition of the 'if' function so at the end it 'virtually' looks like this: if ($a > $b){ ... } Of course, here that does not work because $a=$b. Code:
Building A Dynamic If Statement
I am trying to build a dymanic "if" statement for the purpose of building a dynamic evaluation criteria to run agains a set of text data. If I were working with MySQL, it would look like: $q ="Select * From table"; $q .= " WHERE id > 0"; $query = mysql_query($q); However, since I am buiding something that looks like: $q = "($X >= $min) && ($X <= $max)"; if ($y != ''){ $q .= " ($Z == $y"; } $q .= ")"; if ($q){ do stuff } Problem is that I know that the "if" is only evaluating whether or not $q is true. I need an alternative to building the dynamic if based of the search criteria the user enters (there are 7 options).
Building A Multi-pages RTF Doc
I'm retrieving datas from the DB (i.e. name, first name and address) and I want to generate standard pages using a RTF document I'v made. To be more simple, I'm trying to make a mailmerge in PHP. I have a template called template.rtf. I open it, store the content into a variable, make the replacements and generate a RTF file that the user can download. This is OK if I have only one recipient. But as I have 10 recipients in my DB, I'd like to generate a 10 pages RTF file, and then force the download of the generated file (the user would be able to save or print the new file). How to generate a 10 pages rtf using a single page rtf template?
CLI Doesn't Install When Building From Source
I compiled 5.2 from source using the usual procedure and noticed that only the cgi binary was copied to the /usr/bin directory. The CLI binary was compiled but not copied over as I had expected. I manually copied it to the /usr/bin directory as "php-cli" and everything worked great.
Building GET Query Strings
I am currently building a sports web application and have run into a design question. In order to create a new coach record, there are two pieces of information that are needed: 1) username 2) team_id It seems to me that the best way to do this is to break the problem into two parts. First, search for the username and append that to the URL: http://www.mysite.com?username=john Next, I would present the user with another search box to search for a team and then add '&team_id=1' to the GET url. The final URL should look something like http://www.mysite.com?username=john...action=addcoach Does anyone know of a good example out there for doing this in a methodical and elegant fashion?
Building An Array Of Files
I'm working on a function to map a php project that's gotten a little unwieldly. I'd like to have a reference of all files like the output of the unix tree command, like this: .. |-- index.php | |-- menu.php | |-- content.php | |-- admin_page.php | | |-- admin_function1.php.inc | | |-- admin_function2.php.inc | | |-- admin_function3.php.inc | | `-- admin_subpage.php | | |-- admin_subfunction1.php.inc | | |-- admin_subfunction1.php.inc | | `-- admin_subfunction1.php.inc | `-- user_page.php | |-- user_function1.php.inc | |-- user_function2.php.inc | |-- user_function3.php.inc | `-- user_subpage.php | |-- user_subfunction1.php.inc | |-- user_subfunction1.php.inc | `-- user_subfunction1.php.inc | |-- orphan_page.php `-- deprecated_page.php I have a function that can create such text output ( or close enough ) from an array structure like this: Array ( [0] =./index.php [1] =Array ( [0] =./clients.php [1] =Array ( [0] =./login_function.inc [1] =./client.php [2] =./client_new.php [3] =./client_edit.php ) [2] =./inventory.php [3] =Array ( [0] =./login_function.inc [1] =./inventory_item_add.php [2] =./inventory_item_remove.php ) [4] =./daily_report.php [5] =./weekly_report.php [6] =./monthly_report.php [7] =./catalog.php [8] =Array ( [0] =./login_function.inc [1] =./catalog_item_add.php [2] =./catalog_item_remove.php ) [9] =./orders.php [10] =Array ( [0] =./login_function.inc [1] =./view_order.php [2] =./order_new.php [3] =./order_edit.php ) [11] =./invoices.php [12] =Array ( [0] =./login_function.inc [1] =./view_invoice.php [2] =./invoice_new.php [3] =./invoice_edit.php [4] =./invoice_print.php [5] =./invoice_email.php ) ) [2] =./clients_old.php [3] =./old_inventory.php.....
Building A PHP Site Test Bot
I run quite a large website, and we are going to need to migrate to a new server soon. I have a few hundred PHP pages. The problem is testing them, after i have moved the files to the new server. I can try my best to set up the server in the same way. But the server was first configured a long time ago. Is there a way for me, using cURL and Regex to maybe get php to follow all links on my site, and Detect 404 errors and PHP errors. Im not too good with cURL yet, though learning. And regular expressions im not great with either.
Building Dynamic Forms
I am trying to build a form that allows the user to choose the options from a large zipcode database that we have. What we would like to do is for the user to enter in the State, City, and Zip code based on data going to and coming back from the database. Here is the scenario: 1. User selects the State from which they are in from a form dropdown menu. (A query from the zip code database gets done and brings up the cities and fills in the next dropdown menu dynamically) 2. Then the user selects a City (A query from the zip code database gets done and brings up the zip codes from the city entered above for the next dropdown menu dynamically) 3. The user select which Zip Code they live in. PROBLEM: I want the form dropdown menus to be generated automatically when the user selects the option from the previous menu. I know how to do the above if the users go from form to form filling out information. But in this case, it would be much simplier to just have the choices be generated dynamically. I know that I will need to do an OnChange command for the menu, but alas my Javascript Programming isn't up to par.
Building Libpdf_php.so For FreeBSD
I wanted to use the pdflib library for creating pdf on the fly. My web server is running onto freebsd4.2+apache1.13.12+php 4.0.4pl1. I copied the binary library [libpdf-php.so] supplied by pdflib for freebsd and "installed" into php.ini using the extension directive. I create a simple script and it works fine. As stated by pdflib this is a demo version. So I decided to compile myself the pdflib library. This kind of operation has no support by pdflib staff, so this is why i ask to you. I see that inside /usr/local/lib I have a file libpdf.so, it's size is about 1.3 MB. So i replaced the old .so demo with the new one compiled but now the script tell me that pdf_new function is not supported. This is mean of course that i'm using a bad file. i do not want to compile pdflib into php because my web provider gives to me php as a module for apache,but i simply (hope easily) want to build the pdflib_php.so for freebsd from sources.
Building A Function For Ereg_replacements
for our upcoming zine we are naturally filtering our writers' submissions so that their input doesnt meddle with the coding. i've done all the ereg_replace calls for what we want to substitute certain formatting options with. such as bold, urls and Code:
Building An Online Poll
how I should go about starting a web poll script. The purpose of the web poll is sort of like a "Class Poll" for my school. Which pretty much means that there will be a number of categories such as "Shyest" "Friendliest" "Most Athletic" and so on. Then each category will have a drop box with the names of the students in each class 80 or so names. A student will come to the poll browse the categories then vote for a person by selecting their name from the drop down box, once they are completed the click the submit button. The results will be based on has the most votes for that category will be the winner. Now I am unsure how to go about the infrastucture of the script do need to use a database or can this be acomplished with arrays.
Building Php Extensions With Cygwin
Has anybody managed to build a Php Extension (Loadable Module) under Cygwin. I tried to build the example first_module found on http://www.zend.com/zendapi. It compiles and works well under linux. Under windows with Apache 2.0.48 or 1.3.29, I managed to compile it using cygwin compiler but I have the following message : Warning: dl(): Unable to load dynamic library 'c:phpextensionsfirst_module.dll (of course, the file is located in the good path) I only found tutorials using Visual Studio so any experience feedback about a similar problem would prove to be very usefull.
Building A Dynamic Query
I'm having a problem with this script. I want the user to be able to define some options before submintting a form and displaying the results. This is the script that render the form: PHP Code:
Building PHP With Mysql And Mysqli
I am trying to build PHP 5.0.4 with both Mysql and mysqli and I'm not having any luck. It keeps barfing on the libraries. How do I build it such that I can enable both. I know it can be done, but am not sure how.
Building An Array From A Database
Just a quick questions. I'm retrieving two fields from a database one being "id" and the other "name". I am currently using this to load the results $i=0; while($row = $db->fetchArray($results)) { nameArray[$i] = $row; $i++; Which fetches the results by Association and gives me these results: Array ( [0] => Array ( [id] => id1 [name] => FirstName ) [1] => Array ( [id] => id2 [name] => SecondName ) ) is there some way to modify the code so I get this result: Array ( [id1] => FirstName [id2] => SecondName ) It seeem like it should be possible but I just can't seem to work it out.
Building Php Extensions With Cygwin
Has anybody managed to build a Php Extension (Loadable Module) under Cygwin. I tried to build the example first_module found on http://www.zend.com/zendapi. It compiles and works well under linux. Under windows with Apache 2.0.48, I managed to compile it using cygwin compiler but I have the following message : Warning: dl(): Unable to load dynamic library 'c:phpextensionsfirst_module.dll (of course, the file is located in the good path) I only found tutorials using Visual Studio so any experience feedback about a similar problem would prove to be very usefull.
Building A String In A For Loop
When adding strings together I have read that the code is: $msg = " blarb"; $msg .= "blarb"; // with a dot OK, so can someone help me in understanding how this can be achieved with a for loop. So far I have: for($cnt=0;$cnt<$max;$cnt++) { $invoice_msg = "$orderline[$cnt] "; } obviously, the loop keeps replacing the contents of the variable.
Building Thumbnail Page (mysql)
I need some help (php rookie) to build a thumbnail page using php. I'v a mysql database containing links to the original image files. No thumbnails created so far. It would be nice when the thumbnail contains a link to the original file.
Errors Building PHP4.3.8 With MySql
I'm having a problem compiling PHP 4.3.8 with MySQL standard 4.0.20. There errors are: ext/mysql/php_mysql.o: In function `zif_mysql_create_db': /download/php-4.3.8/ext/mysql/php_mysql.c:1160: undefined reference to `mysql_create_db' ext/mysql/php_mysql.o: In function `zif_mysql_drop_db': /download/php-4.3.8/ext/mysql/php_mysql.c:1202: undefined reference to `mysql_drop_db' I've looked through usenet and found some other similar problems, but none of the solutions (i.e. duplicate mysql.h files) seems to be my problem. The config paramater is --with-mysql=/usr/local/mysql which is a symlink to the mysql 4.0.20 build directory. Does anyone have an idea about this?
Building Queries With Session Variables
I'm quite new to PHP so apologies if this is a really simple problem. I'm using a session variable to store a userID after login and trying to build a query using this variable. I have session_start() at the top of each page and have registered the variable like so ($username is an e-mail address taken from some user input)... $user=$username; session_register("user"); By echoing it on each page I can see that the $user session variable is correctly passed through several pages (where it doesn't get used), but when I come to actually use it to build a query using the following line of code... $getmovlist="SELECT movTitle, movYear FROM movie WHERE movID=(SELECT movID FROM fMovie WHERE uID='" .$user ."')"; .... the query which is constructed is... SELECT movTitle, movYear FROM movie WHERE movID=(SELECT movID FROM fMovie WHERE uID='cxi03u') which returns nothing as the end of the email address (@cs.nott.ac.uk) has been cut off. If I echo the variable before inserting it into the query it outputs the variable correctly (cxi03u@cs.nott.ac.uk) alongside the incorrect query, but then if I refresh the page the value of the variable has changed to cxi03u.
|