Saving A Result To Another Table
I have a script that will print out the results of a table and make a
calculation of a total of one of the columns. See example:
<?php
/* Database connection */
include(MYSQL_CONNECT_INCLUDE);
/* Select all pilots */
$query = "SELECT * FROM pilots ORDER BY pilot_num ASC";
$result = mysql_query($query);
/* Determine the number of pilots */
$number = mysql_numrows($result);
if ($number > 0) {
/* Print roster header
Change this HTML to fit your webpage layout */
print "<table>";
print "<tr>";
print "<td bgcolor=#000080 width=85 height=12
align=left><font face=Arial color=#FFFFFF
size=2><b>NUMBER</b></font></td>";
print "<td bgcolor=#000080 width=120 height=12
align=left><font face=Arial color=#FFFFFF
size=2><b>NAME /
EMAIL</b></font></td>";
print "<td bgcolor=#000080 width=130 height=12
align=left><font face=Arial color=#FFFFFF
size=2><b>CITY</b></font></td>";
print "<td bgcolor=#000080 width=93 height=12
align=left><font face=Arial color=#FFFFFF
size=2><b>COUNTRY</b></font></td>";
print "<td bgcolor=#000080 width=93 height=12
align=left><font face=Arial color=#FFFFFF
size=2><b>FLIGHT
TIME</b></font></td>";
print "<td bgcolor=#000080 width=75 height=12
align=left><font face=Arial color=#FFFFFF
size=2><b><center>STATUS</center></b></font></td>";
print "<td bgcolor=#000080 width=75 height=12
align=left><font face=Arial color=#FFFFFF
size=2><b><center>LOG
BOOK</b></center></font></td>";
print "</tr>";
View Complete Forum Thread with Replies
Related Forum Messages:
Saving Result Of Function Without Being Echoed
I am trying to save the function "rand(1, 1000000)" in a variable but when I am for example trying: $randomnumber = rand(1, 1000000); it is executing it right ahead while when i try $randomnumber = "rand(1, 1000000)"; or $randomnumber = 'rand(1, 1000000)' It is saving rand(1, 1000000) as variable. But what I need is a variable saving the result of rand(1, 1000000) so the number does not change either. Any ideas how I would do this?
View Replies !
ImageJPEG() - Saving Result From Browser With Filename While Using Sessions
I've created a PHP file called filename.jpg. It outputs a JPG. I've set up a .htaccess file to force the filetype to PHP. The file is displayed in a page on a browser. I cannot get the damn thing to save as my suggested filename or even as anything but a BMP in IE6. I've tried a bunch of different combinations of the content-type and content-disposition (inline, attachment, filename, name) headers. Nothing has worked. I've tried all combinations of the following header() string (regex for brevity-I didn't actually use the regex characters): Content-(T|t)ype: image/jpeg(; (file)?name="?xx.jpg"?)? with and without: Content-(D|d)isposition: (inline|attachment)(; (file)?name="?xx.jpg"?)? followed by: ImageJPEG($im,'',60); After many hours pounding my head against the wall and RingTFingM, I realized 2 things as I was writing this post. The first is that I'm using session_start(). Take it out and I have no trouble. The second is that I've encountered this problem before, spent hours on it, and finally gave up and passed all parameters to the script by $_GET. I'd rather not do that again. The image is being used as a server-side image map. Does anyone know how I can use session_start AND the Content-disposition header? I've tried placing the header before session_start, to no avail.
View Replies !
Format Table With PHP Result
I have to create some kind of dynamic page, logic is next: i have integer in variable and i need to create certain number of fields based on that int. example $variable = 6 and I need to have table with 6 fields, 4 in one row and 2 in second....my problem is how to do that, how to get new <tr> when number in bigger than 4.
View Replies !
Mysql Table Result
I have a product page which grabs a product, lets say the ID = 1. At the bottom of the page it grabs the 2 latest products created by that user. I would like it to grab the next 2 products in the database instead of the latest. So, Product 1 Other Products Product 5 and Product 6.
View Replies !
Create Html Table With Php Result?
I'm looking to display 5 records in one rows, from the database. What i mean is, basically, let's take the "emails" as an example. I have a table with 100s of email addresses. Now i want to display these email addresses on a html table, but i want to display only 5 email adresses per table row, then the next 5 in the next table row and so on.
View Replies !
Select Result On Empty Table?
can't remember how to do this, doing a select on a db like so. $query = "SELECT user_id FROM tool_user WHERE user_name = '$user_name'"; $query = mysql_query($query) or die("eek"); which will work if there is at least one entry in the database table, however how do i return a result id the table is empty? do i need to use @mysql_query($query) and then something after that?
View Replies !
Display Of Mysql Table Result...
I have a mysql table of articles with fields: - recordID - department - articleTitle - articleText Using PHP, I'm attempting to get the results of the table to display as follows: Department 1 - articleTitle 1 - articleTitle 2 - etc.... Department 2 - articleTitle 1 - articleTitle 2 - etc.. I figure I should use a while loop but can't figure out how to exit/reset the loop when a new 'department' is encountered in the $result.
View Replies !
Strange Result From Table Query
I have a simple query that I am restricting to the first 4 character, however instead of the first 4 characters I am getting only the characters from the end of the field. The information in the field resembles: 4285-002 My result should be: 4285 What I am getting is: -002 The following is the code to pull the dat from field 'Dest': $dest=odbc_result($rs1, 'Destination'); $deststrcount=1; $deststr = $dest; $deststr = str_split($deststr,4); foreach($deststr as $destv){ if ($deststrcount<="1"){ $desttext=$destv; $destnew = "DEST[1,$deststrcount] $desttext"; $strcount=$strcount+1; }
View Replies !
Link Result Table Of 2 Queries
If I have 2 table, I can easily linked them with where something = something. But I have 2 tables that I generated from complicated queries, and now I want to link them together too with where something = something. How will the MYSQL query look like?
View Replies !
Query Result Displayed In HTML Table
I have a few queries that run fine & return the results I'm after. However I am unable to get them to display in rows/columns. I am sure that the results could be passed into a table using html. $data_p = mysql_query("SELECT * FROM download WHERE dance LIKE '%$search%' OR name LIKE '%$search%'$max") or die(mysql_error()); This displays the results in one long list: while (list($id, $name, $type,$size,$content, $dance) = mysql_fetch_array($data_p))Â Â { Â echo "<a href="download3.php?id=$id">$name$dance</a></br>"; Â } Anyone?
View Replies !
Creating Table Rows Based On Query Result
I am trying to create a simple table with a fixed number of columns (5) but the number of row will depend on the results of the query. I have tried various examples found here or there and I can't get them to work. Code:
View Replies !
Recreate The Query For Each Day In Order To Show The Result In A Table
I would like to get a count for every element filled on that day but however i am unsure how to make this query to the mysql db. for example every thing filed on a monday or for each given day of the week may be better. table field is called date and is in datetime format Y-d-m H:i:s how would i complete this query to get it to look for each even if i had to recreate the query for each day in order to show the result in a table. PHP Version 4.3.11 being used PHP Code: Select count (something) as total from database where ?
View Replies !
Send Mysql Query Result Displayed In A Table
I have just created a shopping cart and I would like to send my user the receipt of there order by email. The receipt is generated by a mysql query and is displayed within a table. I have worked out how to send a html using simple HTML code as my “$message� variable: $success = mail($to, $subject, $message, $headers); But I can not get it to send my mysql query result displayed in a table. How can i create the result of my mysql query and make it a simple variable i.e $message.
View Replies !
Displaying Result 1-8, Then Result 9-17 Etc.
I dispaly the results from the database like this. <? while ($row = mysql_fetch_array($prod_result)) { $small = $row[0]; echo"<td align=center><img src="produkter/hardware/decks/$small"></strong></td>";}?> But if there are more than 8 results, I wnat to dispaly the first 8 on one page, then the next 8 on the next page...How can this be done?
View Replies !
Saving XML To Db
What would be the best way to save XML to a database? I mean I can use the example 'http://www.php.net/manual/en/function.mysql-real-escape-string.php'. they give a function to prevent any SQL Injection, function quote_smart($value) { // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // Quote if not integer if (!is_numeric($value)) { $value = "'" . mysql_real_escape_string($value) . "'"; } return $value; } but then how do I get the data back, (as intended), from the db? what would be the reverse of the above code?
View Replies !
Csv Saving
i have a form and it saves all logs into the enquiry.csv everything is working fine except that for the message text area, when i type something with spaces example test1 test2 test2 the output in my csv is being moved into other cells below is my current code:
View Replies !
Saving Png
I used GD and created a png image, and then you press a "Save" button and it runs my save.php file,this file creates the image and then uses <?php Header('Content-type: image/png'); ImagePNG($im,$location); ImageDestroy($im); ?> to save it, the image shows up in the folder, but when I view it, it is just ablack box, my image wasn't really created. I can preview the image and see that it works, is there something I am missing?
View Replies !
Saving To PS Or PDF
I'm writing an application that needs to parse a database and then print the output with a header graphic to specific printers, depending on a field in the database. To do this, I'm thinking if parsing the database with php than somehow saving this output to a Postscript or PDF file with the graphic header, then printing this to the specific printer using lpr. Can someone point me to a site or utility that'll let me save an HTML page in PHP to PS or PDF? Or if someone knows of a simpler way of doing this, please let me know.
View Replies !
Nesting Result Loops Within Result Loops Possible?
I'm looping through a query, and inside the while result output, I am trying to loop through a second query (created from the 1st query's row results). I have checked that both queries return info. I can see that the 1st while result output works fine, but when I get to the inner while result output, it never returns any rows (nothing in the while loop evaluates). So, IS it possible to nest one query's output loop within another, or am I doing something wrong?
View Replies !
Creating A Result Page From A Result Page...
I have a contact management database (4500 records) where each record contains many columns = a lot of data to look at in one go. So... I have created a search page to look for "Company" or "Name" which then returns a recordset with a primary ID number and a summary of 5 other fields. This recordset is then displayed on a results page in a dynamic repeating table which just shows simple record lines. My aim is to then be able to go from the results page to another detailed result page based on the ID of a specific selected record. I understand how to generate the recordset from a text box but cannot find out how to create a recordset from a dynamic repeating table.
View Replies !
Saving File
When saving the file, I would like let the user to browse through the directory where they want to save the file (like window pop up sreen). may I know is it can be done using php?
View Replies !
Daylight Saving
i still have the problem with daylight saving last Sun of March will increase 1 hour of the normal time and first Sun of Oct will set back to normal time: I try date("I") and it's doesn't work.
View Replies !
Saving A Session
I have been trying to find out how I can save a session - so far without success. I use PHP in combination with MySql and I would like my users to be able to save their sessions in my database so that they can retrieve it later... Meanwhile, this will also allow me to analyze their choices (what searches they did, etc...). I have been searching the net, but so far without a lot of success.
View Replies !
Saving Streamed Jpg
I have a requirement to programmatically save some images, which appear to be streamed jpgs. If I make a call to the page which serves these images, using a browser, then the picture appears, under a different URL, almost as though the page was forwarded. The picture appears fine if I put a link on a web page. But the usual copy() command doesn't work.
View Replies !
Saving A Textarea
I have a textarea input box in a form. My client needs to be able to cut text from a document and paste it into the textarea for saving in the mySQL database. This part works correctly. Code:
View Replies !
Saving To A Floppy?
Hey, is there any way to save a file to a floppy disk using php? The server will be linux and the local computer will be windows. I need it so the user can put a disk in the drive, hit go, the php page will create an excel file, save it to the users floppy drive and then tell him to put another disk in and hit ok to restart the cycle again. This will continue until all the needed files are build. I know how to do everything except the save to the floppy part and I am hoping it's possible. If it's not, does anyone know another way?
View Replies !
Saving Php Results
I have an html code which contains callings to a php script which generates JPEG images via GD library. When I select 'save as' in any browser two options are given (.html or .txt) but none of them allows to save the page as it is shown in the browser (with images). Where images should be there are only empty links....Does anyone have an idea about it?
View Replies !
Daytime Saving
I live in new zealand which has dayLight Saving which push 1 hour forward on the 1st Sunday of October, and put back on the last Sunday of March, I know that there is a daylight saving function in php DATE (I - capital i) anyone know how to use it? as I remeber, it changes the setting when it's 3.00AM but not sure.. it may change the time when it's 0.00am i am not 100% sure about this .
View Replies !
Saving Word Into .txt
I need to change a sentence from an input text box into words and store it in a text file (file.txt) Eg. "Can someone pls help me" . Can someone pls help me and then store all these into file.txt file.
View Replies !
Saving From Textarea
I have a textarea field, and I enter text into it. Like this: Today is... a Nice day and I save all from that field to a db field. Now when I extract it from the db, it looks like this: Today is...a Nice day So there is no break after the "is..." any ideas?
View Replies !
Saving JPG Images
This line of code aparently saves the jpg file: imagejpeg($image2,$src,95) If the default value is set to 100, some of the saved files are larger in size than what they were uploaded (ie: uploaded as 300K, saved as 450K). To keep the file size from bloating, I set the parameter to 95. But this causes the images to pixelate in 8x8 arrays, some worse than others. Is there a better function to save jpg images so that they don't weird out?
View Replies !
Cookies Are Not Saving
I have the following $username="test"; $username="pass"; setcookie("username", $username, time()+3600); setcookie("password", $password, time()+3600); echo "<br>username:".$_COOKIE["username"]; echo "<br>password:".$_COOKIE["password"]; echo "Thank You. Your username is:".$username." <br>Your Password is:".$password; for some reason the cookies are not saving -- what am i doing wrong?
View Replies !
Not Saving To Database
I'm making a website for a racing game, and I'd like to have a section of the site where drivers can post tips or tricks for setting up a car. Problem is, sometimes the tips post, sometimes they don't. I've tried LOTS of different combinations ... tip length, special characters, etc . Code:
View Replies !
Saving Object
I'm a java programmer learning PHP. I was wondering how to save a class over a session. As a simple example, if I wanted to have a Class called Sum, which had the methods addToSum($a), and printSum(). Could I save that object into a session, so that I could use it later as the user navigates my webpage? Is a session the best way to store data as a user goes between webpages?
View Replies !
Saving Input
What is the standard approach to saving input from a form if on submit the database connection fails? I'm thinking along the lines of after the submit the first thing to do is save the text somewhere (cookie?) and then check for the presence of the cookie on the form page and if it exists load the text from it. Destroying the cookie after a successful insert. Am I close or is there a better way?
View Replies !
Saving Snippets
When I try to save a code snippet, like this one it forces me to save the file as download.php, which it is not a php file its a zip file. But if I change the file type, I still cannot open it.
View Replies !
Saving Data
So I have an imaginary share.php. Say 10 users are submitting data to that script. every time they submit their own data, they get the most recent submissions of others as their response. Now, this will happen very often, every couple of seconds at least. File IO is slow, so writing to a temporary file is terrible. Similarly, hitting a DB everytime feels very inefficient (though I suppose if the DB is smart, it'll keep the row in memory so I just suffer a few API calls but no real File IO or processing costs). I'm under the impression the mod_php keeps the same interpretter running for all script calls, so it seems reasonable that I should be able to modify the actual interpretter's state with data (or do the functional equivalent. perhaps some deliberately exposed "Global" object). I know that Java servlets are perfect for this, but I'm unfortunately limited to a PHP environment. Ultimately, is there any way in PHP to save data directly to the interpretter's state, so subsequent script executions can pull the data directly from memory and alter it themselves instead of relying on some indirect data storage mechanism?
View Replies !
Saving Filenames
I have a PHP web app using MySQL. when I save a .jpg file named test's.jpg I see that the filename on the unix server is: test's.jpg. the filename I end up saving in my SQL table is named test's.jpg. when I use an image tag to display the photo on my web page, no image displays. I tried to strip the slash out of the filename but the image still won't display on the web page. maybe I'm all goofed up here and don't understand what's going on with this slash char in the filename on the server. how to get the image to display on the web page?
View Replies !
Saving Images
i've been searching for days but im not really sure how to search for what im trying to do. i want a script that will take a defined remote img (http://whatever.com/img.jpg) and save it to the directory of the script. i cant seem to find any image functions that will handle remote images. what should i be looking for?
View Replies !
Saving Problem
I've got a form in php that enables a user to add records to a mysql database, but for some reason when the Status_Report exceeds 700 characters it doesn't want to save to the database, the datatype of the field in the database is set to text and the limit set to 5000. any sollutions out there?
View Replies !
Saving An Image
Is this possible? If I get the image via fopen and I echo the image to IE I get a screen full of strange characters.
View Replies !
Saving A Page
I work in Dreamweaver 8 and can produce dynamic PHP page with no problem. Now I would like to be able to save these pages as a static HTML page in a folder on the server. My old programmer said this could be done using the fopen command. I would like to be able to specify the folder, as well as the file names prefix, the unique id will complete the files name. I blend Dreamweaver pages with hardcoded code to get what I need. I just done know where to go from here.
View Replies !
|