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.





Expected Output


When I try to test my setup by making the file test.php with the single line PHP Code:

<?php phpinfo(); ?>

then goto http://localhost/test.php it displays Quote:

<?php phpinfo(); ?>

instead of all the info.




View Complete Forum Thread with Replies

Related Forum Messages:
T_OLD_FUNCTION Expected???
I use EngIn editor, my code ran ok there... but not when I ran it on my apache server.. got the following error:

Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in C:japachecaseFileCVf.php on line 5

Here's the code:

View Replies !
Loop Expected
i get it to loop, so that it keeps doing it for;

$start =10 then 20 etc right up to 1000

the function is;

function query($topic, $start = 0)

{
$googlelist = $this->_query("Google", $topic, $start);
$yahoolist = $this->_query("Yahoo", $topic, $start);
$this->found = array_unique(array_merge($googlelist, $yahoolist));
$this->counts = array("yahoo" => count($yahoolist), "google"=> count($googlelist), "total" => count($this->found));
return true;.

View Replies !
Could The Close_date Be One That Is Not The Expected Value?
Here's the code.

$link="http://xbox360cheat.org";
$close_date=$_POST["close_date"]; #last content change check
if ($close_date == 0)
$close_date = date("Y-m-d H:m:s", mktime(12, 0, 0, date("m"), date
("d")+7, date("Y")));
else if ($close_date == 1)
$close_date = date("Y-m-d H:m:s", mktime(12, 0, 0, date("m"), date

Could the close_date be one that is not the expected value? For example, if the month is 11 and $close_date == 7, then the mktime function should return the next year for the year value, not the current year. And if the day is the last week of December, than the month and year should change if close_date == 7.

View Replies !
Implode() Not Working As Expected
I have one page with a form that uses an array ($order) to print out ordered items. This page then posts to a second page to get personal information from the person ordering. Before posting the form, I implode the array into another variable ($items_ordered), so that I can print a summary of the items ordered on the second page.
(The following code is all within the <form> tags.): Code:

View Replies !
NULL Expected, Won't Show Up ...
I have tho following code.

$_GET['artile'] looks like this: /2006/03/lorem_ipsum

$locationinfo = explode('/', trim( $_GET['article'] , '/') );

list( $article_year, $article_month, $article_url ) = $locationinfo;

echo '<br>year: '.(($article_year === NULL)? 'null': $article_year);
echo '<br>month: '.(($article_month === NULL)? 'null': $article_month);
echo '<br>article: '.(($article_url === NULL)? 'null': $article_url);

The weird thing is, if $_GET['article'] is empty, $article_year isn't
NULL, but the rest is. This doesn't make any sense to me ...

View Replies !
Ini_set() Not Working As Expected
When running the following code I get a warning:

<?
ini_set('session.use_cookies',0);
?>
random text
<?
session_start();
?>

The output / warning I'm getting is this:

random text
Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at /path/to/file.php:5) in
/path/to/file.php on line 6

Shouldn't the fact that I'm setting session.use_cookies to 0, via
ini_set, prevent this error from taking place?

View Replies !
Preg_replace Not Matching As Expected
I'm attempting to write a bit of code that will parse a HTTP_REFERER from google and return the search data and the nationality (.fr, .co.uk, etc).

I can get a rough output (see bellow) but the search value (2 in the script) continues past the '&' character which is where I need it to stop. PHP Code:

View Replies !
Function Not Returning Expected Value
I have a php file that contains a couple of arrays used for
state/country pull-down lists. I have two global arrays and an accessor
method for each. I have some simple logging methods, so I know a little
bit about what I'm getting back. When I try to get the arrays from
another file using the accessor methods, I get no array back. Within
the file that contains the arrays, I can access them by global name and
also by the accessor methods. Any ideas why I cannot access the arrays
from another file? Code below.

<SNIP FROM CALLING METHOD>

require_once BASE . '/config/formfields.inc.php' // file with needed
arrays

// the calling method
function display_states($smarty){

logobj(function_exists(get_states)); // returning True/1
$s = get_states();
logobj($s); // no love here
logobj(BASE . '/config/formfields.inc.php'); // it's the right
file
}


View Replies !
CURL Results Not What Expected
I was playing with cURL on a website and it didnt work.  So I switched to a different website and it worked just fine.  So that little part of my brain that is always working started wondering why cURL wouldnt work with the first website that I had tried.

I'm hoping that someone here can help me figure out why this particular website wont work with my cURL script, and help me get it working. Code:

View Replies !
Sort Results Not As Expected
In the actual array I'm working with, the a, b, c's are primary keys. One shouldn't expect them to actually be in order. This example uses a, b, c to verify if a sort worked properly. I want to sort the array so the result will have a,b,c,d,e,f,g,h, etc in order. Code:

View Replies !
Not Getting Expected MySQL Error
I am inserting values into a row.. works OK

If I try to insert a value into a row that doesnt exist (using where)
it always returns true the same as if it did work

I want to update rows that have one unique field.. if the row doesnt
exists it should return 0 rows updated.. I then create the row...

But it always returns 1 even when I update a row that doesnt exist..
How do I get an error or a false return?

View Replies !
If Statement Not Working As Expected.
I am trying to get my error message to print if either the login is incorrect or the dropdown variable is "Unknown" I get no errors and I know that the variable is posting correctly. I think I'm missing something or put it in the wrong place. Code:

View Replies !
Ereg Not Behaving As Expected
I'm having a problem with the ereg function to verify a user submitted variable the situation is that the user is submitting a textarea post variable there are a number of allowed characters there are more in the actual application but i have removed to demonstrate the problem as removing them makes no difference the php code is as follows:

$message=$_POST['textarea1'];
if (ereg("^[A-Za-z0-9
]*$",$message)) {
$textValid=TRUE;
} else {
echo "error";
}

but it seems to act like

$message=$_POST['textarea1'];
if (ereg("^[A-Za-z0-9]*$",$message)) {
$textValid=TRUE;
} else {
echo "error";
}

View Replies !
Buffer Flush Doesn't Work Quite As Expected
I've got a PHP script (running on MacOS X, PHP 4.1.12) which uploads
bookings from one database to another, and I'd like to have the screen show
progress as it happens (each time I process a booking, I write a line
summarising it to the browser with 'print')

From RTFMing and Googling, it seems that I should be able to do this by
turning output buffering on and using ob_flush() et al. However, this only
sort-of works, in that instead of getting output line by line, I get a
multi-line chunk on the browser from time to time.

Am I stuck with having this chunk-by-chunk visualisation, or can anyone
please suggest a way that I can make it force each line to the browser as I
write it?

View Replies !
Unexpected Absence Of Expected Warning
The page 167 of book Learning PHP5 by David Sklar says that
setcookie() and session_start() must be added before any output.
I tried to use that functions at last line but no warning!.
The warning which i got 1 month back is not issued now.
------------------------------------------------------------------
The following is my PHP program
<?php

function Intelli()
{
echo"Hello P";
}

function Bitz()
{
echo"Hello MySQL";
}

;
$a = 1;
if($a)
$myFunc = 'Intelli'
else
$myFunc ='Bitz'

$myFunc();
print'header'

session_start();
setcookie('userid')
?>

----------------------------------------------------------------
The following is the output i got.
There is no warning

[tdphpadmin@trgbws40 ~/public_html/demo]$ php dynamicfun.php
X-Powered-By: PHP/5.2.0
Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/
Set-Cookie: PHPSESSID=bp1m17rlrgsa5g19tfekidov31; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-
check=0
Pragma: no-cache
Set-Cookie: userid=
Content-type: text/html

View Replies !
Predefined Variable Not Working As Expected
I have a script that was working fine until I had to reinstall everything.  Now my scripts says that :

PHP Notice: Undefined index: LOGON_USER in D:Inetpubwwwroot
ame.php on line 5

Where I have just made a new file to isolate the issue, but this derives from this script :

<?php

echo $_SERVER['LOGON_USER']; ?>

Which worked fine before.  Is this down to the way php is being run? As it stands it is being run via IIS 5 as cgi executable.  I've looked over the install txt and it seems as though I have done everything correct.

View Replies !
DomDocument::loadHTML - Expected Behavior?
Quick question about DomDocument::loadHTML (http://www.php.net/manual/en/functio...t-loadhtml.php) Why does this not create a parse-tree? Code:

View Replies !
Delete Query Not Working As Expected
I have 2 different php forms. One makes sure that a user has chosen an unique user name (below):

$query_rsApp = "SELECT * FROM users where UserName=".$Registered." ";

This Select query works right every time (as far as I can tell). I have a form that I want to use to delete user records.

This Delete query works fine if the username and password are both numeric... But if the username or password is text, it returns the error "UNKNOWN FIELD 'whatever'" where whatever is my search criteria that I am trying to use.

View Replies !
Unexpected Absence Of Expected Warning.
The page 167 of book Learning PHP5 by David Sklar says that setcookie() and session_start() must be added before any output.

I tried to use that functions at last line but no warning!. The warning which i got 1 month back is not issued now. Code:

View Replies !
Regex Doesent Work Expected...
i use this to get all html tags out of an string ..
preg_match_all('/<[^>]*>|[^<>]+/', $data, $contentParts);

worked wonderful till i noticed that this doesent work with something like

"{if $commandCount > 0}"

this will be split in 2 parts:
"{if $commandCount " and " 0}"

and the < is gone
It shouldnt split anyway when it detects an " < " or ">=" or " <=" and so on..

View Replies !
Imagecolortransparent Not Working As Expected - Any Ideas?
I'm trying to rescale a gif file with transparency but am having difficulty with the imagecolortransparent() function - It's not working as I would hope...

I'm telling it to replace the colour red with transparency and then overlay my transparent gif, but resized. For some reason, it is turning anything black in my transparent gif, transparent, instead of the red - Can anyone else figure out why it might be doing this? Code:

View Replies !
Elegantly Handling An Expected Error
I have a very modest database on my server and I use php to allow people to query it. Its very simple, they enter a value that should be in column 1 (account_num) and I return the value for column 2 (balance) (same row).

Here is the question: What if the value they enter doesn't match any values in column 1? Right now, I get this ugly error message: Code:

View Replies !
Line Breaks Don't Work As Expected
I wrote this small bit of code for a college class, but the instructor offered no feedback. Our textbook offered nothing and the teach yourself book I bought had typos in it. :mad:

I don't understand why the linebreaks in the php code didn't work properly. I ended up putting them at the beginnings of the next line, rather than the end of the previous line.

I think that's sloppy; I want to undertand why the line break worked on the first line but not subsequent lines. I expect it's something semantic, quotes or such. Code:

View Replies !
Problem Getting Script's URL ($_SERVER['PHP_SELF'] Not What I Expected)
I have a function that restricts access to a page to logged in users.
When a user who isn't logged in goes to the page, it will dynamically
generate a login form.

I'm trying to use it in conjunction with the free shared SSL
certificate offered by my host. To use SSL, you would change a URL
like this

http://mydomain.com/page.php

to

https://ssl.myhost.com/mydomain.com/page.php

My problem: when my script dynamically generates the login form, it
uses the $_SERVER['PHP_SELF'] value in the action field. But this ends
up being '/page.php' rather than '/mydomain.com/page.php' so my form
gets submitted to

https://ssl.myhost.com/page.php

instead of

https://ssl.myhost.com/mydomain.com/page.php

Simple I thought, I'll just use the SERVER or ENV variable that gives
me the full url. My problem: it doesn't seem to exist!

View Replies !
Chmode With Mkidir Function, The Result Isn't As Expected
I've tried to create a directory with the php function mkdir(). I've used a "0777" mode , so that owner,group and other can read,write and exectue files in this directory.
There's no problem creating the directory, but after it has been created, its mode is "0755".

Where did I commit a mistake ?

View Replies !
Apache ErrorDocument / PHP Header() Interaction Does Not Work As Expected
I recently worked on error handling and three related issues/questions came up.

1.) I am trying to trigger Apache ErrorDocument handlers by setting appropriate HTTP status codes in my PHP code, but I don't get the expected results. Code:

View Replies !
PHP 404 Document's REQUEST_URI Does Not Hold Expected Value In $_ENV And $_SERVER
I wanted to migrate some custom 404 error pages from shtml to php for the ease of email notification of lost pages. However when PHP processes the page $_ENV['REQUEST_URI'] and $_SERVER['REQUEST_URI'] both now hold the error page eg "404.php".

Does anyone have advice on how to dodge this? Should I just continue to use shtml error pages and
do an shtml include on a little php script to do the mail?

View Replies !
Making Gmdate Output Equal Date Output
gmdate('F j, Y, g:i a',0) returns January 1, 1970, 12:00 am.
How do I add to the second parameter of the date function to make it
always return that same date, regardless of the time zone?
Intuitively, it seems like date('F j, Y, g:i a',0 - date('Z')) should
do it, but on my system, that's an hour off.

Here's some sample code:

<?
echo gmdate('F j, Y, g:i a',0).'<br />'
echo date('F j, Y, g:i a',0 - date('Z')).'<br />'
echo date('F j, Y, g:i a',0 - date('Z') + 60*60);
?>

And here's the output on my system:

January 1, 1970, 12:00 am
December 31, 1969, 11:00 pm
January 1, 1970, 12:00 am

Will the last echo always return the same thing as the first echo,
regardless of the time zone? If so, why? It seems that the second one
is the one that should do it - not the first one.

View Replies !
CSV Output
I need to write the output of an SQL query as comma-separated values.
So I wrote this, which is almost right:

while($row = mysql_fetch_array($rs, MYSQL_ASSOC))
{
$rows[] = $row;
}
foreach( $rows[0] as $key =$value)
{
echo $key.",";
}
echo "";

foreach ($rows as $row)
{
foreach( $row as $key =$value)
{
echo $value.",";
}
echo "";
}

It first writes a header row, then all the data rows below it. The only
problem is the trailing comma on each line. Is there some clever way of
knowing when I'm on the last element, and so not add the last comma?

View Replies !
Right Output ...
just wondering - which method of output is more fast and use less system
resources. The page being build with outup from multiple functions. So, is
it better to output each function result directly with "echo" construction:

echo "string1";
echo "string2";
................
echo "stringN";

or maybe better to collect all outputs in a variable first:

$out.= "string1";
$out.= "string2";
................
$out.= "stringN";
echo $out;

Maybe someone made a kind of research in this field :)

View Replies !
Output As Csv
I'm trying to output the results of a database query as a csv file

The DB output is in $csv

foreach($csv as $array){
$line[]=implode($delimited_by,$array)."
";
}
header("Content-Type: text/plain");
header("Content-Disposition: inline");

foreach($line as $output){
print $output;


On clicking the link to this file the results are output to the screen.
I can right click and save the output but I'm prompted to save it as a
..php file. How can I make it output as the right kind ( .csv) of file?

View Replies !
Help With Output
I made a php page and the output from a mysql db is as follows:

Author1
Column1
Column2

Author2
Column1
Column2

Author3
Column1
Column2

Author2
Column1
Column2

These are sorted by columndate, so author2 has a column more recent than
author3 and one less recent, so author3 is sandwiched between. I'd like to
be able to have it so that the author 'group' is only shown once. I'd prefer
it to be outputted like:

Author
Column1
Column2

Author2
Column1
Column2

Author3
Column1
Column2

This is my source code:

<?
include ('../connection.php');

$result = mysql_query("SELECT * FROM article_authors,article_columns
WHERE article_authors.authorid = article_columns.columnauth
ORDER BY article_columns.columndate DESC,article_authors.authorname
ASC",$db)
or die (mysql_error());

if ($row = mysql_fetch_array($result)) {

// display list if there are records to display

do {

$authorid=$row["authorid"];
$authorname=$row["authorname"];
$authorcollection=$row["authorcollection"];
$authoremail=$row["authoremail"];

?>
<? if ($currentauthor != $authorname) {

$currentauthor = $authorname;

?>
<?

if ($authorcollection) {

?>
<p><b><a href="columns.php?author=<?echo $authorid?>"><?echo
$authorcollection?></a></b>
</p>
<?

}else{

?>

<p><b><?echo $authorname?></b></p>
<?
}

}

$columnid=$row["columnid"];
$columndate=$row["columndate"];
$columntitle=$row["columntitle"];
$columnauth=$row["columnauth"];
$columnintro=$row["columnintro"];

list ($date_year, $date_month, $date_day) = explode ('-', $columndate);

$string = "$columndate";

$stringArray = explode("-", $string);
$date = mktime(0,0,0,$stringArray[1],$stringArray[2],$stri
ngArray[0]);
$convertedDate = date("d/m/Y", $date);

?>

&raquo;<a href="http://www.efc-online.net/articles/columns/<?echo
$columnid?>"><?echo stripslashes($columntitle)?></a>
<br><?echo stripslashes($columnintro)?> - <?echo $convertedDate?><br>
<?
} while ($row = mysql_fetch_array($result));
}
?>

View Replies !
CGI Output
I have a rather complicated cgi (perl) weather script (ham weather pro) that I want to integrate into a php site. How do I do this?

View Replies !
Best Way To Output Xml From Php?
I've been googling for a few hours now and I can't seem to find any
tutorials on the best way to generate xml from php... most tutorials
tell you how to pase incoming xml xml. I'm used to using template to
output HTML to the browser but I want to start playing with ajax and
outputting XML to the browser anyone have any suggestions or links to
tutorials?

View Replies !
PHP Output Help
I was flicking through a PHP book (one of the teach in 24 hour ones)
and I came across something I had never seen before in PHP. It was a
method of printing out without using the print method, it was something
like :

<?= $myVar; ?>

Is this an out dated method? Is it compatible with all versions of PHP
(since implementation at least)?

View Replies !
Cant Get Output?
I have created a database where there is cross references from a supplier to another make all the information is there but cant get it to display on the screen? Code:

View Replies !
Add To Output
I have no idea how to put this all technical like so I'm just gonna have to ask untechnically. What I want to do is add something to the end of the output from a form.

For instance, if I had $name I want the output to be nameblah. Currently it just leaves it blank if I do $nameblah because of course that is not the name of the field.

View Replies !
SQL Output
I have a problem, I want to be able to display the results from a mysql database, say for example the field in the database called date contained the following few records:

Thursday 20 January 2007
Thursday 20 Feburary 2007
Wednesday 12 March 2006
Thursday 20 March 2007
Friday 21 March 2007
Thursday 20 April 2007

this field is a varchat field in the mysql database, how can i perform a query that will return each record based on the MONTH part of the string, for example if i choose March from the list it will return Code:

View Replies !
No Output At All
i just need a second (or 3rd, etc) pair of eyes to glance at this code to see if you can tell why i'm getting no screen output at all except for a notice about line 6 being an undefined variable. Code:

View Replies !
Using PHP To Output
This one should be simple I guess. I'm quite newbie with PHP, that's why asking. I'd like to build a script that outputs JS code that can be used within a <script> tag.

For example:

<script type="text/javascript" language="javascript" src="http://mydomain.com/widgetscript.php?v=param1"></script>

So the JS source is returned from the PHP script, according to the desired parameters.

View Replies !
Output
PHP Code:

$f = '<input type="hidden" name="comment" value="'.$_GET[comment].'">

How can I make the output of this be

<input type="hidden" name="comment" value='data here'> instead of

<input type="hidden" name="comment" value="data here">

View Replies !
Sql And Output Xml
I know this is possible, but i just keep messing it up. what i am trying to do is read data from mysql with php. i however, what that php file to generate xml so that it can be read into flash. make sense. i want to do what is in this tutorial, but more to it. http://www.creativecow.net/articles/ sql_flash.html. in that tutorial the xml looks something like this:

<products>
<item></item>
<products>

and it tells you how to do that. however, i want mine to have more nodes to it. like this

<blog>
<date>
<entry> </entry>
</date>
</blog>

View Replies !
Xml Output
i have a php file rendering a xml file. I need the xml file to be outputted in the following form Code:

<song name ="name" band ="band" file="file.mp3" />

The php file queries the db for the above fields. The php code i had was this PHP Code:

$xml_output .= " <band>" . $row['band'] . "</band>
";

however that outputed the xml as Code:

<band>band</band>

View Replies !
Output Into Table
I'd like to output some query results in a table, each result in it's own column and row. Here's an example --

***********************************
IF ($result){
echo "<center><table><tr><td>";
while ($r = mysql_fetch_array($result)) {
$number = $r["stock_number"];
$description = $r["item_description"];
echo "$number<br></td>";
echo "<td>$description<br>";
}
echo "</td></tr></table>";
} else
{
echo "No data.";
*********************************

Except it doesn't work correctly. What is the proper way to accomplish this?

View Replies !
Output Buffering (or Something)
I just attended an ASP.net course and I was just wondering if a type of technology also exists in PHP.

Its some kind of "tag" that tells the server if it should query the database for the data requested by a client, or if it should just return a cached version of the results from the query, thus saving on traffic to the database.

In ASP.net one could specify in a simple tag what the timeout on such a tag should be so that the code would only actually query the database for instance once every 10 minutes, and use cached versions of the data anytime else.

So: Can this functionality be found in PHP/MySQL somewhere?

View Replies !
Piping PHP Output?
Does anyone know whether it's possible to 'pipe' the output of one PHP script into another?

Essentially, what I want to do is have one PHP script (Script A) call another PHP script (Script B), which might retrieve data from a database, format it the way it would normally appear on the screen, but instead capture it in a variable (or some other method) in the script (Script A).

View Replies !
PHP Output To .csv - Garbage
I have a problem with the output that I am writing to .csv file. Below is the php code used to output contents into the .csv file: PHP Code:

View Replies !
Using PHP To Output A Form
I have a login system that gives registered users unique userIDs and stores their registration info in a MySQL DB. Now the tricky part:

I need a PHP that outputs a simple HTML form with a list of all the members (and their name and email) in the DB, with a checkbox next to each. This form must be specific to whomever is logged on, such that the data (s)he enters only goes into the relevant row, column or table of the individual whose checkbox was checked.

Summing up: I need a way for
(1) a form to display all the listed members in a MySQL DB and
(2) to have the info selected in the form entered into the relevant row, table, or column of the individual selected.

View Replies !
Problem With PHP Output
I have an html menu that I renamed menu.php. I then have a download
program which uses an index.php file. I did the standard <?php
include("menu.php"); ?command and I see the menu. However, it messes
up the php index file. When I go to download a file it just opens the
file on the screen for some reason rather than showing a popup window
asking where to put the downloaded file. I then tried to just add the
html code into the index.php file and that didn't work either. When I
take out the <?php include("menu.php"); ?command the script works
perfect. I then tried another download script and it puts the menu on
the screen, but the php file that runs after the menu is not centered
and looks bad. Does anyone know what the problem could be? Is it
something with my .htaccess file?

View Replies !
Random Output
I have a didyouknow section and would like to rotate or randomize the output. I have this code, but it's not working, PHP Code:

View Replies !
Printable Output
Is there a standard technique, in a PHP/MySQL Web Application, for users
to be provided with printable-quality output - e.g. business invoices -
created for them on the fly?...

View Replies !
Output Of Mysql_fetch_array
I was hoping someone could answer this or point me in the direction of a tutorial about the output of mysql_fetch_array
now I'm totally fine using it and dealing with it when I have only 1 record that matches the SQL query ie.

SELECT * FROM users WHERE ID = 1

I know from that I will get an array with all the fields from the database for that record and I can process the output like

$data = mysql_fetch_array($sql);

and then if I want to retrieve the value of a field then I can

$data['field']

but what if there are multiple entries that match the criteria - is it as simple as a multidimensional array?

I mean could I loop through the results and output them just by saying

while($count < = mysql_num_rows($sql)){
echo $data['field][$count];
}

Is that right?

View Replies !

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