Jason Pruim | 1 May 2010 01:14

Re: Two color rows in table inside while iteration -- just say no to mod


On Apr 30, 2010, at 4:20 PM, Daevid Vincent wrote:

>> -----Original Message-----
>> From: Ashley Sheridan [mailto:ash <at> ashleysheridan.co.uk]
>>
>> Modulus is the most elegant solution I reckon. Imagine if you only
>> needed to highlight every 3rd row, or 4th? Easy to change the modulus
>> for it, not so easy to re-work a binary switch.
>>
>> -----Original Message-----
>> From: Richard Quadling [mailto:rquadling <at> googlemail.com]
>>
>> The modulus is a good option when there are more than 2 states.
>>
>> Say a 5 row fade ...
>>
>> $a=0;
>> while ($row=mysql_fetch_...){
>> echo "<tr class=??????\"alternate-row-".(1 + (++$a%5))."\"><..."
>> }
>>
>> giving alternate-row-1, alternate-row-2, alternate-row-3,
>> alternate-row-4 and alternate-row-5
>
> Okay, how many tables do you EVER see with more than TWO colors?  
> Come on
> now.
>
> Show me some URL's to REAL sites (not some contrived examples) that  
(Continue reading)

Piero Steinger | 1 May 2010 01:23
Picon

Re: multi dimensional array question

