php-general Digest 25 Feb 2011 23:58:41 -0000 Issue 7200

Topics (messages 311577 through 311581):

Re: Why is this array_walk_recursive action not working? [SOLVED]
        311577 by: Dave M G

Re: Dynamically Created Checkboxes
        311578 by: tedd

Re: How to write code: how wrong am I?
        311579 by: tedd
        311580 by: tedd

Re: mysql_num_rows()
        311581 by: tedd

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Feln, Richard, Jim,

Thank you for responding.

I understand now that the problem wasn't with variable scope, but with
my lack of understanding of what array_walk_recursive returns.

Thank you all for your explanations.

-- 
Dave M G

--- End Message ---
--- Begin Message ---
At 5:06 PM -0500 2/22/11, Gary wrote:
-snip-

Would appriciate your help.

Thank you.
--
Gary

Gary:

This might help:

http://php1.net/b/form-checkbox1/

Cheers,

tedd

--
-------
http://sperling.com/

--- End Message ---
--- Begin Message ---
At 9:13 AM -0500 2/22/11, Robert Cummings wrote:
On 11-02-22 08:58 AM, Dotan Cohen wrote:
On Tue, Feb 22, 2011 at 14:11, Jay Blanchard<jblanch...@pocket.com>  wrote:
It is an interesting concept Dotan, what is the goal? Who is the page
targeted to?

The goal is to have every open and close bracket matched, and not have
to worry about what is still open.

This is why I use the bracing style I use in PHP. A cursory glance of the code will show you where you've forgotten a brace. Syntax highlighting is also nice.

HTML can trip you up with missing or superfluous tags, but a quick run through the W3C validator will catch those errors.

Cheers,
Rob.

Rob is exactly right on both counts.

Place braces on their own lines and use the W3C Validator to check both html and css.

Cheers,

tedd

--
-------
http://sperling.com/

--- End Message ---
--- Begin Message ---
At 11:04 AM -0700 2/22/11, Alexis wrote:
On 22/02/11 09:40, Dotan Cohen wrote:
On Tue, Feb 22, 2011 at 16:15, Robert Cummings<rob...@interjinn.com>  wrote:
If you switch to vertically aligned braces you will have an easier time
matching up open and close braces...

if (something)
{
    // Code here
}

It's trivial to match using this style since you only need to scan one axis.


That bracing style drives me nuts! But I have no problem scanning a
single axis for the close brace and any statement, be it an if, while,
switch, or something else.


Well the way you do it, drives me nuts  :)

Morale of the story, do whatever *you* are most comfortable with..personally I indent as well, has it's downsides I admit, but it's what I've done for the last 20 years and I'm comfortable with it.

Alexis


I agree with Alexis.

Furthermore, I place braces on their own lines AND I do it in all languages I program in, such as CSS, PHP, JavaScript, and others.

Cheers,

tedd

--
-------
http://sperling.com/

--- End Message ---
--- Begin Message ---
At 12:40 AM -0500 2/22/11, Gary wrote:
Can someone tell me why this is not working?  I do not get an error message,
the results are called and echo'd to screen, the count does not work, I get
a 0 for a result...


$result = mysql_query("SELECT * FROM `counties` WHERE name = 'checked'") or
die(mysql_error());

if ( isset($_POST['submit']) ) {
for($i=1; $i<=$_POST['counties']; $i++) {
if ( isset($_POST["county$i"] ) ) {
echo "You have chosen ". $_POST["county$i"]." <br/>";
        }
    }
}

$county_total=mysql_num_rows($result);

while($row = mysql_fetch_array($result))
{$i++;
    echo $row['name'];
}
$county_total=mysql_num_rows($result);
echo "$county_total";

echo 'You Have '  .  "$county_total"  .  ' Counties ';

?>

Gary:

With regard of the count thing, why not let MySQL do the work?

$query = "SELECT COUNT(*) AS total FROM 'counties' WHERE name = 'checked' ";
$result = mysql_query($query) or die(mysql_error());
$total = $rowcount['total'];

Cheers,

tedd


--
-------
http://sperling.com/

--- End Message ---

Reply via email to