Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Outputting From Array


I have recently outsourced a site and having put it live have found that its outputting a number instead of a county from the database, the numbers are coming from an array that converts each county to a number for storing in the database but doesnt seem to be converting them back to text when outputted,




View Complete Forum Thread with Replies

Related Forum Messages:
Outputting A 2D Array In A Certain Format
I have a mySQL result which is from a database of 9 columns and $x rows. I need to create a loop so that it displays the content of each field in a row before going to a new line and then displaying that row.

The reason I am doing this is to cretae a loop system for adding data to an excel sheet I have created using COM. This works fine, its just a matter of looping through the results correctly. here is the loop code I have at the minute (which isn't working correctly)
PHP Code:

View Replies !
Outputting Just The Result Of An Array
I'm trying to print the results of an array taken from my database.
here's my code:

$subc = array($subcdat);

print_r($subc); The problem it's outputting: Array ( [categories_name] => Spoon Boy )when I only want it to output: Spoon Boy. I'm trying to save the spoonboy as a variable to use, so I'm using the print_r function to check what it's outputting. If it's outputting correctly I'll use $subc as the variable to read from.

View Replies !
Outputting Form Data Into Array..
how would I retrieve all values sent by a form with post method and put it in an array? I'm trying to do this because I have a form which has different inputs and textarea etc depending on some other variables. I'm then trying to read the data and pu it into a mysql command.

I want to collect all the data from the form (regardless of what it is) and save it as an array which I can use.

View Replies !
Sort The Array Before Outputting The Data
I do a SQL query and normally just do a "while ($data = mysql_fetch_array($sql))" and echo the output. What I want to do now is to sort the array before outputting the data, to get it in the correct order.

I cannot just sort the data in the SQL query as I have to sort a column containing data in the format of "Firstname1 Lastname1 and Firstname2 Lastname2" and the sorting for that column has to be sorted by Lastname1 ASC. I figure this is somehow done using a sort array command but I am very lost on how to do achieve this sorting.

View Replies !
Outputting XML From PHP
Today I decided to teach myself both PHP and XML ... so I decided to
make a little address book. After I finished it I found this:
http://www.tonymarston.net/php-mysql/sablotron.html which describes more
or less what I did.

The main difference is that users are able to add entries into my
address book. When an entry is added I get all of the address book info
as post data. I take this data then print out a whole new xml file.

Is there a better way to do this? Right now 95% of the PHP I wrote
saves a new XML file ... the other 4 lines transform the XML with some
XSL and displays the results.

I suppose Im too used to working with databases where I can (more or
less) write "Insert Whatever into AddressBook"

View Replies !
Outputting A Sum
I'm trying to output the sum of a column. Here is the code I have.

<?
$query2="SELECT Sum(num) FROM tbl_secrets";
$totalviews = mysql_query($query2);
echo $totalviews;
?>

The output I get is:
Resource id #6

I've tried everything. I got so angry I just got up and left, because I knew I would have started hitting my computer or someone else. So, I tried mysql_fetch_array, and mysql_fetch_assoc. Neither worked. Can someone help me calm my nerves?

View Replies !
Nl2br But Outputting <p> </p> Rather Than <br />
I have a news sytem and at the moment I am using nl2br() (php and mysql). My styles have been designed for, and I would prefer to use paragraphs. I am requiring a method instead:

news<br />
blah<br />

To output:

<p>news</p>
<p>blah</p>

to be valid xhtml

View Replies !
Outputting The /usr/bin/top Command.
The code below will display the server uptime using the uptime command in linux. How would you go about displaying the /usr/bin/top command? i've noticed there are miscellaneous commands in linux relating to performance etc.. is there a way in php just to run a command like uptime and output it in its raw format? PHP Code:

View Replies !
PHP & SQL - Outputting Messages
Ive managed to connect my sql database using php but the problem im coming across is outputing a message if something equals to null, i.e. i have an attribute in the database called 'Imagename1' so what i want to do is print out a message saying 'no image exist' Code:

View Replies !
PHP Not Outputting Information
I am trying to pull info from a MySQL dbase with a simple script that recieves info from a get request such as http://mysite/subfolder/index.php?where=Alaska

The code for the request is as follows Code:

View Replies !
Outputting NO Data From DB?
I’m wanting to echo some records data out of my database:

Schema

companies

company_name
address_one
address_two
address_three
postcode

PHP Code:

View Replies !
Outputting HTML In PHP
I have a page called basket.php that is supposed to output the basket. So I have all the html and then it gets to the part in the page where I neeed to output the item sin the basket. I have a class called Basket.php that I used to add items and delete items. Should I add a function called Output that outputs them all in a table? It's just I heard it was bad to output html in php like this:

echo "<table> <tr> <td style='.....'>";
echo "blahhh">;

So how do you normally output tables, images, links and other dynamic content?

View Replies !
Outputting To Be Taken Literally
im dynamically generating a page for which i have a javascript function that can generate errors. i have several lines like : error += "error message";

so i can then alert a list of errors, on seperate lines but when i create the page, it outputs it as: error += "error message";

View Replies !
Outputting Distinct
I'm trying to output ONLY once, as a list of the items that have been updated. Now, some of the items may have multiple entries. I've tried something like that but keep getting duplicates: Quote:

SELECT DISTINCT * FROM T1
LEFT JOIN T2 ON ( T1.a1 = T2.a2 )
WHERE a1 = 'x'

View Replies !
Outputting $_GET
I am trying to dynamically build links at the bottom of a search result page, and am having a problem carrying the querystring info over. On the search form the user has the option of selecting multiple cities as part of the search criteria, so the resulting querystring looks something like this:

result.php?country=1&city%5B%5D=72&city%5B%5D=12&city%5B%5D=14&industry=12

I don't know how to handle that array in terms of echoing it out to the page as part of the "Previous" "next" links at the bottom of the page. I just get a link such as: "next=array" instead of the proper querystring info.

View Replies !
Outputting A List
PHP Code:

foreach($emailArray AS $name=>$email){
    if(mail($email,"Subject","Body","From: Whoever <me@me.com>")){
        echo "E-mail sent to: <b>".$email."</b><br>";
    } else {
        echo "<font color="red">E-mail NOT sent to: <b>".$email."</b></font><br>";
    }
}

So basically, what currently happens, is that it only displays the output of the script once the entire script has finished. So when you are sending 2000 emails, only once the script has completed does it display the results.

View Replies !
Outputting Image To File
Trying to get any image format to save an image to file instead of displaying it in the browser, the only one i can get working is wbmp which does'nt seem to save correctly as an image and can't be opened in photoshop.

anyone have any ideas, below is the code i am using with png which just displays a broken image.
<?
//header makes sure it refreshes
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); //Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate"); //HTTP/1.1
header ("Pragma: no-cache");
$image = imagecreate(200, 200);
//colors
$grey = ImageColorAllocate($image,200,200,200);
$white = ImageColorAllocate($image,255,255,255);
//visualise image
header("content-type: image/png");
imagepng($image, "image.png");
imagedestroy($image);
?>