Am 01.05.2010 00:57, schrieb Nick Balestra:
> hello everybody here is my array(s)
>
>
> $us_census = array('NY' => array('New York' => 8008278),
> 				   'CA' => array('Los Angeles' => 3694820,
> 				   				 'San Diego' => 1223400),
> 				   'IL' => array('Chicago' => 2896016),
> 				   'TX' => array('Houston' => 1953631,
> 				   				 'Dallas' => 1188580,
> 				   				 'San Antonio' => 1144646),
> 				   'PA' => array('Philadelphia' => 1517550),
> 				   'AZ' => array('Phoenix' => 1321045),
>  				   'MI' => array('Detroit' => 951270)); 
>
>
>
> print "<table><tr><th>State</th><th>City</th><th>Population</th><th>Total</th></tr>";
>
> 		   
> // $state is the key and $states is the value 
> foreach ($us_census as $state => $cities) {
>
> 	// $state is the key and $habitant is the value
> 	foreach ($cities as $city => $habitants){
>
>
> 		
> 		print "<tr><td>$state</td><td>$city</td><td>$habitants</td><td></td></tr>";
> 		
(Continue reading)

Nick Balestra | 1 May 2010 02:33
Gravatar

Re: multi dimensional array question

thanks Piero!

i was trying to solve an excercise on "learning php5" (O'reilyl) book.

I am happy abotut his solution with the array_sum funtion you suggested, and my multidimensional array
make much more sense to mee then they suggested solution that also much more line of code comapred... 

look: my solution (with Piero suggeston): and ont he bottom the book solution. what do u say is the best one?
why? i am learning so i am interested in understanding why a solution can be better then an other...

$us_census = array('NY' => array('New York' => 8008278),
				   'CA' => array('Los Angeles' => 3694820,
				   				 'San Diego' => 1223400),
				   'IL' => array('Chicago' => 2896016),
				   'TX' => array('Houston' => 1953631,
				   				 'Dallas' => 1188580,
				   				 'San Antonio' => 1144646),
				   'PA' => array('Philadelphia' => 1517550),
				   'AZ' => array('Phoenix' => 1321045),
 				   'MI' => array('Detroit' => 951270)); 
 				   

print "<table><tr><th>State</th><th>City</th><th>Population</th><th>Total</th></tr>";

foreach ($us_census as $state => $cities) {

	foreach ($cities as $city => $habitants){

		$tothabitants += $habitants;
		
(Continue reading)

Gary | 1 May 2010 02:43
Favicon

Any One See where this is going wrong?

I have this duplicate code on another site and it works fine.  The image is 
uploaded to the images folder, the information is not submitted to the 
database.  I get the error

Some Error Occured While Inserting Records

This is only on a local machine so I have not yet included and safegaurds 
like stripslashes or my_real_escape_string.

Thanks for your help

Gary

<?php
if (isset($_POST['submit']))  {
$manufacturer=($_POST['manufacturer']);
$type=($_POST['type']);
$model=($_POST['model']);
$caliber=($_POST['caliber']);
$condition=($_POST['condition']);
$price=($_POST['price']);
$description=($_POST['description']);
$image_file_name=($_POST['image_file_name']);
$image_file=($_FILES['image_file']);
$available=($_POST['available']);

$image_file = $_FILES['image_file']['name'];
$image_type = $_FILES['image_file']['type'];
$image_size = $_FILES['image_file']['size'];

(Continue reading)

Ashley Sheridan | 1 May 2010 02:45
Picon

Re: Any One See where this is going wrong?

On Fri, 2010-04-30 at 20:43 -0400, Gary wrote:

> I have this duplicate code on another site and it works fine.  The image is 
> uploaded to the images folder, the information is not submitted to the 
> database.  I get the error
> 
> Some Error Occured While Inserting Records
> 
> This is only on a local machine so I have not yet included and safegaurds 
> like stripslashes or my_real_escape_string.
> 
> Thanks for your help
> 
> Gary
> 
> <?php
> if (isset($_POST['submit']))  {
> $manufacturer=($_POST['manufacturer']);
> $type=($_POST['type']);
> $model=($_POST['model']);
> $caliber=($_POST['caliber']);
> $condition=($_POST['condition']);
> $price=($_POST['price']);
> $description=($_POST['description']);
> $image_file_name=($_POST['image_file_name']);
> $image_file=($_FILES['image_file']);
> $available=($_POST['available']);
> 
> $image_file = $_FILES['image_file']['name'];
> $image_type = $_FILES['image_file']['type'];
(Continue reading)

Gary | 1 May 2010 03:12
Favicon

Re: Any One See where this is going wrong?

This is the other code that works on the same server.

<?php
if (isset($_POST['submit']))  {
$caption=($_POST['caption']);
$description=($_POST['description']);
$image_file=($_FILES['image_file']);
$where_taken=($_POST['where_taken']);

$fox=($_POST['fox']);
$wolves=($_POST['wolves']);
$wildlife=($_POST['wildlife']);
$scenic=($_POST['scenic']);
$birds=($_POST['birds']);
$eagles=($_POST['eagles']);
$deer=($_POST['deer']);
$small_mammals=($_POST['small_mammals']);
$large_mammals=($_POST['large_mammals']);
$dogs=($_POST['dogs']);
$cats=($_POST['cats']);
$flowers=($_POST['flowers']);
$insects=($_POST['insects']);
$bear=($_POST['bear']);
$moose=($_POST['moose']);

$image_file = $_FILES['image_file']['name'];
$image_type = $_FILES['image_file']['type'];
$image_size = $_FILES['image_file']['size'];

include('includes/connect_local.inc.php');
(Continue reading)

kranthi | 1 May 2010 07:53
Picon

Re: Any One See where this is going wrong?

may be it is not the error with the code. The problem may be with some
'  in the input. Print out the mysql error and/or the sql query to see
what is going wrong.

--

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

Robbert van Andel | 1 May 2010 08:58
Picon

SharePoint

I've been trying to connect to our SharePoint server's webservices
with PHP. I downloaded the nusoap library and have been trying to make
a connection using sample code from various websites. I keep getting
the following error:

<h1>You are not authorized to view this page</h1>
You do not have permission to view this directory or page using the
credentials that you supplied because your Web browser is sending a
WWW-Authenticate header field that the Web server is not configured to
accept.
<h2>HTTP Error 401.2 - Unauthorized: Access is denied due to server
configuration.<br>Internet Information Services (IIS)</h2>

My code looks like this:

require_once('/usr/share/php/nusoap/nusoap.php');

/*  Your username and password, separated by a colon
    Domain may be optional, depending on your setup */
$auth = "username:password";

/*  Location of the Lists.asmx file
    If the list is in a subsite, the subsite must be in the path */
$wsdl = "http://domain.com/depts/is/private/_vti_bin/Lists.asmx?WSDL";

/*  GUID of the list */
$guid = "Shared Documents";

/* Setup NuSOAP
   Sharepoint requires NTLM Authorization
(Continue reading)

Robbert van Andel | 1 May 2010 08:59

SharePoint

I've been trying to connect to our SharePoint server's webservices
with PHP. I downloaded the nusoap library and have been trying to make
a connection using sample code from various websites. I keep getting
the following error:

<h1>You are not authorized to view this page</h1>
You do not have permission to view this directory or page using the
credentials that you supplied because your Web browser is sending a
WWW-Authenticate header field that the Web server is not configured to
accept.
<h2>HTTP Error 401.2 - Unauthorized: Access is denied due to server
configuration.<br>Internet Information Services (IIS)</h2>

My code looks like this:

require_once('/usr/share/php/nusoap/nusoap.php');

/*  Your username and password, separated by a colon
    Domain may be optional, depending on your setup */
$auth = "username:password";

/*  Location of the Lists.asmx file
    If the list is in a subsite, the subsite must be in the path */
$wsdl = "http://domain.com/depts/is/private/_vti_bin/Lists.asmx?WSDL";

/*  GUID of the list */
$guid = "Shared Documents";

/* Setup NuSOAP
   Sharepoint requires NTLM Authorization
(Continue reading)

Ali Asghar Toraby Parizy | 1 May 2010 10:01
Picon

Re: How to Force IE to download text file?

attachment is correct syntax and solves the problem.
Thanks

On Fri, Apr 30, 2010 at 9:44 PM, Andre Polykanine <andre <at> oire.org> wrote:
> Hello Ali,
>
> It's attachment, not attachement. Maybe here's the reason? Just a
> thought.
> --
> With best regards from Ukraine,
> Andre
> Skype: Francophile; Wlm&MSN: arthaelon  <at>  yandex.ru; Jabber: arthaelon  <at>  jabber.org
> Yahoo! messenger: andre.polykanine; ICQ: 191749952
> Twitter: m_elensule
>
> ----- Original message -----
> From: Ali Asghar Toraby Parizy <aliasghar.toraby <at> gmail.com>
> To: php-general <at> lists.php.net <php-general <at> lists.php.net>
> Date: Friday, April 30, 2010, 7:19:38 PM
> Subject: [PHP] How to Force IE to download text file?
>
> I have written this code to export data to a text file and asks user
> to save generated file. It works with Firefox perfectly, but IE shows
> content of file instead of prompting the download window.
> How can I force IE to show the download dialog?
>
> <?php
> Header("Content-disposition: attachement; filename=data.txt");
> Header("Content-type: text/plain");
> echo $some_data;
(Continue reading)


Gmane