echo

Large maintenance php scritp. How to print debug string while the script is executing?

I have a very large php maintenance script (basically it recreates thumbnails for an internal archive), it takes 10 to 20 minutes to complete and I noticed that php only displays "echos" when the whole script has finished parsing. Is there any way to show messages like: Phase 1 - Complete Phase 2 - Complete Phase n - Complete While th...

How do I echo $command without breaking the layout

Hi. I'm trying to do the following in a bash script: com=`ssh host "ls -lh" ` echo $com It works, but the echo will break the output (instead of getting all lines in a column, I get them all in a row). If I do: ssh host ls -lh in the CLI it will give me the correct output + layout. Any ideas? ...

When should I use print instead of echo in PHP?

I understand that echo is slightly faster, and print can be used as a function, but I've been reading an e-book on PHP, and the writer is using print, instead of echo, to output very simple text. print "Your name is $name\n"; So my question is, when would it be appropriate for me to use print as opposed to echo? ...

echo that shell-escapes arguments

Is there a command that not just echos it's argument but also escapes them if needed (e.g. if a argument contains white space or a special character)? I'd need it in some shell magic where instead of executing a command in one script I echo the command. This output gets piped to a python script that finally executes the commands in a mo...

Program repeats each time a character is scanned .. How to stop it ?

Hello there, I have a program that has this code : #include<stdio.h> main(){ int input; char g; do{ printf("Choose a numeric value"); printf(">"); scanf("\n%c",&input); g=input-'0'; }while((g>=-16 && g<=-1)||(g>=10 && g<=42)||(g>=43 && g<=79)); } It basically uses ASCII manipulation to allow the program to ...

How do I sanitize a string in PHP that contains "; Echo"? (I have a solid reason)

I turned this case into a simple PHP page that submits to itself. My issue is that I am submitting track meet results and one of the girl's names is Echo...a lovely name. The problem text I'm submitting is: Pole vault - Rachel Simons, Tow, 8-6; Echo Wilson, Cit, 8-0; Molly Randall, Tow, 7-0; So you see a semicolon followed by white sp...

Echoing variable construct instead of content

I'm merging two different versions of a translations array. The more recent version has a lot of changes, over several thousand lines of code. To do this, I loaded and evaluated the new file (which uses the same structure and key names), then loaded and evaluated the older version, overwriting the new untranslated values in the array wi...

PHP CLI Application on Debian: why can't I output a line break?

Hello! I have a really puzzling problem: I am writing a PHP CLI application running on a debian server. I am connected to the server via SSH, just the normal way. Everything runs as usual. Except the following: echo "My CLI fun\n\n"; echo "Is this."; Outputs on the SSH terminal, when executing the PHP script: My CLI funIs this. I ...

Echo html+php from database

I am working on a site which deals with a lot of texts in HTML, so recently I learned PHP and moved them into a MySQL database and echo the contents given a specific chapter and section. Now this works relatively fine, the HTML shows up properly. However, in some parts I have included PHP function calls, and these doesn't seem to be eval...

Why does echo-ing "<! <" return "<! >"?

Here is my exact code. <?php echo "<! <"; ?> And this is the returned string. <! > Why is the last character changing? ...

How do I use inverted commas in the echo function in PHP?

How do I use inverted commas in the echo function in PHP? echo "<script type="text/javascript">"; doesnt work well. Thank you! ...

PHP echo if post equals, help

I am trying to echo the action for my form if a post equals 'paypal' This is what I have: <?php if $_POST['method'] == 'paypal' echo 'action="paypal/process.php"' else echo 'action="moneybookers/process.php" '?> Do i need to print the variable before I do this? what am I doing wrong? I get this error: Parse error: syntax error, un...

PHP echo text if variable is blank

I am trying to echo €00.00 if my variable $amount equals zero I have done something wrong can you help?? Code while ($row9 = mysql_fetch_array($result9)) { $amount = $row9['amount']; } //$amount = $amount / 60; //$amount = round($amount, 2); if $amount == 0 echo "<b>Balance: &#8364;00.00</b>"; else echo "<b>Balance: $$amount</b>"; ...

echo -e acts differently when run in a script by root on ubuntu

When running a bash script on ubuntu 9.10, I get different behavior from bash echo's "-e" option depending on whether or not I'm running as root. Consider this script: $ cat echo-test if [ "`whoami`" = "root" ]; then echo "Running as root" fi echo Testing /bin/echo -e /bin/echo -e "foo\nbar" echo Testing bash echo -e echo -e "foo\nb...

My simple PHP is outputting wrong things.

EDIT: I forgot to add semi colons. Now there is another problems. I'm getting a error: Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\useraccess.php on line 12 It outputs: 0){ echo 'si'; } ?> When it should only output 'si' in the body. Here's the code: <html> <head> </head> <body> <? ...

What is the ASP.Net equivalent to PHP's Echo?

I want to 'echo' a string separated by delimeters like: sergio|tapia|1999|10am the Body of an HTML page. How can I achieve this? Thank you! ...

jquery $.post returned data from php is empty

hi, i'm using this code to post to a php page: var qreq = ".....myurl.php"; $.post(qreq, function(data){alert(data);}); in my PHP file i have this: ...... $prevtopic = $row["topic_id"]; echo $prevtopic; the alert comes up, but is blank. for some reason data is empty even though i'm echoing from the PHP file. i also tried just echo...

PHP Speed - Many Echos vs Building a String

Wondering if anyone knows if either of these methods would produce an output faster: Method 1 for ($i=1;$i<99999;$i++) { echo $i, '<br>'; } or Method 2 for ($i=1;$i<99999;$i++) { $string .= $i . '<br>'; } echo $string; Thanks for any input you have. ...

Displaying data from mutliple arrays with codeigniter

I am trying to display results from a database where the results are contained in three tables. How do I echo out the results? $p-> works, but $img-> or $branch-> doesn't. What am I doing wrong? Example code is below Sample controller: $p_id = $this->uri->segment(3); $this->load->model('One_model'); $data['prop'] = $this-...

Echo autoincrement id doubt

Hi, can I print the id, even if it's autoincrement ? Because the way I'm doing I'm using an empty variable for id. $id= ""; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die ("Não conectou com a base $database"); mysql_query("INSERT INTO table1(id,...) VALUES ('".$id."',....)") or die(mysql_error()); m...