View Replies !
Outputting Data In Categories
I'm trying to organize some data into categories. Lets say for example we have this:

while ($row = mysql_fetch_assoc($result))
{
$data1 = $row["field1"];
$data2 = $row["field2"];
$data3 = $row["field3"];
$data4 = $row["category"];
echo $data4?><br><?php;
echo $data1,$data2,$data3?><br><?php;
}

Which would have a sample output like this:

Category1
Field1Field2Field3
Category1
Field1Field2Field3
Category2
Field1Field2Field3
Category2
Field1Field2Field3

How would I get it to print the category name once, then everything belonging to that category, then move to the next category, etc. So it'd look like this:

Category1
Field1Field2Field3
Field1Field2Field3
Category2
Field1Field2Field3
Field1Field2Field3

That's the simplest way I can think of putting it. :)

Seems to me like it'd be an easy answer, but I've tried a couple of different approaches and can't seem to get it to work.

View Replies !
Problem When Outputting An Xml File Using Php
I am trying to output a file, coutries.xml, which is in the following
format:

<xml...
<countries>
<country id="1">Afghanistan</country>
<country id="2">Albania</country>

View Replies !
Printing And Outputting Data
I have looked through the online manual and haven't found a way to format data from either a form or
data that was retrieved from a database. I would like to provide an "elegant" printout to my users
and I heard (when I didn't need to use it) somewhere that such a function existed.

....or is HTML the way to go using Javascript?

View Replies !
Outputting Data From A Db Into A Textbox
how to output data stored in a database into a textbox. The idea is that i want to output user details into textboxes and allow them to be modified and then resaved if changes are made.

View Replies !
Outputting Data Correctly
Im tring to create this... top 10 most visited site.. for my site... but i have a problem.. when i submit 2 sites in to the db.. it will only output one instead of 2 can anyone tell me what is going wrong here.. i hade it done before.. but for some reason its not working.. and i cant find the error PHP Code:

View Replies !
Outputting A File For Download
im trying to let a user download a file from my website, for example a
picture. i dont want the user to have to right-click and do save-as, but
instead i want a window to popup (the window with "Save File","Open
File","More Info",etc) so that the user can download it easily. i have a
feeling this has something to do with headers, but i have no idea what the
correct headers are.

View Replies !
Outputting A SOAP Request (xml)
i am outputting a SOAP request via...

echo "<br/>Dumping response:<br/>";
echo "<pre>". htmlspecialchars( $client->__getLastResponse() ) ."</pre>"; 
 
but the output of getLastResponse is one big xml string. i want to print it out all nice without writing alot of xml parsing code, any built-in php function?

View Replies !
Outputting Tabular Data
I know that when we output result from a table, and we use  <td>, we can insert a new row easily by using the modulus operator to inset a <tr>. Code:

View Replies !
Outputting MYSQL Query
I need to do a select on a field from a table in MYSQL and then make that select equal a variable. I am not able to do so with my code. can someone tell me what I am doing wrong Code:

View Replies !
Outputting HTML And Text?
I was trying to experiment with the "readfile()" function, and I managed to output a .swf flash file. I needed to do more than just that though, I needed to add a bit of text to it. Code:

View Replies !
CURL/PHP - Outputting Different Data
I would like multiple, different urls / proxy servers / proxy ports to be submitted, all on the same script (without having to create any other files).

function file_get_contents_proxy($szURL, $szProxy, $iProxyPort)
{
    $pCurl = curl_init($szURL);
    curl_setopt(CURLOPT_PROXY, $szProxy);
    curl_setopt(CURLOPT_PROXYPORT, $iProxyPort);
    curl_setopt(CURLOPT_FOLLOWLOCATION, true);
    curl_setopt(CURLOPT_RETURNTRANSFER, true);
    return curl_exec($pCurl);
}
............

View Replies !
GD Library Outputting Image
im new to using the GD Library and I have a problem where i'm using imagejpeg() to ouput an image but when I include header('Content-type: image/jpeg'); the rest of the html does not show.

how do I include an image that i'm resampling on the fly within an html environment?

View Replies !
Outputting Query Results
How would I take the results of my query and output them to a table on my web page?

View Replies !
Outputting An Image [error]
Im trying to output an image onto a php page using the following code:

View Replies !
Arrays Outputting Messages
I have an edit form where users can update multiple email addresses howver each email adress that gets updated I get a message. Howver, what I want is only one message to appear regardlesss of how many emails get updated. PHP Code:

for($i = 0; $i < sizeof($e); $i++)
        {
            $updateM_query = "UPDATE mailinglists SET emailAddress='$e[$i]' WHERE seminarID='$id' AND emailAddress='$old[$i]'";
            
            $updateM_result=mysql_query($updateM_query,$dbc) or die (mysql_error());
            //echo $updateM_query;            
            // email addresss is inserted
            
            
            
            if (mysql_affected_rows() >= 1) {
                    // Print a message.
                    echo '<p class="error">The changes have been updated.</p><br />'    
            } ..............

View Replies !
Outputting A Different Language Dynamically
i can't figure this out, yet it seems so simple.

i have a site with an english and french version - i output the current date on the english one, but need to output the current date in french on the french version.

simple php is date("l F j, Y") for the date

is there a way i can do...

language("French");
echo date("l F j, Y");

?

View Replies !
Outputting Mysql Data
I have some information I wish to pull from a database and display in spreadsheet like format. I'm querying our db to find apps from a date range that were assigned to a rep, then total up the number of apps per month the rep was assigned and totals per rep over the months. The problem i'm having is getting the data to output into columns. I'm sure it has a simple solution but it's eluding me. Here is an example of the data should look like on the webpage.

¦ month 1 ¦ month 2 ¦ month 3 ¦ Total
name1 ¦ 2 ¦ 2 ¦ 2 ¦ 6
name2 ¦ 2 ¦ 2 ¦ 2 ¦ 6
name3 ¦ 2 ¦ 2 ¦ 2 ¦ 6

Total ¦ 6 ¦ 6 ¦ 6 ¦ 18

View Replies !
Outputting File In FireFox
I have a page that prompts a user to Save a file called entries_mm_import.txt. Basically the code listed below prompts the user to save a txt file which contains the contents of the variable $createMMFile.

Code:
<?
$path = ''
$get = 'entries_mm_import.txt'
header ("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header ("Content-Type: application/octet-stream");
header ("Content-Length: " . filesize($path.$get));
header ("Content-Disposition: attachment; filename=$get");

//SOME DATABASE STUFF WHICH CREATES THE VARIABLE $createMMFile

echo $createMMFile;
?>

My problem is it works perfect in Internet Explorer but in FireFox it only writes the first 3699 characters to the file entries_mm_import.txt. Is there a character limit (or size limit) in FireFox? Has anyone ever run into a similar problem as this?

View Replies !
If Else Statement Is Not Outputting The Else Part
i have a problem if an if else statement its not outputting the else part of it
the code i have is shown below: PHP Code:

View Replies !
Outputting Data Neatly
Ive set up my script to output a field from my database e.g. `pd_more` text NULL. I used a text feild because a lot of data is needed to be entered. Through php i echo these details but i need to display them neatly in lines. ie the information is currently being displayed like.

>01. Love Sensation &#3906; (Hi_Tack Mix) Loleatta Holloway Gusto >02. We Are Your Friends (Lee Cabrera Re Mix) Justice vs Simian Ten / Virgin >03. S.O.S. (Moto Blanco Re Mix) Rhianna Def Jam / Mercury >04. All I Need (Fuzzy Hair Re Mix) Ill Beat Hustlers Lowered Recordings >05. Touch It (Mary J Blige & Missy Elliott Re Mix)

when i need it to be displayed like:

>01. Love Sensation &#3906; (Hi_Tack Mix) Loleatta Holloway Gusto
>02. We Are Your Friends (Lee Cabrera Re Mix) Justice vs Simian Ten / Virgin
>03. S.O.S. (Moto Blanco Re Mix) Rhianna Def Jam / Mercury
etc.

View Replies !
Outputting Selected Option
Given a dropdown form how can I output the selected option when the submit button is pressed.

Box: [red ] [submit]
[green ]
[blue ]
[orange]

so the user selects an option from the dropdown menu, which is highlited then they press submit, I want to display red, green, blue or orange, whatever was submitted.

View Replies !
Outputting Image And Text
I know that once you change the header to output an image in php, you can't output text. But I need to do this. Does anyone know of a workaround to getting an image and text outputted to the same page?

View Replies !
Outputting Imaged Resized
I have this function:

Code:
function imagethumb($imagename,$width,$height) {

// Content type
header('Content-type: image/jpeg');

// Get new dimensions
list($width_orig, $height_orig) = getimagesize($imagename);

if ($width && ($width_orig < $height_orig)) {
$width = ($height / $height_orig) * $width_orig;
} else {
$height = ($width / $width_orig) * $height_orig;
...

View Replies !
Outputting Form Data
I'm looking to have applications put on my website and I want to make it so that the user can print out the results of their application in a decent layout. What is the best method to do that? HTML, PDF, etc? I have read the threads of "on the fly pdf's" and others, but I can't find anything that tells the best method to begin with.

View Replies !
Outputting Page Generation Time
On some PHP pages I have seen output of how long it took to generate the page - something like: "Page generated in 0.173 seconds" How can I display this?

View Replies !
Outputting POSTed Data On Error
Got a form, user enters information, presses submit, then info added to my database.

however, it checks to see if fields are empty when the button is pressed, if they are empty ive got it to bring up an error to say for example name, postcode empty.

but the form comes back with blank fields i want it so if fields are empty form comes back with the fields that have already been filled in.

View Replies !
Problem With Smarty Not Outputting Content
I am building an application and have decided to use smarty.

I understand how it works and have made some very basic templates....

View Replies !
MySql - Outputting Results In Groups
I want to output mysql data by groups (states). However each time php/mysql comes to a new state in the results I want it to print the state name before putting the results. Does php have some sort of memory function to recognize when the state has changed?

View Replies !
GD Not Outputting Pics But 'sourcecode' Of Image?!
I've used GD before on other servers and haven't had any problems with it.. But now, on a new project, I want to make dynamic title graphics and for some stupid reason it's only outputting the source of the image, like so: Code:

View Replies !
Outputting Formatted Html From Php Scripts
Do people generally try and output nicely formatted html from their
scripts?

I have been trying to, with variable indenting for tables etc. It
makes it easier to see the html and perhaps debug it, but it can make
ugly looking scripts.

What's the general consensus?

View Replies !
Evaluate, Outputting The Result To A String
I have a store of strings (db, file, var) that contain a mixture of php and html. These I want to evaluate, outputting the result to a string for later inclusion in the printed page. Code:

View Replies !
PHP Mysql Outputting Records Repeatedly.
I have not messed with php/mysql in a while and have come up with a
problem I have run up against before but cannot remember the solution.
See the following page:

View Replies !
Header Problem - Outputting To The Screen
I can't see what I'm outputting to the screen before the headers as i'm gettinng 'cannot modify header' error. Code:

View Replies !
Parsing Remote Page And Outputting
Here is a general idea of what I want to do:

HTML Form is submitted by remote user using POST methodVariables are received by 'search.php'Script within 'search.php' will POST same variables to a remote (3rd party) website Script downloads the resulting HTML pageScript parses HTML page and displays relevant data (ie. a specific table)

I'm stuck at the part with the -- how would I get PHP to POST the user's vars to get the page returned? I know how to do this if I were using a GET method, but this is not an option.

View Replies !
Outputting Database Results Into A Table
I want to output the results of a database query into a table with a catch. I'd like each result to have its own cell, and i'd like the table to be no more than 3 cells wide by total results / 3 rows high. Here is my code, i'm struggling with this one.

echo '<table border="1">'

for ($cell_count=1; $cell_count <= 3; $cell_count++)
{
echo '<tr>'

for ($i=1; $i <= mysql_num_rows($result); $i++)
{
$row = mysql_fetch_array($result);
echo '<td>' . $row["file_location"] . '</td>'
}

echo '</tr>'
}

echo '</table>'
I can't work out the logic of it

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved