Re: [PHP] Newbie question: qutoes?

2005-03-06 Thread Matt Harnaga
Double quotes expand variables, that is, if $a = 2, then
echo "The value is $a2";
will print "The value is 2".
Single quotes return strings literally. So, echo 'The value is $a2' 
would print The value is $a2

Cheers
rory walsh wrote:
Can anyone tell me if there is a difference between double quotes and 
single quotes? Cheers,
Rory.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Newbie question: qutoes?

2005-03-06 Thread Matt Harnaga
You might want to check this out as well:
http://www.zend.com/zend/tut/using-strings.php
rory walsh wrote:
Can anyone tell me if there is a difference between double quotes and 
single quotes? Cheers,
Rory.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Mixed Up Values

2005-04-25 Thread Matt Harnaga
Mark Sargent wrote:
Hi All,
with the below code, $myrow[1] should = product_name's value, 
$myrow[2] should = product_model_number's value and $myrow[3] should = 
product_serial_number's value, but, product_name's value is not being 
displayed, and the values are being moved to the left 1. Meaning 
product_model_number is being displayed as product_name and so forth. 
What is wrong with the code.? Cheers.

Mark Sargent.
$result = mysql_query("SELECT product_name, product_model_number,
23 product_serial_number FROM Products",$db);
24
25
26
27 echo "\n";
28
29
30
31 echo "Product NameProduct Model 
NumberProduct
32 Serial Number\n";
33
34
35
36 while ($myrow = mysql_fetch_row($result)) {
37
38
39
40 printf("%s%s%s\n",
41 $myrow[1], $myrow[2], $myrow[3]);

Change line 41 to $myrow[0], $myrow[1], $myrow[2]);
By default, arrays start from 0 and work their way up, unless you supply 
index names/values yourself.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Displaying a html line as html

2005-02-01 Thread Matt Harnaga

You are using html entity code for brackets and such. When you use < 
instead of <, the web browser prints it literally as a < rather than 
interpreting it as an html symbol to mark the start of an anchor (or 
whatever). Replace the entity code with their 'regular' equivalents and 
you're print problem will go away.

-Matt
Todd Cary wrote:
Jochem -
Here is the function:
  /* Make page path */
  function make_page_path($page_string, $script_name) {
$parts = explode('|', $page_string);
for ($i = 0; $i < count($parts); $i++) {
  if ($i == 0) {
$page_path = '' . 
$parts[$i] . '';
  } else {
$page_path = $page_path . '->' . '' . $parts[$i] . '';
  }
}
//print("Page_path: " . $page_path . "");
return $page_path;
  }

Here is the executing code:
  $page_string   = make_page_string($page_string, "Search");
  $script_string = make_script_string($script_string, "search.php");
print("Page_string: " . $page_string . "");
print("Script_string: " . $script_string . "");
print("Url: " . $url . "");
  $page_path = make_page_path($page_string, $script_string, $url);
print($page_path);
To see it execute, this URL will do it: 
http://209.204.172.137/casesearch/php/search.php?search_text=***&page_string=Home&script_string=home.php 


The Title area contains
   
The function that creates the link(s) is
  /* Make page path */
  function make_page_path($page_string, $script_string, $path) {
$scripts = explode('|', $script_string);
$pages   = explode('|', $page_string);
for ($i = 0; $i < count($scripts); $i++) {
  if ($i < count($scripts) - 1) {
if ($i == 0) {
  $page_path = '' 
. $pages[$i] . '';
} else {
  $page_path = $page_path . '->' . '' . $pages[$i] . '';
}
  } else {
if ($i == 0) {
  $page_path = $pages[$i];
} else {
  $page_path = $page_path . '->' . $pages[$i];
}
  }
}
//print("Page_path: " . $page_path . "");
return $page_path;
  }


Thank you for your help...
Todd
Jochem Maas wrote:
Todd Cary wrote:
OK...I am close, but still missing something.  The string returned 
by the function is $page_path and it contains

http://209.204.172.137/casesearch/php/search.php";>Home->   

 ^
what ever else you function is doing this is probably not correct
   

http://209.204.172.137/casesearch/php/search.php";>Search
And here is how the function is used:
funny thing is you don't show the code for the function - AND i 
willing to
bet money that the function uses html_entities() - or an equivelant...

you say the function returns:
http://209.204.172.137/casesearch/php/home.php";>Home
but that is bullshit (if everything else you say it true, namely a 
direct echo of the return
value does not show a link), if you bother to look at your own 
source, then you
will see that the string that is output is:

Home; 

actually I noticed that the site had changed a little since I 
happened to look yesterday.
today you are dumping some debug output at the top of the page, where 
as yesterday
you we outputting the borked link next to the logo (the home link 
there now works - I suspect
that this is because you have reverted to functionality there?)

post the code for the make_page_path() function!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php