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.





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 Complete Forum Thread with Replies

Related Forum Messages:
Evaluate String As Variable Name
I'm building an xml excel spreadsheet on the fly (using the Pear class) and I want to be able to change the number of the last variable ($format_3) dynamically:

$sheet->write($xlsrow,$i,$thistrade,$format_3);

so I want to code automatically for $format_1, $format_2 etc

a simple concat $format_.$myvar doesnt work

and a variable variable : 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 !
Result Of String With Signs
i have a sting with some numbers and signs like as:

$var="-25+74+14-8";

i want to get the result of content of this variable the result of this variable is: 55.
how do i do it?

View Replies !
Different Result For MySQL And PHP String Comparison
I have issued an SQL statement "SELECT email FROM mailing_list ORDER BY email ASC";
By right the order of the email should be sorted from smallest to largest. However I got different results when I used record that was ranked higher to compare against record that was ranked lower. I got opposite results. Code:

View Replies !
Order The Sql Result By Largest String In A Column?
I suppose this might be mainly an sql question but, is there a way to order the sql result by largest string in a column? You could use an array to sort the result but i was just wondering if there was a direct way using the sql statement.

View Replies !
Why Does This If () Always Evaluate To True?
I have the code below that always evaluates to true. Why and what do I do
about it? Many thanks in advance!

In the code, I have tried sending in the URL
?indentNum=23
?indentNum=23.2
?indentNum=23sadkjsi8
?indentNum=aanns

No matter what I throw at it, it always evaluates to true despite echo'ing
different numbers.

=================================================
echo "<H1>abs value = ".abs($_GET['indentNum'])."</H1>";
echo "<H1>GET = ".$_GET['indentNum']."</H1>";

if (abs($_GET['identNum']) == $_GET['identNum']) {
echo "<H1>GOOD NUMBER</H1>";
} else {
echo "<H1>NOT A GOOD NUMBER</H1>";
}

View Replies !
What Does Eval() Evaluate?
I'm having problems with eval(); what does it evaluate? I know it might be a silly question but I can't get it to behave the way I want it to. It's no problem if all I want to do is parse, say, $PHP_SELF to a proper value:

$String1="This is $PHP_SELF!";
eval("$String2="$String1";");
echo $String2;

produces the correct result, i.e. $PHP_SELF gets parsed correctly. This way to evaluate a string containing PHP code also works out: Code:

View Replies !
Evaluate If NUMBER
I have a form field that must only contain a numeric value Is this the best way to evaluate: PHP Code:

if (is_int($myvar) && $myvar > 0)

Or shall I use is_numeric

My number has to do with number of people and can not have decimails or negative numbers.

View Replies !
Evaluate Date Where > 2 Weeks Ago
all i have a date on a php page and i need to check if that date (
in this format : 2006-06-04) is more than 2 weeks ago. How can i do
this most efficiently?


View Replies !
How Control Struct Evaluate
$PHONETIC is an array of strings. How can !$PHONETIC['d'], in the case
below, evalutae to true. It is a string not a boolean. It would make more
sense if it evalutated to null.

<?php

$PHONETIC = array('a' => 'alpha', 'b' => 'bravo', 'c' => 'charlie');

if(!$PHONETIC['d']):
echo 'true'
else:
echo 'false'
endif

?>

View Replies !
Evaluate PHP-code From A <textarea>
I would like to create a script which "parses"/"executes"/"evaluates" PHP-code from a textarea in a form and then output the result to the browser - you know just to be able to try out some lines of code without having to open your texteditor and upload to your server ect.

I often need to see the current timestamp or encrypt something with md5() and it would be really nice just to open www.mydomain.com/evalphp.php, enter "<?PHP md5(stufftoencrypt); ?>" or "<?PHP echo time(); ?>" and have the result printed out
How would I do that? For example:

#1: I type <?PHP echo "some text to echo"; ?> into my textarea and when I press the submit button it should ouput some text to echo.

#2: I type <?PHP echo time(); ?> into my textarea and when I press the submit button it should output 1234567890 Code:

View Replies !
Evaluate PHP Subscription Script
I have made a small PHP script for users to sign up for news letter. It seems to work fine however im not wery skild in PHP (Infact im a beginner in PHP) and woud like to here your opinion on the script.

Have i don annything that shud have been don differently ? .. anny errors ?? Right now its writing the emails in a txt file with no protection, but the ideer is that the txt shall bee in a .htaccess protected folder (havnt tryde that yet) Code:

View Replies !
Evaluate Print_r Output? Is This Possible?
For backup purposes, I have some emails that are sent to me when someone completes a survey on my site. This morning mySQL died after we sent out a targeted customer survey and none of our data was recorded to the database. But, I did receive the emails.

So now I have 50+ emails with the contents of

print_r( $_POST )

from the answers to the survey. Is there a way to interpret the output from print_r and actually evaluate the $_POST array? I know this is crazy, but I'm thinking that there might be a solution out there...

View Replies !
How To Evaluate Function Use In PHP Context
now did i get into web-based environment, or rather, web based programming envi. to make a more tangible inquiry let me site an example I've an entry form for a particular product line... it has 5 basic types... and tons of detail and related bill of materials.

one approach i can give here is to create a function for the layout of the page... with parameters for a number of inputs, and probably a couple of arrays... from there i can decide within the function on which configuration i can display an input page.. Code:

View Replies !
Evaluate Expression Inside Array
I'm trying to assign values to an array by evaluating expressions like so:

$myArray = (
'sessionMaxInactive' =60*5,
'persistentMaxTime' =60*60*24*30
);

This doesn't seem to work. I've tried surrounding them with the brackets and
double quotes too, to no avail. Sould this be possible in php? If so, what
am I missing?

View Replies !
Xpression Did Not Evaluate To A Function Object
I am using php, javascript, postgresql, linux and html as a development tools. While development and testing I found following erros, as the code works well for first time but start appearing this erros on next attampt. Pl. note that I am calling javascripts functions from php routine, on submiting form. Code:

View Replies !
Request Url And Extract Portion To Evaluate
I'm looking to take a url say testsite.com/test/1234. How can I detect what page I'm on using php with an if statement? After the page of this type is detected I would need the 1234 to lookup other information in a db and present to the user.

require_once('dbconnect.php');

$section = $_REQUEST['section'];

$title_fun = "Your having fun!";

if ($section == "fun){
echo $title_fun;
}

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 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 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 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 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 !

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