[PHP] advice on setting up new site

2009-11-11 Thread PJ
Hi guys,
I've already posted on FreeBSD and didn't want to ignore you, so here goes:
I appreciate the help you have given me in the past and present... I am
not competent to handle the project we are embarking on, so let me ask
(offer ?) it here:
We're about to start new enterprise in the food service sector (I hate
the terms industry for anything related to food) which is a totally new
concept - can't reveal at the moment. And we are going to need someone
to implement the site.
So here's what I need to find out:
1. We're looking for someone who would be interested in working on it
and could handle all aspects on FreeBSD (I want to avoid MS and
especially anything not open source - requires programming of whatever
works best -- important: database (probably mysql - seems to be most
popular and our host uses it); will need flash or lots of images &
eventually instructional videos (flash ? or ?)
will need gps tracking of equipment (vehicles); inventory tracking on
daily/weekly basis; invoicing; AR/AP and CC management.
There's no reason why the work can't be done over the Internet... I've
done this before...
Let me know if you're interested and we can discuss methods of working
and payment... etc.
2. I would appreciate some suggestions about Unix programs that could be
applicable to meet our needs.
I look forward to hearing from from you :-)
Questions are welcome ... so are investors ;-)
PJ



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



Re: [PHP] input form save and display conflict

2009-10-27 Thread PJ
Ashley Sheridan wrote:
> On Thu, 2009-10-22 at 21:32 -0400, PJ wrote:
>> I have several input fields to update a book database. There seems to be
>> a conflict in the way tags and text are input through php/mysql and
>> phpMyAdmin. If I enter the data with phpMyAdmin the input fields in the
>> php page see quotation marks differently than what is input in phpMyAdmin.
>> example:
>> if the data is input through the update form, single quotes cause an
>> error. Double quotes update the db but when the edit(update) form
>> displays the text for modification outside the input field except for
>> the first part, precisely where the first quotation mark appears in the
>> text - as below:
>>
>> *Reviewed by mailto:recipi...@somewhere.com";>Recipient:
>> blah, blah, blah...religion." _size="50" />_
>> The text in square brackets is displayed outside the input field and
>> includes part of the code at the end.
>> bold is within the field, the rest is outside and the underlined is part
>> of code.
>>
>> If the same text is entered with phpMyAdmin using single quotes and the
>> " characters, the display in the editing field shows correctly...
>> but it will not update, that is, the update query generates errors and
>> only accepts the double quotes within the tags.
>>
>> So, the question is, are there some kind of metacharacters to be used to
>> have mysql accept the " ? I have triee backslashing, forward slashing
>> and they don't do it.
>>
>> Or is there an encoding conflict here? It looks like a display and save
>> mismatch somewhere...
>>
>> below is another example:
>> > href='http://www.amazon.com/exec/obidos/ASIN/0773468943/frankiesbibliogo' 
>> <http://www.amazon.com/exec/obidos/ASIN/0773468943/frankiesbibliogo%27>>> height=68 alt="Order This Book From Amazon.com"
>> src="../images/amazon1.gif" width=90 border=0 />
>>
>> The single quotes for the href seem to work. But the " does not work;
>> and using " or ’  also also do not display correctly; again,
>> from "Order... the image is not displayed but only the image blank with
>> "Order.. " in it.
>> I'm rather puzzled.
>>
>>
>>
>>
>>
>>
>>
>>
>> 
>
> Single quotes need to be escaped if you are using them as part of a
> query. For example:
>
> $query = "UPDATE table SET title='This is a title with \"quoted\"
> \'characters\''";
>
> Note that here, double quotes are used to encapsulate the whole query
> string (as it is generally preferred this way), the value of the title
> field is encapsulated in single quotes. Lastly, where I've wanted
> double quotes to be used in the query, I've escaped them with a
> back-slash. This escapes them from PHP, as mysql is using single
> quotes, so directly in the query they're fine. The single quotes are
> also escaped with back-slashes, but this time to escape them from
> mysql, as single quotes are used as the string delimiters there.

I've had a chance to think about the problem and I think this will fix it.
The edit page retieves the form input variable = commentIN and echos to
the browser. The problem is that the browser displays commentIN without
the the backslashes and that is what is then resubmitted if the submit
is execcuted (without the slashes).
Therefore, it seems to me, I must use preg_replace to add the \ to the
single quotes in the commentIN variable just before the update query...
My only question, then, is how do I do the preg_replace in the commentIN
. Is it something like $commentIN = (act  on $commentIN) or do I have to
do a $another_name = (preg_whatever, $commentIN and then reassign
$commentIn = $another_name ?
TIA.

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



[PHP] input form save and display conflict

2009-10-22 Thread PJ
I have several input fields to update a book database. There seems to be
a conflict in the way tags and text are input through php/mysql and
phpMyAdmin. If I enter the data with phpMyAdmin the input fields in the
php page see quotation marks differently than what is input in phpMyAdmin.
example:
if the data is input through the update form, single quotes cause an
error. Double quotes update the db but when the edit(update) form
displays the text for modification outside the input field except for
the first part, precisely where the first quotation mark appears in the
text - as below:

*Reviewed by mailto:recipi...@somewhere.com";>Recipient:
blah, blah, blah...religion." _size="50" />_
The text in square brackets is displayed outside the input field and
includes part of the code at the end.
bold is within the field, the rest is outside and the underlined is part
of code.

If the same text is entered with phpMyAdmin using single quotes and the
" characters, the display in the editing field shows correctly...
but it will not update, that is, the update query generates errors and
only accepts the double quotes within the tags.

So, the question is, are there some kind of metacharacters to be used to
have mysql accept the " ? I have triee backslashing, forward slashing
and they don't do it.

Or is there an encoding conflict here? It looks like a display and save
mismatch somewhere...

below is another example:


The single quotes for the href seem to work. But the " does not work;
and using " or ’  also also do not display correctly; again,
from "Order... the image is not displayed but only the image blank with
"Order.. " in it.
I'm rather puzzled.








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



Re: [PHP] Is select_db necessary?

2009-08-12 Thread PJ
Paul M Foster wrote:
> On Tue, Aug 11, 2009 at 08:23:21PM -0700, Allen McCabe wrote:
>
>   
>> I have seen different scripts for working with SQL, and most follow the same
>> method with on difference.
>>
>> Variables are defined (host, password, etc.)
>> mysql_connect command
>>
>> //then, the difference
>>
>> mysql_select_db command
>>
>> //back to common
>>
>> $sql = "SELECT ... "
>> $result = mysql_query($ql)
>>
>> Is the database selection necessary, or is that implied with a SELECT or
>> other SQL command?
>> 
>
> All major SQL DBMSes can have multiple databases available. A given
> database may contain a variety of tables. If you simply start firing SQL
> commands at a DBMS, it won't know which database to look in unless you
> tell it. By contrast, the connection process in PostgreSQL must include
> a database; there is no separate database selection function call.
>
> Paul
>   
I seem to recall from the manual, that once you have done mysql_connect
, any subsequent queries will be directed at the same db until another
mysql_connect points to another db. I repeat the call with every query
as a precaution.
I'm not expert, but I thought I'd offer my observation and am open to
correction. ;-)
PJ


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



Re: [PHP] another pagination problem

2009-07-17 Thread PJ
Ashley Sheridan wrote:
> On Friday 17 July 2009 16:35:10 PJ wrote:
>   
>> I noticed the thread on pagination here just after posting to mysql. But
>> I am using php/mysql ;-)
>> I have some rather complicated ordering problems:
>> 1. need to order by 2 fields title, sub_title
>> 2. need to display 10 items per page (hundreds, if not 1000s or pages)
>> 3. order by ASC or DESC makes not difference when ordering by 2 fields
>> 4. when ordering by title, results are totally different for ASC & DESC;
>> not the same data at all (Is the ordering done on the entire db? )
>> 5. those funny little dingles over foreign language characters refuse to
>> follow our normal ordering rules; how do we do this?
>> 6. The pagination and ordering syntax is correct & working with no
>> errors; I've double checked on commandline.
>> 7. At worst, I'll have to leave it at ASC and let visitors p&m; don't
>> see a simple solution.
>>
>> Or am I wrong?
>>
>>
>> --
>> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
>> -
>> Phil Jourdan --- p...@ptahhotep.com
>>http://www.ptahhotep.com
>>http://www.chiccantine.com/andypantry.php
>> 
>
> How are you attempting to order the query, do you have an excerpt? I've never 
> had any problems ordering my results based on more than one field, where the 
> orders are based on a mixture of ASC and DESC fields. The ordering part looks 
> something like this:
>
> ORDER BY `field1` DESC, `field2` ASC, `field3` DESC
>
> and that works just fine for me. Also, what character set are you using on 
> that table, as that may have a difference on how the ordering works.
>
>   
Sorry, forgot: another problem is the Thes - how do you exclude them
from the ordering.

Also: one output with just title for field returned a series of The
Art.., The Birds..., The Birth...etc. in ASC; whereas DESC returned:
Boats, Black Cumin, Birds of..., Biological..., Bioarchaeology..,
Avaris... etc.

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] another pagination problem

2009-07-17 Thread PJ
Ashley Sheridan wrote:
> On Friday 17 July 2009 16:35:10 PJ wrote:
>   
>> I noticed the thread on pagination here just after posting to mysql. But
>> I am using php/mysql ;-)
>> I have some rather complicated ordering problems:
>> 1. need to order by 2 fields title, sub_title
>> 2. need to display 10 items per page (hundreds, if not 1000s or pages)
>> 3. order by ASC or DESC makes not difference when ordering by 2 fields
>> 4. when ordering by title, results are totally different for ASC & DESC;
>> not the same data at all (Is the ordering done on the entire db? )
>> 5. those funny little dingles over foreign language characters refuse to
>> follow our normal ordering rules; how do we do this?
>> 6. The pagination and ordering syntax is correct & working with no
>> errors; I've double checked on commandline.
>> 7. At worst, I'll have to leave it at ASC and let visitors p&m; don't
>> see a simple solution.
>>
>> Or am I wrong?
>>
>>
>> --
>> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
>> -
>> Phil Jourdan --- p...@ptahhotep.com
>>http://www.ptahhotep.com
>>http://www.chiccantine.com/andypantry.php
>> 
>
> How are you attempting to order the query, do you have an excerpt? I've never 
> had any problems ordering my results based on more than one field, where the 
> orders are based on a mixture of ASC and DESC fields. The ordering part looks 
> something like this:
>
> ORDER BY `field1` DESC, `field2` ASC, `field3` DESC
>
> and that works just fine for me. Also, what character set are you using on 
> that table, as that may have a difference on how the ordering works.
>
>   
Here's the query:
"SELECT * FROM book ORDER BY $sort $dir LIMIT $offset, $records_per_page";
$sort == 'title, sub_title'; $dir==ASC (or DESC); $offset== (any
multiple of 10); $records_per_page== 10;
I could let the user change these, but I decided it is simpler to keep
it at 10 books/page. Only the $dir is user settable.
The character set is utf8-general; (I just went through some
self-torture changing all those foreign curlicues to :&cutesy_stuff;
fortunately, the mysql replace() function helped - but six languages
have quite a few weird accents.
The title field can be fairly long - 182 chars; sub_title is 128, but it
looks like I have to lengthen that too; found some truncated inputs.

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



[PHP] another pagination problem

2009-07-17 Thread PJ
I noticed the thread on pagination here just after posting to mysql. But
I am using php/mysql ;-)
I have some rather complicated ordering problems:
1. need to order by 2 fields title, sub_title
2. need to display 10 items per page (hundreds, if not 1000s or pages)
3. order by ASC or DESC makes not difference when ordering by 2 fields
4. when ordering by title, results are totally different for ASC & DESC;
not the same data at all (Is the ordering done on the entire db? )
5. those funny little dingles over foreign language characters refuse to
follow our normal ordering rules; how do we do this?
6. The pagination and ordering syntax is correct & working with no
errors; I've double checked on commandline.
7. At worst, I'll have to leave it at ASC and let visitors p&m; don't
see a simple solution.

Or am I wrong?


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] Obeying the rules (was Simple login form with cookies)

2009-07-09 Thread PJ
Tony Marston wrote:
> There are too many people in this newsgroup with the idea that you  MUST 
> obey the rules, whatever they are, WITHOUT QUESTION. I do not subscribe to 
> this notion. I have been working in IT (or DP as it was originally called) 
> for over 30 years, and in that time I have worked with many groups, and each 
> group has had its own version "the rules" (aka "guidelines" or "standards"). 
> When moving to a new group the new rules will always be different, and will 
> sometimes contradict what you had before. Why is this? Why do some groups 
> say "do A instead of B" while others say "do B instead of A"? Does it make a 
> difference?
>
> The problem partially lies in the way in which the rules are created. It 
> starts with some wise ass saying
> (1) Without rules there will be anarchy, so we must have rules.
> (2) There are no such things as bad rules.
> (3) Do not allow any choices. If there is a choice between A and B then 
> choose one as the standard. It doesn't matter which one.
> (4) Everybody must be the same, nobody is allowed to be different.
> (5) The rules must be obeyed without question.
> (6) If a rule causes a problem then you must work around it, you cannot 
> change the rule.
>
> Item (5) usually exists because the author of the rule cannot justify its 
> existence. He just flipped a coin and it came down tails instead of heads, 
> so that's it. Any moron can make rules like this.
>
> Some people just cannot understand that sometimes a rule was created for a 
> certain set of circumstances, but if the circumstances change then the rule 
> needs changing in order to keep up with the times. Because they do not 
> understand why the rule was created in the first place, they do not see that 
> it needs changing. They also do not have the intelligence to see how the 
> rule might be changed to suit the new circumstances.
>
> I have fought against arbitrary and stupid rules for decades, and I will 
> keep fighting till the day I die. If you have a problem with that, then so 
> be it.
>
>   
Yea Tony... I'm with you all the way.
but... I think we're fighting a losing battle... I recall some
confrontations with parking rule enforcers - why can't you park in an
area that normally is forbidden but when you park there in a situation
where obviously and with common sense you will not be obstructing anyone
or anything? You can't win that and then we have gone so far boyond such
needless intolerance and stupidity that I can no longer detect our
little planet throught all the muddied rules & regulations one
manifestation of utterly stupid and useless law, rule or whatever is the
use of those little stickers on fruits and vegetables... you may know
where the little thing comes from but the ways of contamination are so
multitudinous that tracing the contamination is virtually impossible...
did anyone ever find the person that laced those Tylenol pills so many
years ago? ;-)

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] Simple login form with cookies

2009-07-08 Thread PJ
Paul M Foster wrote:
> On Wed, Jul 08, 2009 at 03:23:49PM -0400, Bob McConnell wrote:
>
>   
>> From: Tony Marston
>>
>> 
>>> I do not follows rules which cannot be justified beyond the expression
>>>   
>> "It 
>> 
>>> is there, so obey it!" Why is it there? What are the alternatives?
>>>   
>> What harm 
>> 
>>> does it do? What happens if the rule is disobeyed? Top posting existed
>>>   
>> in 
>> 
>>> the early days of the internet, and for a logical reason. Then some
>>>   
>> arrogant 
>> 
>>> prat came along and said "I don't like this, so I am going to make a
>>>   
>> rule 
>> 
>>> which forbids it!". I don't like this rule, so I choose to disobey it.
>>>   
>> Daniel already explained to you why it is there. Long threads get too
>> confusing with top posting. When posted correctly they read
>> chronologically from top to bottom so they can be followed and
>> understood when referenced a year or two later.
>>
>> Top posting did not exist in the early days of the Internet. I was
>> active on email listserves and Usenet newsgroups 18 years ago, long
>> before Microsoft discovered them and decided that top posting should be
>> the norm. All of the other news and email clients I have ever used
>> defaulted to bottom posting. It was only in Outlook 2003 that Microsoft
>> finally removed that option completely. Previous versions allowed bottom
>> posting and even handled the attribution markup correctly.
>> 
>
> Also, Tony's mail reader is broken-- Microsoft Outlook Express 6.
>
> Paul
>
>   
Actually, I prefer "middle posting" ;-)

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] Simple login form with cookies

2009-07-08 Thread PJ
Tony Marston wrote:
> I do not follows rules which cannot be justified beyond the expression "It 
> is there, so obey it!" Why is it there? What are the alternatives? What harm 
> does it do? What happens if the rule is disobeyed?
Damn, isn't life frustrating... in case no one has noticed, 99 % of the
rules we have in society are made by idiots and power hungry dimwits...
how often do you see a politician or "leader" who is an intelligent
person, let alone an "intellectual" ?

Hate to say it, but "top posting" is about as rrelevant to our exixtence
as a bacterial fart. :-D
>  Top posting existed in 
> the early days of the internet, and for a logical reason. Then some arrogant 
> prat came along and said "I don't like this, so I am going to make a rule 
> which forbids it!". I don't like this rule, so I choose to disobey it.
>
>   


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] Simple login form with cookies

2009-07-08 Thread PJ
Andrew Ballard wrote:
> On Wed, Jul 8, 2009 at 11:53 AM, PJ wrote:
>   
>> Michael A. Peters wrote:
>> 
>>> Daniel Brown wrote:
>>>   
>>>> First, a reminder to several (including some in this thread) that
>>>> top-posting is against the law here.
>>>>
>>>> On Wed, Jul 8, 2009 at 09:48, Martin Scotta
>>>> wrote:
>>>> 
>>>>> $sql = 'SELECT * FROM your-table WHERE username = \''. $username .'\'
>>>>> and passwd = md5( concat( \'' . $username .'\', \'@\', \'' . $password
>>>>> .'\'))';
>>>>>   
>>>> Second, another, more important reminder:
>>>>
>>>> >>> $username = '" OR 1 OR "';
>>>> ?>
>>>>
>>>> Since the first rows in a database are usually the default
>>>> administrator logins, the first to match what is basically a 'match if
>>>> this is a row' statement will be logged in.  The moral of the story:
>>>> don't forget to clean your input (which I'm sure ya'all were doing
>>>> but with top-posters, you never know ;-P).
>>>>
>>>> 
>>> prepared statements really do a pretty good job at neutering sql
>>> injection. But one shouldn't be lazy with input validation anyway.
>>>
>>>   
>> I have a couple of questions/comments re all this:
>>
>> 1. Doing the login and processing through https should add a bit more
>> security, it seems to me.
>> 
>
> It does add security between your user's web browser and the web
> server. It's up to you to keep it secure once you receive it.
>
>   
>> 2. Cleaning is another bloody headache, for me anyway. I have found that
>> almost every time I try to do some cleaning with trim and
>> mysql_real_escape_string and stripslashes wipes out my usernames and
>> passwords. I havent' been able to use them when doing the crypt and
>> encrypt stuff with salt. Without cleaning it works fine... so, I'm a bit
>> lost on this.
>> Specifically, this wipes out my login and password... (I know, this is
>> old code, but it is supposed to work, no? )
>> //Function to sanitize values received from the form. Prevents SQL injection
>>function clean($str) {
>>$str = @trim($str);
>>if(get_magic_quotes_gpc()) {
>>$str = stripslashes($str);
>>}
>>return mysql_real_escape_string($str);
>>}
>>
>>//Sanitize the POST values
>>$login = clean($_POST['login']);
>>$password = clean($_POST['password']);
>>
>> When I echoes the cleaned $login and $password, they looked like they
>> had just gone through an acid bath before being hit by katerina
>> (hurricane)... ;-) rather whitewashed and empty. There was nothing left
>> to work with.
>> 
>
> One thing to check - I'm pretty sure that mysql_real_escape_string
> will only work if you have an open connection to mysql,
It's always open... I think.. do you mean within the active script (the
one I'm working on) ? Yes. yes, it's open.
the user_name was just plain alphabet soup... no special characters...
the password, though, had some uppercase weirdos... like @$$
(backslashing doesn't seem to help)... oh, well :-\
>  because it
> uses that connection to figure out what character encoding 
Ohmygod not character encoding... it's such a mess for me. I try to
only use utf8 but theres so much confusion with that that I have stopped
thinking about it until a problem occurs... like in Firefox ... iget
emails with the Western encoding and the utf8 so I often have to
switch... and the prinouts don't follow either... lots of little black
diamonds... a reat pita.
> is being
> used so it can escape the string accordingly. (If unable to connect,
> it should raise an E_WARNING.)
>
> I'm not sure why you would need to use @ with trim(), but that shouldn't 
> matter.
>   
Frankly, I don't know either. I borrowed the code somewhere; but I
usually just 86 those @ts so I can see errors.
> Otherwise, nothing in there should mangle the input.
>   
mangle does as mangle can mangle... :-D
> Andrew
>
>   


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] Simple login form with cookies

2009-07-08 Thread PJ
Michael A. Peters wrote:
> Daniel Brown wrote:
>> First, a reminder to several (including some in this thread) that
>> top-posting is against the law here.
>>
>> On Wed, Jul 8, 2009 at 09:48, Martin Scotta
>> wrote:
>>> $sql = 'SELECT * FROM your-table WHERE username = \''. $username .'\'
>>> and passwd = md5( concat( \'' . $username .'\', \'@\', \'' . $password
>>> .'\'))';
>>
>> Second, another, more important reminder:
>>
>> > $username = '" OR 1 OR "';
>> ?>
>>
>> Since the first rows in a database are usually the default
>> administrator logins, the first to match what is basically a 'match if
>> this is a row' statement will be logged in.  The moral of the story:
>> don't forget to clean your input (which I'm sure ya'all were doing
>> but with top-posters, you never know ;-P).
>>
>
> prepared statements really do a pretty good job at neutering sql
> injection. But one shouldn't be lazy with input validation anyway.
>
I have a couple of questions/comments re all this:

1. Doing the login and processing through https should add a bit more
security, it seems to me.

2. Cleaning is another bloody headache, for me anyway. I have found that
almost every time I try to do some cleaning with trim and
mysql_real_escape_string and stripslashes wipes out my usernames and
passwords. I havent' been able to use them when doing the crypt and
encrypt stuff with salt. Without cleaning it works fine... so, I'm a bit
lost on this.
Specifically, this wipes out my login and password... (I know, this is
old code, but it is supposed to work, no? )
//Function to sanitize values received from the form. Prevents SQL injection
function clean($str) {
$str = @trim($str);
if(get_magic_quotes_gpc()) {
$str = stripslashes($str);
}
return mysql_real_escape_string($str);
}
   
//Sanitize the POST values
$login = clean($_POST['login']);
$password = clean($_POST['password']);

When I echoes the cleaned $login and $password, they looked like they
had just gone through an acid bath before being hit by katerina
(hurricane)... ;-) rather whitewashed and empty. There was nothing left
to work with.

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] Simple login form with cookies

2009-07-07 Thread PJ
PJ wrote:
> Jason Carson wrote:
>   
>>> On Mon, Jul 6, 2009 at 02:19, Jason Carson wrote:
>>> 
>>>   
>>>> ok, I have two sets of scripts here. One uses setcookie() for logging
>>>> into
>>>> the admin panel and the other uses session_start(). Both are working
>>>> fine,
>>>> is one more secure than the other?
>>>>   
>>>> 
>>> $_COOKIE data is written to a file that is readable/writeable and
>>> stored on the user's side of things.  $_SESSION data is written to the
>>> server, with a cookie stored on the user's side containing just the
>>> PHPSESSID (session ID) string to identify the session file on the
>>> server.
>>>
>>> So determining which is better and/or more secure is really a
>>> matter of the data held there and how it's handled.  If storing things
>>> like usernames or you absolutely want to store personal data in an
>>> active session, do so in $_SESSION.  If you're storing a password or
>>> credit card number in the active session, you may as well do it in
>>> $_COOKIE, because you're already using an insecure model.  ;-P
>>>
>>> --
>>> 
>>> daniel.br...@parasane.net || danbr...@php.net
>>> http://www.parasane.net/ || http://www.pilotpig.net/
>>> Check out our great hosting and dedicated server deals at
>>> http://twitter.com/pilotpig
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>> 
>>>   
>> Well I'm a newbie when it comes to PHP and programming. I guess I need to
>> read up on login security. Do you know of, or recommend, any websites that
>> will show me how to secure my login model (Using cookies or sessions).
>>
>>   
>> 
> Hi Jason,
> I'm probably not any wiser than you, but I have just (today) discovered
> an interesting site that seems to have some really clear explanations
> and tutorials re php, MySsql et al.
> It's worth looking at (I'm trying to implement something like what you
> are, as well):
> http://www.brainbell.com/tutors/php/php_mysql/Authorizing_User_Access.html
> HTH,
> PJ
>
>   
I just found another site which is easier to deal with (chapter
references) and seems to be the original source of the brainbell site:
http://home.bolink.org/ebooks/webP/webdb/index.htm

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] Simple login form with cookies

2009-07-06 Thread PJ
Jason Carson wrote:
>> On Mon, Jul 6, 2009 at 02:19, Jason Carson wrote:
>> 
>>> ok, I have two sets of scripts here. One uses setcookie() for logging
>>> into
>>> the admin panel and the other uses session_start(). Both are working
>>> fine,
>>> is one more secure than the other?
>>>   
>> $_COOKIE data is written to a file that is readable/writeable and
>> stored on the user's side of things.  $_SESSION data is written to the
>> server, with a cookie stored on the user's side containing just the
>> PHPSESSID (session ID) string to identify the session file on the
>> server.
>>
>> So determining which is better and/or more secure is really a
>> matter of the data held there and how it's handled.  If storing things
>> like usernames or you absolutely want to store personal data in an
>> active session, do so in $_SESSION.  If you're storing a password or
>> credit card number in the active session, you may as well do it in
>> $_COOKIE, because you're already using an insecure model.  ;-P
>>
>> --
>> 
>> daniel.br...@parasane.net || danbr...@php.net
>> http://www.parasane.net/ || http://www.pilotpig.net/
>> Check out our great hosting and dedicated server deals at
>> http://twitter.com/pilotpig
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>> 
> Well I'm a newbie when it comes to PHP and programming. I guess I need to
> read up on login security. Do you know of, or recommend, any websites that
> will show me how to secure my login model (Using cookies or sessions).
>
>   
Hi Jason,
I'm probably not any wiser than you, but I have just (today) discovered
an interesting site that seems to have some really clear explanations
and tutorials re php, MySsql et al.
It's worth looking at (I'm trying to implement something like what you
are, as well):
http://www.brainbell.com/tutors/php/php_mysql/Authorizing_User_Access.html
HTH,
PJ

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] exasperated again

2009-07-04 Thread PJ
Stuart wrote:
> 2009/7/4 PJ :
>   
>> Ashley Sheridan wrote:
>> 
>>> On Sat, 2009-07-04 at 10:47 -0400, PJ wrote:
>>>
>>>   
>>>> Jim Lucas wrote:
>>>>
>>>> 
>>>>> PJ wrote:
>>>>>
>>>>>   
>>>>>> Could somebody please explain to me what is wrong with this code?
>>>>>> In my script it works, returns the correct id, but when I try it in a
>>>>>> test pages, nothing in the world gets it to work. This is rather
>>>>>> frustrating, again:
>>>>>> THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT.
>>>>>> $sql = "SELECT id FROM publishers
>>>>>> WHERE publisher = 'whoever'";
>>>>>>   $result = mysql_query($sql,$db);
>>>>>> $row = mysql_fetch_assoc($result);   if
>>>>>> (mysql_num_rows($result) !== 0) {
>>>>>>   $pub = $row['id'];
>>>>>> Syntax is ok, echo "hello"; works.
>>>>>>
>>>>>>
>>>>>> This works in the test page:
>>>>>> $aid = array();
>>>>>> $ord = array();
>>>>>> $sql = "SELECT authID, ordinal
>>>>>> FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC";
>>>>>> $result = mysql_query($sql, $db); //$row =
>>>>>> mysql_fetch_assoc($result);
>>>>>> while ( $row = mysql_fetch_assoc($result) ) {
>>>>>> $aid[]=$row['authID'];
>>>>>> $ord[]=$row['ordinal'];
>>>>>> }
>>>>>> var_dump($aid);
>>>>>> echo "";
>>>>>> var_dump($ord);
>>>>>> echo $aid[0], " - ";
>>>>>> echo $ord[0];
>>>>>>
>>>>>> This does not:
>>>>>> $fi="joe"; $la="joe";
>>>>>> $sql = "SELECT id FROM author
>>>>>> WHERE first_name = '$fi' && last_name = '$la'";
>>>>>> $result = msql_query($sql, $db);
>>>>>> $row = mysql_fetch_assoc($result);
>>>>>> $count=mysql_num_rows($result);
>>>>>> echo $count;
>>>>>>   if (mysql_num_rows($result) > 0) {
>>>>>>   $a_id=$row['id'];
>>>>>>   }
>>>>>>   echo $a_id, "";
>>>>>> The test page prints out echo "some text"; but no results when the
>>>>>> results are there
>>>>>> Tell me I have missed something simple here, or is this normal for php ?
>>>>>> I have checked the queries on Mysql command line and they are fine.
>>>>>> I have verified the syntax and Netbeans tells me it is fine.
>>>>>> Same results Firefox3 (2 machines) & IE 8.
>>>>>> What is not fine?
>>>>>>
>>>>>>
>>>>>> 
>>>>> I was preaching this to you months ago.  You should have error
>>>>> reporting turned on in a development area.
>>>>>
>>>>> by that I mean php should be set to display_errors = on and
>>>>> error_reporting = E_ALL
>>>>>
>>>>> Give this a try in a development area and "you will see the errors of
>>>>> your ways..."
>>>>>
>>>>>
>>>>>   
>>>> The error reporting is always on as you suggested and I use it all the 
>>>> time.
>>>> But error reporting cannot report a non-existing error - a human stupid
>>>> error that I finally caught - msql instead of mysql... oh. well... :-(
>>>>
>>>> --
>>>> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
>>>> -
>>>> Phil Jourdan --- p...@ptahhotep.com
>>>>http://www.ptahhotep.com
>>>>http://www.chiccantine.com/andypantry.php
>>>>
>>>>
>>>>
>>>> 
>>> Actually, if you had error reporting on, it should have at least picked
>>> that up as a function that was not defined. You do mention you get a lot
>>> of white pages instead of errors, which suggests that either you do not
>>> have errors turned on, or you are turning them on from within PHP,
>>>   
>> What do you mean "from within PHP" ?
>> Isn't this enough in the script?
>> error_reporting(E_ALL);
>> ini_set('display_errors', 1);
>> 
>
> As Ash points out that will not display errors in the code syntax
> since they prevent any of your script from being executed. You're
> better off setting these values in php.ini.
>
> -Stuart
>
>   
But not on a productions server, right? (Since this should have been
corrected before "going live")

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] exasperated again

2009-07-04 Thread PJ
Stuart wrote:
> 2009/7/4 PJ :
>   
>> Ashley Sheridan wrote:
>> 
>>> On Sat, 2009-07-04 at 10:47 -0400, PJ wrote:
>>>
>>>   
>>>> Jim Lucas wrote:
>>>>
>>>> 
>>>>> PJ wrote:
>>>>>
>>>>>   
>>>>>> Could somebody please explain to me what is wrong with this code?
>>>>>> In my script it works, returns the correct id, but when I try it in a
>>>>>> test pages, nothing in the world gets it to work. This is rather
>>>>>> frustrating, again:
>>>>>> THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT.
>>>>>> $sql = "SELECT id FROM publishers
>>>>>> WHERE publisher = 'whoever'";
>>>>>>   $result = mysql_query($sql,$db);
>>>>>> $row = mysql_fetch_assoc($result);   if
>>>>>> (mysql_num_rows($result) !== 0) {
>>>>>>   $pub = $row['id'];
>>>>>> Syntax is ok, echo "hello"; works.
>>>>>>
>>>>>>
>>>>>> This works in the test page:
>>>>>> $aid = array();
>>>>>> $ord = array();
>>>>>> $sql = "SELECT authID, ordinal
>>>>>> FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC";
>>>>>> $result = mysql_query($sql, $db); //$row =
>>>>>> mysql_fetch_assoc($result);
>>>>>> while ( $row = mysql_fetch_assoc($result) ) {
>>>>>> $aid[]=$row['authID'];
>>>>>> $ord[]=$row['ordinal'];
>>>>>> }
>>>>>> var_dump($aid);
>>>>>> echo "";
>>>>>> var_dump($ord);
>>>>>> echo $aid[0], " - ";
>>>>>> echo $ord[0];
>>>>>>
>>>>>> This does not:
>>>>>> $fi="joe"; $la="joe";
>>>>>> $sql = "SELECT id FROM author
>>>>>> WHERE first_name = '$fi' && last_name = '$la'";
>>>>>> $result = msql_query($sql, $db);
>>>>>> $row = mysql_fetch_assoc($result);
>>>>>> $count=mysql_num_rows($result);
>>>>>> echo $count;
>>>>>>   if (mysql_num_rows($result) > 0) {
>>>>>>   $a_id=$row['id'];
>>>>>>   }
>>>>>>   echo $a_id, "";
>>>>>> The test page prints out echo "some text"; but no results when the
>>>>>> results are there
>>>>>> Tell me I have missed something simple here, or is this normal for php ?
>>>>>> I have checked the queries on Mysql command line and they are fine.
>>>>>> I have verified the syntax and Netbeans tells me it is fine.
>>>>>> Same results Firefox3 (2 machines) & IE 8.
>>>>>> What is not fine?
>>>>>>
>>>>>>
>>>>>> 
>>>>> I was preaching this to you months ago.  You should have error
>>>>> reporting turned on in a development area.
>>>>>
>>>>> by that I mean php should be set to display_errors = on and
>>>>> error_reporting = E_ALL
>>>>>
>>>>> Give this a try in a development area and "you will see the errors of
>>>>> your ways..."
>>>>>
>>>>>
>>>>>   
>>>> The error reporting is always on as you suggested and I use it all the 
>>>> time.
>>>> But error reporting cannot report a non-existing error - a human stupid
>>>> error that I finally caught - msql instead of mysql... oh. well... :-(
>>>>
>>>> --
>>>> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
>>>> -
>>>> Phil Jourdan --- p...@ptahhotep.com
>>>>http://www.ptahhotep.com
>>>>http://www.chiccantine.com/andypantry.php
>>>>
>>>>
>>>>
>>>> 
>>> Actually, if you had error reporting on, it should have at least picked
>>> that up as a function that was not defined. You do mention you get a lot
>>> of white pages instead of errors, which suggests that either you do not
>>> have errors turned on, or you are turning them on from within PHP,
>>>   
>> What do you mean "from within PHP" ?
>> Isn't this enough in the script?
>> error_reporting(E_ALL);
>> ini_set('display_errors', 1);
>> 
>
> As Ash points out that will not display errors in the code syntax
> since they prevent any of your script from being executed. You're
> better off setting these values in php.ini.
>
> -Stuart
>
>   
Talk about exasperation:

I just tried to find www.mangequebec.com on Guggle (!)
Somebody tell me why on another computer going through the same
connection to the internet finds and goes to that site. I have no reason
to block that site as I never knew it existed. Yet, no matter how I
input the name "mange quebec", "mangeQuebec", with or without the
wwwcom or even .ca on FF3 and same results on IE8
this really sucks...

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] exasperated again

2009-07-04 Thread PJ
Ashley Sheridan wrote:
> On Sat, 2009-07-04 at 10:47 -0400, PJ wrote:
>   
>> Jim Lucas wrote:
>> 
>>> PJ wrote:
>>>   
>>>> Could somebody please explain to me what is wrong with this code?
>>>> In my script it works, returns the correct id, but when I try it in a
>>>> test pages, nothing in the world gets it to work. This is rather
>>>> frustrating, again:
>>>> THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT.
>>>> $sql = "SELECT id FROM publishers
>>>> WHERE publisher = 'whoever'";
>>>>   $result = mysql_query($sql,$db);
>>>> $row = mysql_fetch_assoc($result);   if
>>>> (mysql_num_rows($result) !== 0) {
>>>>   $pub = $row['id'];
>>>> Syntax is ok, echo "hello"; works.
>>>>
>>>>
>>>> This works in the test page:
>>>> $aid = array();
>>>> $ord = array();
>>>> $sql = "SELECT authID, ordinal
>>>> FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC";
>>>> $result = mysql_query($sql, $db); //$row =
>>>> mysql_fetch_assoc($result);
>>>> while ( $row = mysql_fetch_assoc($result) ) {
>>>> $aid[]=$row['authID'];
>>>> $ord[]=$row['ordinal'];
>>>> }
>>>> var_dump($aid);
>>>> echo "";
>>>> var_dump($ord);
>>>> echo $aid[0], " - ";
>>>> echo $ord[0];
>>>>
>>>> This does not:
>>>> $fi="joe"; $la="joe";
>>>> $sql = "SELECT id FROM author
>>>> WHERE first_name = '$fi' && last_name = '$la'";
>>>> $result = msql_query($sql, $db);
>>>> $row = mysql_fetch_assoc($result);
>>>> $count=mysql_num_rows($result);
>>>> echo $count;
>>>>   if (mysql_num_rows($result) > 0) {
>>>>   $a_id=$row['id'];
>>>>   }
>>>>   echo $a_id, "";
>>>> The test page prints out echo "some text"; but no results when the
>>>> results are there
>>>> Tell me I have missed something simple here, or is this normal for php ?
>>>> I have checked the queries on Mysql command line and they are fine.
>>>> I have verified the syntax and Netbeans tells me it is fine.
>>>> Same results Firefox3 (2 machines) & IE 8.
>>>> What is not fine?
>>>>
>>>> 
>>> I was preaching this to you months ago.  You should have error
>>> reporting turned on in a development area.
>>>
>>> by that I mean php should be set to display_errors = on and
>>> error_reporting = E_ALL
>>>
>>> Give this a try in a development area and "you will see the errors of
>>> your ways..."
>>>
>>>   
>> The error reporting is always on as you suggested and I use it all the time.
>> But error reporting cannot report a non-existing error - a human stupid
>> error that I finally caught - msql instead of mysql... oh. well... :-(
>>
>> -- 
>> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
>> -
>> Phil Jourdan --- p...@ptahhotep.com
>>http://www.ptahhotep.com
>>http://www.chiccantine.com/andypantry.php
>>
>>
>> 
> Actually, if you had error reporting on, it should have at least picked
> that up as a function that was not defined. You do mention you get a lot
> of white pages instead of errors, which suggests that either you do not
> have errors turned on, or you are turning them on from within PHP,
What do you mean "from within PHP" ?
Isn't this enough in the script?
error_reporting(E_ALL);
ini_set('display_errors', 1);
>  which
> can sometimes fail if there are fatal errors in the code.
>
> Thanks
> Ash
> www.ashleysheridan.co.uk
>
>
>   


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] exasperated again

2009-07-04 Thread PJ
Jim Lucas wrote:
> PJ wrote:
>> Could somebody please explain to me what is wrong with this code?
>> In my script it works, returns the correct id, but when I try it in a
>> test pages, nothing in the world gets it to work. This is rather
>> frustrating, again:
>> THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT.
>> $sql = "SELECT id FROM publishers
>> WHERE publisher = 'whoever'";
>>   $result = mysql_query($sql,$db);
>> $row = mysql_fetch_assoc($result);   if
>> (mysql_num_rows($result) !== 0) {
>>   $pub = $row['id'];
>> Syntax is ok, echo "hello"; works.
>>
>>
>> This works in the test page:
>> $aid = array();
>> $ord = array();
>> $sql = "SELECT authID, ordinal
>> FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC";
>> $result = mysql_query($sql, $db); //$row =
>> mysql_fetch_assoc($result);
>> while ( $row = mysql_fetch_assoc($result) ) {
>> $aid[]=$row['authID'];
>> $ord[]=$row['ordinal'];
>> }
>> var_dump($aid);
>> echo "";
>> var_dump($ord);
>> echo $aid[0], " - ";
>> echo $ord[0];
>>
>> This does not:
>> $fi="joe"; $la="joe";
>> $sql = "SELECT id FROM author
>> WHERE first_name = '$fi' && last_name = '$la'";
>> $result = msql_query($sql, $db);
>> $row = mysql_fetch_assoc($result);
>> $count=mysql_num_rows($result);
>> echo $count;
>>   if (mysql_num_rows($result) > 0) {
>>   $a_id=$row['id'];
>>   }
>>   echo $a_id, "";
>> The test page prints out echo "some text"; but no results when the
>> results are there
>> Tell me I have missed something simple here, or is this normal for php ?
>> I have checked the queries on Mysql command line and they are fine.
>> I have verified the syntax and Netbeans tells me it is fine.
>> Same results Firefox3 (2 machines) & IE 8.
>> What is not fine?
>>
>
> I was preaching this to you months ago.  You should have error
> reporting turned on in a development area.
>
> by that I mean php should be set to display_errors = on and
> error_reporting = E_ALL
>
> Give this a try in a development area and "you will see the errors of
> your ways..."
>
The error reporting is always on as you suggested and I use it all the time.
But error reporting cannot report a non-existing error - a human stupid
error that I finally caught - msql instead of mysql... oh. well... :-(

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] exasperated again - shot in the foot

2009-06-30 Thread PJ
Jay Blanchard wrote:
> [snip]
> Use the OOP interface to mysqli or PDO and these problems don't happen
> [/snip]
>
> Either that or include a modicum of error checking in your code. 
>
>   
OK, Ok, I feel stupid enough already.
I'm not sure I want to get in that deep... it's tough enough with the
simple stuff...
so, talk to me about the OOP interface or the PDO... :-\

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] exasperated again - shot in the foot

2009-06-30 Thread PJ
PJ wrote:
> Could somebody please explain to me what is wrong with this code?
> In my script it works, returns the correct id, but when I try it in a
> test pages, nothing in the world gets it to work. This is rather
> frustrating, again:
> THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT.
> $sql = "SELECT id FROM publishers
> WHERE publisher = 'whoever'";
>   $result = mysql_query($sql,$db);
> $row = mysql_fetch_assoc($result); 
>   if (mysql_num_rows($result) !== 0) {
>   $pub = $row['id'];
> Syntax is ok, echo "hello"; works.
>
>
> This works in the test page:
> $aid = array();
> $ord = array();
> $sql = "SELECT authID, ordinal
> FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC";
> $result = mysql_query($sql, $db); 
> //$row = mysql_fetch_assoc($result);
> while ( $row = mysql_fetch_assoc($result) ) {
> $aid[]=$row['authID'];
> $ord[]=$row['ordinal'];
> }
> var_dump($aid);
> echo "";
> var_dump($ord);
> echo $aid[0], " - ";
> echo $ord[0];
>
> This does not:
> $fi="joe"; $la="joe";
> $sql = "SELECT id FROM author
> WHERE first_name = '$fi' && last_name = '$la'";
> $result = msql_query($sql, $db);
> $row = mysql_fetch_assoc($result);
> $count=mysql_num_rows($result);
> echo $count;
>   if (mysql_num_rows($result) > 0) {
>   $a_id=$row['id'];
>   }
>   echo $a_id, "";
> The test page prints out echo "some text"; but no results when the
> results are there
> Tell me I have missed something simple here, or is this normal for php ?
> I have checked the queries on Mysql command line and they are fine.
> I have verified the syntax and Netbeans tells me it is fine.
> Same results Firefox3 (2 machines) & IE 8.
> What is not fine?
>
>   
Damn, it's frustrating to find that there is a difference between msql
and mysql... ouch, the foot hurts now!

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



[PHP] exasperated again

2009-06-30 Thread PJ
Could somebody please explain to me what is wrong with this code?
In my script it works, returns the correct id, but when I try it in a
test pages, nothing in the world gets it to work. This is rather
frustrating, again:
THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT.
$sql = "SELECT id FROM publishers
WHERE publisher = 'whoever'";
  $result = mysql_query($sql,$db);
$row = mysql_fetch_assoc($result); 
  if (mysql_num_rows($result) !== 0) {
  $pub = $row['id'];
Syntax is ok, echo "hello"; works.


This works in the test page:
$aid = array();
$ord = array();
$sql = "SELECT authID, ordinal
FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC";
$result = mysql_query($sql, $db); 
//$row = mysql_fetch_assoc($result);
while ( $row = mysql_fetch_assoc($result) ) {
$aid[]=$row['authID'];
$ord[]=$row['ordinal'];
}
var_dump($aid);
echo "";
var_dump($ord);
echo $aid[0], " - ";
echo $ord[0];

This does not:
$fi="joe"; $la="joe";
$sql = "SELECT id FROM author
WHERE first_name = '$fi' && last_name = '$la'";
$result = msql_query($sql, $db);
$row = mysql_fetch_assoc($result);
$count=mysql_num_rows($result);
echo $count;
  if (mysql_num_rows($result) > 0) {
  $a_id=$row['id'];
  }
  echo $a_id, "";
The test page prints out echo "some text"; but no results when the
results are there
Tell me I have missed something simple here, or is this normal for php ?
I have checked the queries on Mysql command line and they are fine.
I have verified the syntax and Netbeans tells me it is fine.
Same results Firefox3 (2 machines) & IE 8.
What is not fine?

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



[PHP] idiot proofing

2009-06-24 Thread PJ
I have a bit of a situation.
I have set up addBooks, editBooks and deleteBooks pages. Before
complicating my life & mixing them up in one file, I am running tests.
I'd like to make them idiot proof, up to a point.
When the page is submitted and the code is parsed, the form inputs
remain on the screen along with the submit buttons.
I'm not sure of what is the normal way of closing/hiding/wiping the
screen output before showing the result output of the operation.
I do not want a user to resubmit the input which is still in the input
$strings.
I am wondering if I should be using some code to clear the inputs like
unsetting??? sessions or a break or am I doing something wrong with the
flow of the code?
I'd like to leave the pages with only the output of success (or failure)
and links to do another add/edit/delete operation.
Thanks for any suggestions.

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] supplied argument errors

2009-06-23 Thread PJ
Lex Braun wrote:
>
>
> On Tue, Jun 23, 2009 at 4:10 PM, PJ  <mailto:af.gour...@videotron.ca>> wrote:
>
> I think there is something I do not understand in the manual about
> mysql_fetch_assoc(), mysql_affected_rows()
> The code works, but I get these annoying messages.
> snippet:
>
> 
> What are the warnings?
1 .supplied argument is not a valid MySQL result resource
2. supplied argument is not a valid MySQL-link resource

snippet:
$result = mysql_query($sql, $db); // this is following an UPDATE
  $row = mysql_fetch_assoc($result); // warning... 1.
  if (mysql_affected_rows($result) !== -1) //warning...2.
print_r($result); // returns 1

another:
 $sql = "DELETE FROM book_categories WHERE bookID = $bid";
$result = mysql_query($sql, $db); // warning...1.
  $row = mysql_fetch_assoc($result); // warning...1.
if (mysql_num_rows($result) !== 0) {
the last:
  $result = mysql_query($sql,$db); // following an INSERT
if (mysql_affected_rows($result) == -1) {  // warning2.



-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



[PHP] delete & insert ?

2009-06-23 Thread PJ
I just had a bright idea ???
Am doing editing file for book entries; it occurs to me (now that I am
practically finished) that it might be much simpler to delete entries
and just insert rather than going through the rigamarole of checking if
the new entries exist and if and if and if... just delete & insert -
less code, less headaches... or is this a cute fantasy & I should get
myself locked up?
Guys, don't go overboard on this... I know I'm leaving myself wide open :-P

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



[PHP] supplied argument errors

2009-06-23 Thread PJ
I think there is something I do not understand in the manual about
mysql_fetch_assoc(), mysql_affected_rows()
The code works, but I get these annoying messages.
snippet:
$result = mysql_query($sql, $db); // this is following an UPDATE
  $row = mysql_fetch_assoc($result); // warning...
  if (mysql_affected_rows($result) !== -1) //warning...
print_r($result); // returns 1

another:
 $sql = "DELETE FROM book_categories WHERE bookID = $bid";
$result = mysql_query($sql, $db); // warning...
  $row = mysql_fetch_assoc($result); // warning...
if (mysql_num_rows($result) !== 0) {
the last:
  $result = mysql_query($sql,$db); // following an INSERT
if (mysql_affected_rows($result) == -1) {  // warning

I have read the manual entries but I think I could use some
clarification/explanation.
TIA

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] resubmit form after validation error

2009-06-23 Thread PJ
Shawn McKenzie wrote:
> PJ wrote:
>   
>> Caner Bulut wrote:
>> 
>>> Hi PJ,
>>>
>>> You can use the structure following
>>>
>>> $bid = htmlentities($_GET['id']);
>>>
>>>   
>> the code below
>> 
>>> if(empty($bid) {
>>> $bid=0;
>>> }
>>>   
>> produces an empty screen with no error messages...
>> I have been having some trouble understanding "empty()" -- it doesn't
>> seem to want to work for me in any situation
>> 
>
> YOU, always need to have error_reporting on and display errors on, and
> also be logging errors so that you can see parse errors in the log.
> Always check the log after a "empty screen".  I've seen many posts from
> you where you get a blank, empty, white screen.  This is most always a
> parse error!.  Get an editor that will show you bad syntax like the
> above.  It is a freaking parse error because you don't have matched
> parentheses!
>
>   
Shawn, I always have error_reporting on and display errors on.
Ok, I didn't see the error above; but in my defense (no defense really),
I should have thought about it) i just copied the code I was given.
Dumb, dumb, dumb. Thanks for pointing it out.
And yes, I do have a lot of problems with curly braces & parentheses.
I eventually do find them... but...
I have been thinking about what editor would show me bad syntax...
I've been using HOMESITE+ for no other reason than that it allows me to
switch between files quickly ... I do have Netbeans, but it screwed me
once when I accidentally closed it and I lost the whole file and had to
redo it all, so I'm a bit wary...
And I'm not too keen on getting into some IDE... tried them and found
them cumbersome to set up & learn.
Any suggestions?

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] resubmit form after validation error

2009-06-23 Thread PJ
Caner Bulut wrote:
> Hi PJ,
>
> You can use the structure following
>
> $bid = htmlentities($_GET['id']);
>
the code below
> if(empty($bid) {
> $bid=0;
> }
produces an empty screen with no error messages...
I have been having some trouble understanding "empty()" -- it doesn't
seem to want to work for me in any situation

Anyway, I seem to have it all working, pretty much. Still testing...
I think the problem had to do with either sessions, or setting the right
parameters for the submit option or using action="" -- the latter seems to work ok. Although, it is
interesting that it is possible to use another file for the action - but
that seems a bit redundant as you have to populate that file with almost
the same stuff that is in the original form file...
I'm making progress, but I don't think I'm learning a lot other than to
contain my frustration. ;-)
>
>
> if(is_numeric($bid)) {
>
> if($bid==0) {
> do something
> } else if($bid==1) {
> do something
> }
>
> }
>
> After this code there will always a number, If the id variable is 0, bid
> will be 0 and you can control it.
>
> Thanks.
> Caner.
>
> 2009/6/22 PJ 
>
>> Hi Caner,
>> Thanks for the input. I'm not sure that would do it as the first
>> instruction on the page is :
>> $bid = $_GET['id'] ;
>>
>> thus, the page cannot even be loaded if there is no id in the uri - it
>> generates a number of errors.
>> In order to use the feature of editing, I use a search page and then set
>> up an href to the edit page with the id of the item to be edited.
>> I finally figured out to do the action="another_page.php" and with
>> slight modifications to the form, things finally work.
>> And, to delete the item (all records related to the item), I set up 2
>> submits - 1 to "update.php" and one to "delete.php"
>> Maybe it's all cumbersome and maybe it is possible to streamline the
>> whole process, but then it does work and I am just learning... :-)
>> Thanks again.
>> PJ
>>
>>
>>
>> Caner BULUT wrote:
>>> Hi,
>>>
>>> You can use a variable to that. Like following. Example if the variable
>> is 1
>>> you start to processing form input.
>>>
>>> Example
>>>
>>> >> }
>>>
>>> Thanks.
>>> Caner.
>>>
>>>
>>> -Original Message-
>>> From: PJ [mailto:af.gour...@videotron.ca]
>>> Sent: 20 June 2009 22:55
>>> To: php-general@lists.php.net
>>> Subject: [PHP] resubmit form after validation error
>>>
>>> I'm having a bit of a time figuring out how to resubmit a form after
>>> obligatory field missing error.
>>> The problem is that the page is accessed from a search page href where
>>> the uri is like = file.php$=123.
>>> Since the method="post" action="file.php?= does
>>> not work nor does PHP_SELF, I have set the action="otherfile.php". All
>>> is well, if all fields are properly entered, but if there is an error,
>>> how to resubmit the form for correction and resubmission without using
>>> js or functions or redoing it all from scratch?
>>>
>>>
>>
>> --
>> Herv� Kempf: "Pour sauver la plan�te, sortez du capitalisme."
>> -
>> Phil Jourdan --- p...@ptahhotep.com
>> http://www.ptahhotep.com
>> http://www.chiccantine.com/andypantry.php
>>
>>
>


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
http://www.ptahhotep.com
http://www.chiccantine.com/andypantry.php

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



Re: [PHP] resubmit form after validation error

2009-06-22 Thread PJ
Hi Caner,
Thanks for the input. I'm not sure that would do it as the first
instruction on the page is :
$bid = $_GET['id'] ;

thus, the page cannot even be loaded if there is no id in the uri - it
generates a number of errors.
In order to use the feature of editing, I use a search page and then set
up an href to the edit page with the id of the item to be edited.
I finally figured out to do the action="another_page.php" and with
slight modifications to the form, things finally work.
And, to delete the item (all records related to the item), I set up 2
submits - 1 to "update.php" and one to "delete.php"
Maybe it's all cumbersome and maybe it is possible to streamline the
whole process, but then it does work and I am just learning... :-)
Thanks again.
PJ



Caner BULUT wrote:
> Hi,
>
> You can use a variable to that. Like following. Example if the variable is 1
> you start to processing form input.
>
> Example 
>
>  }
>
> Thanks.
> Caner.
>
>
> -Original Message-
> From: PJ [mailto:af.gour...@videotron.ca] 
> Sent: 20 June 2009 22:55
> To: php-general@lists.php.net
> Subject: [PHP] resubmit form after validation error
>
> I'm having a bit of a time figuring out how to resubmit a form after
> obligatory field missing error.
> The problem is that the page is accessed from a search page href where
> the uri is like = file.php$=123.
> Since the method="post" action="file.php?= does
> not work nor does PHP_SELF, I have set the action="otherfile.php". All
> is well, if all fields are properly entered, but if there is an error,
> how to resubmit the form for correction and resubmission without using
> js or functions or redoing it all from scratch?
>
>   


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



[PHP] resubmit form after validation error

2009-06-20 Thread PJ
I'm having a bit of a time figuring out how to resubmit a form after
obligatory field missing error.
The problem is that the page is accessed from a search page href where
the uri is like = file.php$=123.
Since the method="post" action="file.php?= does
not work nor does PHP_SELF, I have set the action="otherfile.php". All
is well, if all fields are properly entered, but if there is an error,
how to resubmit the form for correction and resubmission without using
js or functions or redoing it all from scratch?

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



[PHP] sessions tutorial

2009-06-18 Thread PJ
Top of the list is for real dummies at tizag.com.
So I don't have to search 282,000 entries for php sessions tutorial
(doesn't this say something about the stupidity on the internet - just
how many of those entries could possibly be real and worth looking at?
Since you "gurus" (I kowtow) have been there, done that, I would
appreciate hearing of a tutorial that will give something more than "you
can use sessions in to store information"; like what kind of
information, just how is it used e.g. whatis this, where did it come
from, what does it mean? -- if (isset($_REQUEST["ReturnToBooksList"]))
and  if (!isset($_SESSION["addNewBooks"])) - in these examples it come
from inputs. They were not specifically declared or is this a
declaration by itself... how can I find this information so I can
understand how to use it?
I really don't want to bother you guys but do you see the futility here?
My little programs are advancing little by little, but boy is it a
struggle to get any information. I eventually dig it out but, frankly,
it might be more productive digging salt mines in the Urals. :-(
PJ "the bitcher"

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



[PHP] edit db fields

2009-06-18 Thread PJ
How to deal with pre-selected input fields.
To edit db fields in a table, I have a page that is basically the same
as an insert page to create entries in the db.
The table displays all the entries for a particular book that is
selected from a search page. From the search page results a link leads
to the edit page throught the page id (...edit.php?id=2435, for example) .
Here we already have a problem because the form action to PHP_SELF
cannot work; so there has to be some adjustment, like incorporating the
edit page into the search page.
Next, it should be possible to change the inputs, but how? I think the
use of sessions may prevent this - not sure - at present I get an
undefined variable error for categoriesIN. The categories are generated
dynamically from the db, but this does not work on the insert page
either... they must be hard coded (at least I don't know how else to fix
that). But if hard coded, then some code has to used to make the
selected entries (about 35 categories). And then, how to change them if
so needed?
Anybody have some suggestions where to look for a model?
It doesn't seem like a terribly difficult project, if you're pretty
proficient at this.
I have had some interesting suggestions; but it is difficult enough to
just learn php/mysql and then to learn other platforms like smarty (??)
seems rather challenging, to say the least.
Apprediate any input.


Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
http://www.ptahhotep.com
http://www.chiccantine.com/andypantry.php

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



Re: [PHP] aesthetic beauty in conception, execution

2009-06-18 Thread PJ
Robert Cummings wrote:
> PJ wrote:
>> Robert Cummings wrote:
>>> PJ wrote:
>>>> I just thought I would share a revelation.
>>>> Someone just pointed me to a site that IMHO is superb for elegance of
>>>> artistic design and programming.
>>>> I was blown away.
>>>> http://www.apfq.ca
>>>> You won't regret it. 8-)
>>> Can I have my 5 minutes back please? It's about as simplistic a site
>>> as it gets. If simple is elegant sure, you're sort of right, but
>>> artistic design seemed awfully lacking.
>>>
>>> Cheers,
>>> Rob.
>> Well, it depends by what you mean by simplistic and if you're looking
>> for cluttered crap that one finds all over the place, yeah, it's simple
>> - but certainly not simplistic.
>> It has a purpose that is met, it gets to the point, it focuses your
>> attention, it gives information and is pleasing to the eye.  What more
>> could you want?
>
> My 5 minutes back >:)
>
>> American movies, for the most part and what goes with them, are
>> pollution of the senses. My take, of course. ;-) :-P
>
> I'm Canadian as are you.
No, I'm not... :-P  I'm Martian... but this is a nicer place to hideout...
> But I'm no minimalist.
H... I just believe in efficiency, if at all possible... I don't
think I'm succeeding too well at that in php :-(
god, you should see the code...

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] populate form input option dropdown box from existing data

2009-06-18 Thread PJ
Stuart wrote:
> 2009/6/18 PJ :
>   
>> Martin Scotta wrote:
>> 
>>> It is a sintax error
>>>
>>> if (in_array($ex, $selected)   <--- missing )
>>> echo "yes";
>>> else echo "no";
>>>
>>> On Thu, Jun 18, 2009 at 10:13 AM, PJ >> <mailto:af.gour...@videotron.ca>> wrote:
>>>
>>> Ford, Mike wrote:
>>> > On 17 June 2009 14:30, PJ advised:
>>> >
>>> >
>>> >
>>> >> For the moment, I am trying to resolve the problem of
>>> >> extracting a value
>>> >> from a string returned by a query. I thought that in_array()
>>> would do
>>> >> it, but the tests I have run on it are 100% negative. The only
>>> thing I
>>> >> have not used in the tests is third parameter bool $strict
>>> which only
>>> >> affects case-sensitivity if the $needle is a string.
>>> >>
>>> >
>>> > $strict has nothing whatsoever at all in any way to do with case
>>> > sensitivity -- $strict controls whether the values are compared
>>> using
>>> > equality (==) or identity (===) tests. As is stated quite
>>> clearly on the
>>> > manual page, in_array() is always case-sensitive.
>>> >
>>> >
>>> >>  This leads me to
>>> >> believe that in_array() is either inappropriately defined in
>>> >> the manual
>>> >> and not effective on associative arrays
>>> >>
>>> >
>>> > Complete rubbish -- the in_array() manual page is excellent and
>>> totally
>>> > accurate, complete with 3 working examples.
>>> >
>>> >
>>> I would really like to understand why my attempts to reproduce the
>>> first
>>> example just did not work.
>>> Note also that the examples do not show in_array($string, $array)
>>> My array was Array ([0]=>6[1]=>14), so when I tried if
>>> (in_array($string, $array) , echo $string did not return 14 as I had
>>> expected; neither did if(in_array("14", $array) ... nor
>>> if(in_array(14,
>>> $array). It still does not... actually, the screen goes blank.
>>> So, what am I doing wrong?
>>> Here's what is not working... I'm trying to reproduce the example from
>>> php.net <http://php.net>:
>>>
>>> $selected = array();
>>> if ( ( $results = mysql_query($sql, $db) ) ) {
>>>  while ( $row = mysql_fetch_assoc($results) ) {
>>>$selected[] = $row['id'];
>>>}
>>>  }
>>> print_r($selected);
>>> $ex = 14;
>>> if (in_array($ex, $selected)
>>> echo "yes";
>>> else echo "no";
>>>
>>> Regardless if I put 14 into $ex or "14" or '14' or even if I put
>>> the 14
>>> instead of the $ex into the if line, I get a blank screen. It seems tp
>>> me, from what I see in the manual that this should work... or am I
>>> supposed to know something that is not clear in the examples... ?
>>>
>>>
>>> --
>>> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
>>> -
>>> Phil Jourdan --- p...@ptahhotep.com <mailto:p...@ptahhotep.com>
>>>   http://www.ptahhotep.com
>>>   http://www.chiccantine.com/andypantry.php
>>>
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>>
>>>
>>> --
>>> Martin Scotta
>>>   
>> Actually, we have to call it a typo because i fixed that and the results
>> are exactly the same = blank screen. :-(
>> 
>
> If you're getting a blank screen instead of an error message I highly
> recommend turning display_errors on and setting error_reporting to
> E_ALL in you dev php.ini - that way you'll actually see error messages
> rather than having to hunt through the code by hand.
>   
Duh, Stuart, I'm wet behind the ears, but that was one of my first
revelations - to use
error_reporting(E_ALL);
ini_set('display_errors', 1); ;-)

But that's what's weird...  if I comment those last 4 lines out, the
proggie works (or shall I say, limps; I still have other problems)
But the in_array just refuses to cooperate.

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] Re: aesthetic beauty in conception, execution

2009-06-18 Thread PJ
Shawn McKenzie wrote:
> PJ wrote:
>   
>> I just thought I would share a revelation.
>> Someone just pointed me to a site that IMHO is superb for elegance of
>> artistic design and programming.
>> I was blown away.
>> http://www.apfq.ca
>> You won't regret it. 8-)
>>
>> 
>
> Superb for a mass of validation errors. It must be in the design stage
> as its still full of gibberish placeholder text.  Most people use lorem
> ipsum etc...
>
>   
Câlice the tabernac, t'es donc un hosti niezeu. ;-)
I may have misspelled that as it's not my native tongue - mine is forked.

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] aesthetic beauty in conception, execution

2009-06-18 Thread PJ
Robert Cummings wrote:
> PJ wrote:
>> I just thought I would share a revelation.
>> Someone just pointed me to a site that IMHO is superb for elegance of
>> artistic design and programming.
>> I was blown away.
>> http://www.apfq.ca
>> You won't regret it. 8-)
>
> Can I have my 5 minutes back please? It's about as simplistic a site
> as it gets. If simple is elegant sure, you're sort of right, but
> artistic design seemed awfully lacking.
>
> Cheers,
> Rob.
Well, it depends by what you mean by simplistic and if you're looking
for cluttered crap that one finds all over the place, yeah, it's simple
- but certainly not simplistic.
It has a purpose that is met, it gets to the point, it focuses your
attention, it gives information and is pleasing to the eye.  What more
could you want?
American movies, for the most part and what goes with them, are
pollution of the senses. My take, of course. ;-) :-P

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] Re: aesthetic beauty in conception, execution

2009-06-18 Thread PJ
Peter Ford wrote:
> PJ wrote:
>   
>> I just thought I would share a revelation.
>> Someone just pointed me to a site that IMHO is superb for elegance of
>> artistic design and programming.
>> I was blown away.
>> http://www.apfq.ca
>> You won't regret it. 8-)
>>
>> 
>
> Il y a seulement une problème - je ne lis pas Française...
>
> I18N - it's important, you know...
>
>   
close enough... it wold still be great even if it were in Esperanto -
it's not the content, its the look, the presentation, the coding that
make it so unique. ;-)

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] populate form input option dropdown box from existing data

2009-06-18 Thread PJ
Martin Scotta wrote:
> It is a sintax error
>
> if (in_array($ex, $selected)   <--- missing )
> echo "yes";
> else echo "no";
>
> On Thu, Jun 18, 2009 at 10:13 AM, PJ  <mailto:af.gour...@videotron.ca>> wrote:
>
> Ford, Mike wrote:
> > On 17 June 2009 14:30, PJ advised:
> >
> >
> >
> >> For the moment, I am trying to resolve the problem of
> >> extracting a value
> >> from a string returned by a query. I thought that in_array()
> would do
> >> it, but the tests I have run on it are 100% negative. The only
> thing I
> >> have not used in the tests is third parameter bool $strict
> which only
> >> affects case-sensitivity if the $needle is a string.
> >>
> >
> > $strict has nothing whatsoever at all in any way to do with case
> > sensitivity -- $strict controls whether the values are compared
> using
> > equality (==) or identity (===) tests. As is stated quite
> clearly on the
> > manual page, in_array() is always case-sensitive.
> >
> >
> >>  This leads me to
> >> believe that in_array() is either inappropriately defined in
> >> the manual
> >> and not effective on associative arrays
> >>
> >
> > Complete rubbish -- the in_array() manual page is excellent and
> totally
> > accurate, complete with 3 working examples.
> >
> >
> I would really like to understand why my attempts to reproduce the
> first
> example just did not work.
> Note also that the examples do not show in_array($string, $array)
> My array was Array ([0]=>6[1]=>14), so when I tried if
> (in_array($string, $array) , echo $string did not return 14 as I had
> expected; neither did if(in_array("14", $array) ... nor
> if(in_array(14,
> $array). It still does not... actually, the screen goes blank.
> So, what am I doing wrong?
> Here's what is not working... I'm trying to reproduce the example from
> php.net <http://php.net>:
>
> $selected = array();
> if ( ( $results = mysql_query($sql, $db) ) ) {
>  while ( $row = mysql_fetch_assoc($results) ) {
>$selected[] = $row['id'];
>}
>  }
> print_r($selected);
> $ex = 14;
> if (in_array($ex, $selected)
> echo "yes";
> else echo "no";
>
> Regardless if I put 14 into $ex or "14" or '14' or even if I put
> the 14
> instead of the $ex into the if line, I get a blank screen. It seems tp
> me, from what I see in the manual that this should work... or am I
> supposed to know something that is not clear in the examples... ?
>
>
> --
> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
> -
> Phil Jourdan --- p...@ptahhotep.com <mailto:p...@ptahhotep.com>
>   http://www.ptahhotep.com
>   http://www.chiccantine.com/andypantry.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
> -- 
> Martin Scotta
Actually, we have to call it a typo because i fixed that and the results
are exactly the same = blank screen. :-(

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



[PHP] aesthetic beauty in conception, execution

2009-06-18 Thread PJ
I just thought I would share a revelation.
Someone just pointed me to a site that IMHO is superb for elegance of
artistic design and programming.
I was blown away.
http://www.apfq.ca
You won't regret it. 8-)

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] how to extract fields from associative array into different variables

2009-06-18 Thread PJ
Yuri Yarlei wrote:
> You can try use the foreach function.
>
> ex:
> if ($res = mysql_query ($sql, $db)) {
>  /* I personally prefer "res" for "resource", not "results" */
>  while ($r = mysql_fetch_assoc ($res)) {
>  $rows[] = $r;
> }
> }
>
>
> foreach ($rows as $row){
>   echo $row['first_name'];
>   echo "";
> }
>
> the foreach function transform the array $rows[] (the fisrt level of 
> associative array) in a variable $row.
>
>   
Thanks Yuri, I needed this explanation. Looks like it might be a simpler
alternative to my while... I was thinking about it, but didn't quite
grasp it... ashita wa "shining brain" ;-)
> Yuri Yarlei.
> Programmer PHP, CSS, Java, PostregreSQL;
> Today PHP, tomorrow Java, after the world.
> Kyou wa PHP, ashita wa Java, sono ato sekai desu.
>
>
>
>   
>> To: php-general@lists.php.net
>> From: news.nospam.0ixbt...@luden.se
>> Date: Thu, 18 Jun 2009 14:17:59 +0200
>> Subject: Re: [PHP] how to extract fields from associative array into 
>> different variables
>>
>> On Tue, 16 Jun 2009 08:50:45 -0400, PJ wrote:
>>
>> 
>>> Ashley Sheridan wrote:
>>>   
>>>> On Mon, 2009-06-15 at 17:38 -0400, PJ wrote:
>>>>   
>>>> 
>>>>> Then I have to add some loopy thing to assign the values to the
>>>>> $variables... a real pita since my variable do not lend themselves too
>>>>> well to linear alterations ($varIn, $var2IN, $var3IN... etc... so $i=0
>>>>> and $i++ arren't going to be too cooperative here... I guess I'd have to
>>>>> change that to $var1IN... and then figure out how to do $var.$i.IN ... I
>>>>> already tried, but don't seem to have it right
>>>>> 
>>>>>   
>>>> Why do you need them in separate variables? Can't you use them using
>>>> array syntax elsewhere in your code?
>>>> 
>>> Basically, I don't know how else to handle inserting and updating random
>>> ...
>>>   
>> What he's talking about is doing this:
>>
>>   if ($res = mysql_query ($sql, $db)) {
>> /* I personally prefer "res" for "resource", not "results" */
>> while ($r = mysql_fetch_assoc ($res)) {
>>   $rows[] = $r;
>> }
>>   }
>>
>> And then you access the individual rows/columns as
>>   $rows[0]['first_name']
>>   $rows[0]['last_name']
>>   $rows[1]['first_name']
>>   $rows[1]['last_name']
>> and so on, in some kind of loop probably.
>>
>> (I thought this had been spelled out already, but I
>>  was unable to find it so perhaps not.)
>>
>>
>> /Nisse
>>
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>> 
>
> _
> Deixe suas conversas mais divertidas. Baixe agora mesmo novos emoticons. � 
> gr�tis!
> http://specials.br.msn.com/ilovemessenger/pacotes.aspx
>   


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] how to extract fields from associative array into different variables

2009-06-18 Thread PJ
Nisse Engström wrote:
> On Tue, 16 Jun 2009 08:50:45 -0400, PJ wrote:
>
>   
>> Ashley Sheridan wrote:
>> 
>>> On Mon, 2009-06-15 at 17:38 -0400, PJ wrote:
>>>   
>>>   
>>>> Then I have to add some loopy thing to assign the values to the
>>>> $variables... a real pita since my variable do not lend themselves too
>>>> well to linear alterations ($varIn, $var2IN, $var3IN... etc... so $i=0
>>>> and $i++ arren't going to be too cooperative here... I guess I'd have to
>>>> change that to $var1IN... and then figure out how to do $var.$i.IN ... I
>>>> already tried, but don't seem to have it right
>>>> 
>>>> 
>>> Why do you need them in separate variables? Can't you use them using
>>> array syntax elsewhere in your code?
>>>   
>
>   
>> Basically, I don't know how else to handle inserting and updating random
>> ...
>> 
>
> What he's talking about is doing this:
>
>   if ($res = mysql_query ($sql, $db)) {
> /* I personally prefer "res" for "resource", not "results" */
> while ($r = mysql_fetch_assoc ($res)) {
>   $rows[] = $r;
> }
>   }
>
> And then you access the individual rows/columns as
>   $rows[0]['first_name']
>   $rows[0]['last_name']
>   $rows[1]['first_name']
>   $rows[1]['last_name']
> and so on, in some kind of loop probably.
>
> (I thought this had been spelled out already, but I
>  was unable to find it so perhaps not.)
>
>
> /Nisse
>
>   
Right. I finally got it.
PJ

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] Re: sloppiness & stupidity

2009-06-18 Thread PJ
Ford, Mike wrote:
> On 17 June 2009 23:56, PJ advised:
>
>   
>> Nisse Engstr�m wrote:
>> 
>>> On Wed, 17 Jun 2009 10:18:09 +0100, "Ford, Mike" wrote:
>>>
>>>
>>>   
>>>> This is very true -- but XHTML requires *all* attributes to have a
>>>> value, so an XHTML conformant page will use >>> name="selector"> (or something similar such as >>> name="selector">). The only inconsistency here is that different people
>>>> have chosen to validate against different standards.
>>>>
>>>> 
>>> The multiple attribute only has one value: "multiple", so
>>> it has to be . I don't think
>>> "yes" cuts the mustard. In HTML, you can shorten it to .
>>>
>>>   
>> From my limited experience, and vast reading of those glorious 20,000
>> entries on the Internet, multiple does not take a parameter. I had my
>> fingers slapped once when I validated or something - multiple is just
>> plain multiple ! :-P ;-) :-) 
>> 
>
> Oh, good grief! Did you even read what you've quoted from me above?
>
> If you code to an HTML standard, then multiple can indeed be just plain 
> multiple, but HTML 4 does allow the addition of ="multiple" for compatibility 
> reasons.
>
> But if you code to an XHTML standard, multiple must be multiple="multiple", 
> as XHTML **requires** that all attributes have an argument, and (as I've just 
> learned!) "multiple" is the only valid argument for the multiple attribute.
>
> No modern browser that I know of will object to the multiple="multiple" usage.
>   
Ouch, my hand is beginning to hurt. :-(

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] populate form input option dropdown box from existing data

2009-06-18 Thread PJ
Ford, Mike wrote:
> On 17 June 2009 14:30, PJ advised:
>
>
>   
>> For the moment, I am trying to resolve the problem of
>> extracting a value
>> from a string returned by a query. I thought that in_array() would do
>> it, but the tests I have run on it are 100% negative. The only thing I
>> have not used in the tests is third parameter bool $strict which only
>> affects case-sensitivity if the $needle is a string.
>> 
>
> $strict has nothing whatsoever at all in any way to do with case
> sensitivity -- $strict controls whether the values are compared using
> equality (==) or identity (===) tests. As is stated quite clearly on the
> manual page, in_array() is always case-sensitive. 
>
>   
>>  This leads me to
>> believe that in_array() is either inappropriately defined in
>> the manual
>> and not effective on associative arrays
>> 
>
> Complete rubbish -- the in_array() manual page is excellent and totally
> accurate, complete with 3 working examples.
>
>   
I would really like to understand why my attempts to reproduce the first
example just did not work.
Note also that the examples do not show in_array($string, $array)
My array was Array ([0]=>6[1]=>14), so when I tried if
(in_array($string, $array) , echo $string did not return 14 as I had
expected; neither did if(in_array("14", $array) ... nor if(in_array(14,
$array). It still does not... actually, the screen goes blank.
So, what am I doing wrong?
Here's what is not working... I'm trying to reproduce the example from
php.net:

$selected = array();
if ( ( $results = mysql_query($sql, $db) ) ) {
  while ( $row = mysql_fetch_assoc($results) ) {
$selected[] = $row['id'];
}
  }
print_r($selected);
$ex = 14;
if (in_array($ex, $selected)
echo "yes";
else echo "no";

Regardless if I put 14 into $ex or "14" or '14' or even if I put the 14
instead of the $ex into the if line, I get a blank screen. It seems tp
me, from what I see in the manual that this should work... or am I
supposed to know something that is not clear in the examples... ?


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] populate form input option dropdown box from existing data

2009-06-18 Thread PJ
Ford, Mike wrote:
> On 17 June 2009 15:01, PJ advised:
>
>   
>> It does, indeed. This confirms my inexperienced conclusion that
>> in_array() does not work on associative arrays per se; it works on
>> simple arrays and I just don't have the experience to think of
>> extracting only the id fields.
>> 
>
> Let's squash this misconception again -- PHP only has associative
> arrays, it's just that in most contexts it treats numeric keys
> specially. So, internally, array('fred', 'bill', 'joe') is stored using
> exactly the same techniques as array('one'=>'fred', 'two'=>'bill',
> 'three'=>'joe'), but because the first one has numeric keys there are
> some things you can do with it that you can't with the second.  But
> functions such as in_array, where all that really matters is the array's
> values, really couldn't care whether the keys are numeric, string, or a
> mixture.
>   
Thanks for the explanation.
>   
>> Also, the other problem was the option selected definition required
>> Shawn's clarification > 
> which
>   
>> now highlights the selected fields. In all my searches (horrendously
>> wasted time) I did not find 
>> any mention
>> of "component-select" either in php.net or w3c.org
>> 
>
> I totally don't understand this comment: 'component-select' is just the
> name that Shawn chose to give his  field -- he could just as
> well have named it 'arnold-frog' without it making a blind bit of
> difference (so long as every other reference to it was changed to
> match!).
>   
The way it was put, I understood that that was the definitive attribute
for the field. This confused me even more!
> Cheers!
>
> Mike
>
>  --
> Mike Ford,  Electronic Information Developer,
> C507, Leeds Metropolitan University, Civic Quarter Campus, 
> Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom
> Email: m.f...@leedsmet.ac.uk
> Tel: +44 113 812 4730
>
>
> To view the terms under which this email is distributed, please go to 
> http://disclaimer.leedsmet.ac.uk/email.htm
>
>   


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] populate form input option dropdown box from existing data

2009-06-18 Thread PJ
Stuart wrote:
> 2009/6/18 PJ :
>   
>> I snipped to make it short... continue at bottom...
>> 
>>> Step back from the code and consider the steps you need to perform...
>>>
>>> 1) Get an array of the categories, ideally in the form $cats[]
>>> = categoryname.
>>>
>>> 2) Get an array of the category IDs that should be selected, i.e.
>>> $selectedcats = array(3, 5, 7, 9).
>>>
>>> 3) Start the HTML select element
>>>
>>> 4) foreach ($cats as $id => $catname)
>>>
>>> 5) Determine whether it should be selected. e.g. $selected =
>>> (in_array($id, $selectedcats) ? 'selected="selected"' : ''.
>>>
>>> 6) Output the HTML option element, like >> $selected>$catname, escaping where appropriate.
>>>
>>> 7) End of loop, job done.
>>>
>>> If your code doesn't have that structure then you may want to consider
>>> starting again.
>>>
>>>   
>> I'm quite sure the structure is correct.
>> 
>>> Secondly, check that you're not using the same variable name twice.
>>>   
>> I did find that in an instance of $id being repeated so I changed it to
>> $bid.
>> 
>>>  In
>>> one of your previous emails you used $selected to hold the array of
>>> selected categories, and in another you used it for the text to be
>>> inserted into the option element. The latter will blat over the former
>>> leading to no more than 1 option selected, and even then only if it's
>>> the first option displayed.
>>>
>>>   
>> The $selected were not mine... as I was using $ccc ; only started using
>> $selected a couple of hours ago.
>> 
>>> If you're still stuck please post more of your code in a single chunk
>>> including all the elements in my step-by-step above. The snippets
>>> you're currently posting are not giving us enough context to spot even
>>> the most common mistakes.
>>>   
>> I'm including the relevant code:
>>
>> // select categories for book to be updated
>> $sql = "SELECT id, category FROM categories, book_categories
>>WHERE book_categories.bookID = '$bid' &&
>> book_categories.categories_id = categories.id";
>> if ( ( $results = mysql_query($sql, $db) ) ) {
>>  while ( $row = mysql_fetch_assoc($results) ) {
>>$selected[] = $row['id'];
>>}
>>  }
>> else $selected = Array( 0 => '0');
>> echo $selected;
>> print_r($selected);
>>
>> $sql = "SELECT * FROM categories";
>> echo "";
>>  if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>> while ( $row = mysql_fetch_assoc($results) ) {
>>if (in_array($row['id'], $selected)) {
>>   echo "> 
>>> ", $row['category'], "";
>>>   
>>   }
>>   else echo "",
>> $row['category'], "";
>>}
>>}
>>
>> Problem #1)in the first query result. I can't figure out how to deal
>> with it. The code works fine if there are categories assigned to the
>> book. If not, an undefined variable error is spewed out for selected.
>> 
>
> It's best practice to initialise all variables before using them. The
> code you have will not create the $selected variable if there are no
> results...
>
> (code repeated for clarity)
>   
>> if ( ( $results = mysql_query($sql, $db) ) ) {
>> 
>
> If there are no results this will still "work" so will drop through to...
>
>   
>>  while ( $row = mysql_fetch_assoc($results) ) {
>>$selected[] = $row['id'];
>>}
>> 
>
> But since there are no results the first call to mysql_fetch_assoc
> will return false so the line in the middle will never get executed.
>
>   
>>  }
>> else $selected = Array( 0 => '0');
>> 
>
> Drop this else line and instead put $selected = array(); before the
> mysql_query line. Not sure why you want an element 0 => '0' in there,
> I'm guessing it's one of your attempts to get rid of the notice.
>
>   
>> Problem #2) in the second query, the selected is in the source code but
>> it is not highlited. Several times I did get the categories highlighted,
>

Re: [PHP] populate form input option dropdown box from existing data

2009-06-17 Thread PJ
I snipped to make it short... continue at bottom...
> Step back from the code and consider the steps you need to perform...
>
> 1) Get an array of the categories, ideally in the form $cats[]
> = categoryname.
>
> 2) Get an array of the category IDs that should be selected, i.e.
> $selectedcats = array(3, 5, 7, 9).
>
> 3) Start the HTML select element
>
> 4) foreach ($cats as $id => $catname)
>
> 5) Determine whether it should be selected. e.g. $selected =
> (in_array($id, $selectedcats) ? 'selected="selected"' : ''.
>
> 6) Output the HTML option element, like  $selected>$catname, escaping where appropriate.
>
> 7) End of loop, job done.
>
> If your code doesn't have that structure then you may want to consider
> starting again.
>   
I'm quite sure the structure is correct.
> Secondly, check that you're not using the same variable name twice.
I did find that in an instance of $id being repeated so I changed it to
$bid.
>  In
> one of your previous emails you used $selected to hold the array of
> selected categories, and in another you used it for the text to be
> inserted into the option element. The latter will blat over the former
> leading to no more than 1 option selected, and even then only if it's
> the first option displayed.
>   
The $selected were not mine... as I was using $ccc ; only started using
$selected a couple of hours ago.
> If you're still stuck please post more of your code in a single chunk
> including all the elements in my step-by-step above. The snippets
> you're currently posting are not giving us enough context to spot even
> the most common mistakes.
I'm including the relevant code:

// select categories for book to be updated
$sql = "SELECT id, category FROM categories, book_categories
WHERE book_categories.bookID = '$bid' &&
book_categories.categories_id = categories.id";
if ( ( $results = mysql_query($sql, $db) ) ) {
  while ( $row = mysql_fetch_assoc($results) ) {
$selected[] = $row['id'];
}
  }
else $selected = Array( 0 => '0');
echo $selected;
print_r($selected);

$sql = "SELECT * FROM categories";
echo "";
  if ( ( $results = mysql_query($sql, $db) ) !== false ) {
while ( $row = mysql_fetch_assoc($results) ) {
if (in_array($row['id'], $selected)) {
   echo "", $row['category'], "";
   }
   else echo "",
$row['category'], "";
}
}

Problem #1)in the first query result. I can't figure out how to deal
with it. The code works fine if there are categories assigned to the
book. If not, an undefined variable error is spewed out for selected.

Problem #2) in the second query, the selected is in the source code but
it is not highlited. Several times I did get the categories highlighted,
but I could never catch what it was that made it work. When I had the
$id problem, i was trying this code from Yuri (but I don't understand
where he got the $id from ) :


".$row['name']."";
  }
}
?>


I think there is an error in this last code... could it be $id is
supposed to be the array holding the category ids?


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] sloppiness & stupidity

2009-06-17 Thread PJ

:-*


Matty Sarro wrote:
> *hug*
> I think that's what you were really asking for.
>
> -Matty
>
> On Tue, Jun 16, 2009 at 8:43 PM, PJ  <mailto:af.gour...@videotron.ca>> wrote:
>
> I'm sorry, guys, but I am really getting po'd.
> The irresponsible sloppiness and stupidity is just getting to me.
> In my quest for a way to populate a multiple option select box I have
> run across so many errors that it's beyond belief... such nonsense as
> "select for select or select="select" ( think this is right, but then
> who knows?) & other variations; then theres in_array() that has
> explanations about as clear as a cesspool - the way it's explained is
> not at all clear, -- and somebody did an in_array($tring, "text") -
> which is reversed... don't these idiots read what they are putting
> up on
> the internet?
> And some of you wonder why I ask stupid questions? Rare, indeed,
> is the
> clear explanation or demonstration. I get the impression that
> there are
> a lot of asholeys out there who learn the less than basic programming
> and then forget that even a ignoramus as I can be looking for rather
> complicated guidance. The Internet was a great promise, but god is is
> overbloated with floating intellectual excrement.
> Sorry, but ranting sometimes is good for the psyche. >:o
>
> --
> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
> -
> Phil Jourdan --- p...@ptahhotep.com <mailto:p...@ptahhotep.com>
>   http://www.ptahhotep.com
>   http://www.chiccantine.com/andypantry.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] Re: sloppiness & stupidity

2009-06-17 Thread PJ
Nisse Engström wrote:
> On Wed, 17 Jun 2009 10:18:09 +0100, "Ford, Mike" wrote:
>
>   
>> This is very true -- but XHTML requires *all* attributes to have a
>> value, so an XHTML conformant page will use > name="selector"> (or something similar such as > name="selector">). The only inconsistency here is that different people
>> have chosen to validate against different standards.
>> 
>
> The multiple attribute only has one value: "multiple", so
> it has to be . I don't think
> "yes" cuts the mustard. In HTML, you can shorten it to
> .
>   
>From my limited experience, and vast reading of those glorious 20,000
entries on the Internet, multiple does not take a parameter. I had my
fingers slapped once when I validated or something - multiple is just
plain multiple ! :-P ;-) :-)

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] populate form input option dropdown box from existing data

2009-06-17 Thread PJ
Shawn McKenzie wrote:
> PJ wrote:
>> Ashley Sheridan wrote:
>>> On Wed, 2009-06-17 at 10:01 -0400, PJ wrote:
>>>
>>>> Ford, Mike wrote:
>>>>
>>>>> On 16 June 2009 20:48, PJ advised:
>>>>>
>>>>>
>>>>>> Now, I was happy to learn that it is simpler to populate the
>>>>>> insert new
>>>>>> books page dynamically from the db. Much shorter & neater.
>>>>>> It looks to me like the best solution for the edit page is
>>>>>> close to what
>>>>>> Yuri suggests.
>>>>>> Since the edit page is very similar to the insert new books page, I
>>>>>> merely need to populate the Select options box slightly differently.
>>>>>> This is the code to populate the insert page:
>>>>>> 
>>>>>> >>>>> $sql = "SELECT * FROM categories";
>>>>>> if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>>>>>> while ( $row = mysql_fetch_assoc($results) ) {
>>>>>> echo "", $row['category'],
>>>>>> ""; }
>>>>>> }
>>>>>> 
>>>>>>
>>>>>> The problem nowis to find a way to add a conditional clause above
>>>>>> that
>>>>>> will insert the option="selected" in the output.
>>>>>> The input for this comes from:
>>>>>> // do categories
>>>>>> $sql = "SELECT id, category FROM categories, book_categories
>>>>>> WHERE book_categories.bookID = $idIN &&
>>>>>> book_categories.categories_id = categories.id";;
>>>>>> if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>>>>>> while ( $row = mysql_fetch_assoc($results) ) {
>>>>>> echo$row['id'], "";
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> This may return any number of category ids so the problem is to
>>>>>> figure
>>>>>> out a way to pass the ids from the above code to the right ids in the
>>>>>> first code above. How & what do I search to match the two ids?
>>>>>>
>>>>> Well, if I'm understanding your queries correctly, you need to compare
>>>>> the two sets of $row['id'] from the two queries above -- so your first
>>>>> query should be the second one above ("SELECT id, category FROM ..."),
>>>>> and you need to save the ids it returns for use in the loop which
>>>>> emits
>>>>> the s. This can be done by replacing the "echo $row['id']"
>>>>> with
>>>>> "$selected_ids[] = $row['id']". Now you have an array of the selected
>>>>> ids which you can use in your in_array(). So your finished code is
>>>>> going
>>>>> to look something like this:
>>>>>
>>>>> 
>>>>> >>>> // do categories
>>>>> $selected_ids = array();
>>>>> $sql = "SELECT id, category FROM categories, book_categories
>>>>> WHERE book_categories.bookID = $idIN &&
>>>>> book_categories.categories_id = categories.id";
>>>>> if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>>>>> while ( $row = mysql_fetch_assoc($results) ) {
>>>>> $selected_ids[] = $row['id'];
>>>>> }
>>>>> }
>>>>> $sql = "SELECT * FROM categories";
>>>>> if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>>>>> while ( $row = mysql_fetch_assoc($results) ) {
>>>>> echo ">>>> ">", $row['category'],
>>>>> "\n";
>>>>> }
>>>>> }
>>>>> ?>
>>>>> 
>>>>>
>>>>> Hope this helps.
>>>>>
>>>> It does, indeed. This confirms my inexperienced conclusion that
>>>> in_array() does not work on associative arrays per se; it works on
>>>> simple arrays and I just don't have the experience to think of
>>>> extracting only the id fields.
>>>> I actually am using a slightly more complicated if else statement which
>>>> works.
>>>> Also, the other problem was the option selec

Re: [PHP] populate form input option dropdown box from existing data

2009-06-17 Thread PJ


Yuri Yarlei wrote:
> sorry, maybe I have been lazy in that comment, I admit, whem wrote that 
> solution I was in a such hurry and without time. I dont really read what I 
> wrote, but now I think this solution is good.
>
>
> 
>  $sql = "SELECT id,name FROM categories";
> if ( ( $results = mysql_query($sql, $conn) ) !== false ) {
>   while ( $row = mysql_fetch_assoc($results) ) {
> $selected = ($id == $row['id'] ? 'selected="selected"' : '');
> echo " ".$selected.">".$row['name']."";
>   }
> }
> ?>
> 
>   
doesnt quite work: there was a conflict with a $id that I fixed; but
your code did not pass the $selected ids - don't know why.
Here's what finally worked and it required the categoriesIN[] for the name:

echo "";
  if ( ( $results = mysql_query($sql, $db) ) !== false ) {
while ( $row = mysql_fetch_assoc($results) ) {
if (in_array($row['id'], $selected)) {
   echo "",
$row['category'], "";
   }
   else echo "",
$row['category'], "";
}
}

I think it will work now.  Thanks much for the input & the support. :-)
>
>
>   
>> Date: Wed, 17 Jun 2009 10:16:15 +0100
>> From: m.f...@leedsmet.ac.uk
>> To: php-general@lists.php.net
>> Subject: RE: [PHP] populate form input option dropdown box from existing data
>>
>> On 16 June 2009 20:48, PJ advised:
>>
>> 
>>> Now, I was happy to learn that it is simpler to populate the
>>> insert new
>>> books page dynamically from the db. Much shorter & neater.
>>> It looks to me like the best solution for the edit page is
>>> close to what
>>> Yuri suggests.
>>> Since the edit page is very similar to the insert new books page, I
>>> merely need to populate the Select options box slightly differently.
>>> This is the code to populate the insert page:
>>> 
>>> >> $sql = "SELECT * FROM categories";
>>>   if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>>> while ( $row = mysql_fetch_assoc($results) ) {
>>> echo "", $row['category'],
>>> ""; }
>>> }
>>>   
>>> 
>>>
>>> The problem nowis to find a way to add a conditional clause above that
>>> will insert the option="selected" in the output.
>>> The input for this comes from:
>>> // do categories
>>> $sql = "SELECT id, category FROM categories, book_categories
>>> WHERE book_categories.bookID = $idIN &&
>>> book_categories.categories_id = categories.id";;
>>> if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>>> while ( $row = mysql_fetch_assoc($results) ) {
>>> echo$row['id'], "";
>>> }
>>> }
>>>
>>> This may return any number of category ids so the problem is to figure
>>> out a way to pass the ids from the above code to the right ids in the
>>> first code above. How & what do I search to match the two ids?
>>>   
>> Well, if I'm understanding your queries correctly, you need to compare
>> the two sets of $row['id'] from the two queries above -- so your first
>> query should be the second one above ("SELECT id, category FROM ..."),
>> and you need to save the ids it returns for use in the loop which emits
>> the s. This can be done by replacing the "echo $row['id']" with
>> "$selected_ids[] = $row['id']". Now you have an array of the selected
>> ids which you can use in your in_array(). So your finished code is going
>> to look something like this:
>>
>>   
>>   >   // do categories
>>   $selected_ids = array();
>>   $sql = "SELECT id, category FROM categories, book_categories
>>   WHERE book_categories.bookID = $idIN &&
>> book_categories.categories_id = categories.id";
>>   if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>>   while ( $row = mysql_fetch_assoc($results) ) {
>>   $selected_ids[] = $row['id'];
>>   }
>>   }
>>   $sql = "SELECT * FROM categories";
>>   if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>>   while ( $row = mysql_fetch_assoc($results) ) {
>>   echo ">">"

Re: [PHP] populate form input option dropdown box from existing data

2009-06-17 Thread PJ
Ashley Sheridan wrote:
> On Wed, 2009-06-17 at 10:01 -0400, PJ wrote:
>   
>> Ford, Mike wrote:
>> 
>>> On 16 June 2009 20:48, PJ advised:
>>>
>>>   
>>>> Now, I was happy to learn that it is simpler to populate the
>>>> insert new
>>>> books page dynamically from the db. Much shorter & neater.
>>>> It looks to me like the best solution for the edit page is
>>>> close to what
>>>> Yuri suggests.
>>>> Since the edit page is very similar to the insert new books page, I
>>>> merely need to populate the Select options box slightly differently.
>>>> This is the code to populate the insert page:
>>>> 
>>>> >>> $sql = "SELECT * FROM categories";
>>>> if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>>>> while ( $row = mysql_fetch_assoc($results) ) {
>>>> echo "", $row['category'],
>>>> ""; }
>>>> }
>>>> 
>>>>
>>>> The problem nowis to find a way to add a conditional clause above that
>>>> will insert the option="selected" in the output.
>>>> The input for this comes from:
>>>> // do categories
>>>> $sql = "SELECT id, category FROM categories, book_categories
>>>> WHERE book_categories.bookID = $idIN &&
>>>> book_categories.categories_id = categories.id";;
>>>> if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>>>> while ( $row = mysql_fetch_assoc($results) ) {
>>>> echo$row['id'], "";
>>>> }
>>>> }
>>>>
>>>> This may return any number of category ids so the problem is to figure
>>>> out a way to pass the ids from the above code to the right ids in the
>>>> first code above. How & what do I search to match the two ids?
>>>> 
>>> Well, if I'm understanding your queries correctly, you need to compare
>>> the two sets of $row['id'] from the two queries above -- so your first
>>> query should be the second one above ("SELECT id, category FROM ..."),
>>> and you need to save the ids it returns for use in the loop which emits
>>> the s. This can be done by replacing the "echo $row['id']" with
>>> "$selected_ids[] = $row['id']". Now you have an array of the selected
>>> ids which you can use in your in_array(). So your finished code is going
>>> to look something like this:
>>>
>>> 
>>> >> // do categories
>>> $selected_ids = array();
>>> $sql = "SELECT id, category FROM categories, book_categories
>>> WHERE book_categories.bookID = $idIN &&
>>> book_categories.categories_id = categories.id";
>>> if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>>> while ( $row = mysql_fetch_assoc($results) ) {
>>> $selected_ids[] = $row['id'];
>>> }
>>> }
>>> $sql = "SELECT * FROM categories";
>>> if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>>> while ( $row = mysql_fetch_assoc($results) ) {
>>> echo ">> ">", $row['category'],
>>> "\n";
>>> }
>>> }
>>> ?>
>>> 
>>>
>>> Hope this helps.
>>>   
>> It does, indeed. This confirms my inexperienced conclusion that
>> in_array() does not work on associative arrays per se; it works on
>> simple arrays and I just don't have the experience to think of
>> extracting only the id fields.
>> I actually am using a slightly more complicated if else statement which
>> works.
>> Also, the other problem was the option selected definition required
>> Shawn's clarification
>> > selected fields.
>> In all my searches (horrendously wasted time) I did not find any mention
>> of "component-select" either in php.net or w3c.org (I don't think my
>> queries on Google brought up anything from php.net) but w3c.org did and
>> I had looked at the page but somehow missed it.
>> I'm going to have to look at the way I search things. When you are
>> looking for something specific, other, even relevant, solutions seem to
>> get screened out.
>>
>> Anyway, I learned quite a bit, here.
>> Thank you very, very much, gentlemen.
>> PJ
>>
>> -- 
>> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme.

Re: [PHP] populate form input option dropdown box from existing data

2009-06-17 Thread PJ
Ford, Mike wrote:
> On 16 June 2009 20:48, PJ advised:
>
>> Now, I was happy to learn that it is simpler to populate the
>> insert new
>> books page dynamically from the db. Much shorter & neater.
>> It looks to me like the best solution for the edit page is
>> close to what
>> Yuri suggests.
>> Since the edit page is very similar to the insert new books page, I
>> merely need to populate the Select options box slightly differently.
>> This is the code to populate the insert page:
>> 
>> > $sql = "SELECT * FROM categories";
>> if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>> while ( $row = mysql_fetch_assoc($results) ) {
>> echo "", $row['category'],
>> ""; }
>> }
>> 
>>
>> The problem nowis to find a way to add a conditional clause above that
>> will insert the option="selected" in the output.
>> The input for this comes from:
>> // do categories
>> $sql = "SELECT id, category FROM categories, book_categories
>> WHERE book_categories.bookID = $idIN &&
>> book_categories.categories_id = categories.id";;
>> if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>> while ( $row = mysql_fetch_assoc($results) ) {
>> echo$row['id'], "";
>> }
>> }
>>
>> This may return any number of category ids so the problem is to figure
>> out a way to pass the ids from the above code to the right ids in the
>> first code above. How & what do I search to match the two ids?
>
> Well, if I'm understanding your queries correctly, you need to compare
> the two sets of $row['id'] from the two queries above -- so your first
> query should be the second one above ("SELECT id, category FROM ..."),
> and you need to save the ids it returns for use in the loop which emits
> the s. This can be done by replacing the "echo $row['id']" with
> "$selected_ids[] = $row['id']". Now you have an array of the selected
> ids which you can use in your in_array(). So your finished code is going
> to look something like this:
>
> 
>  // do categories
> $selected_ids = array();
> $sql = "SELECT id, category FROM categories, book_categories
> WHERE book_categories.bookID = $idIN &&
> book_categories.categories_id = categories.id";
> if ( ( $results = mysql_query($sql, $db) ) !== false ) {
> while ( $row = mysql_fetch_assoc($results) ) {
> $selected_ids[] = $row['id'];
> }
> }
> $sql = "SELECT * FROM categories";
> if ( ( $results = mysql_query($sql, $db) ) !== false ) {
> while ( $row = mysql_fetch_assoc($results) ) {
> echo " ">", $row['category'],
> "\n";
> }
> }
> ?>
> 
>
> Hope this helps.
It does, indeed. This confirms my inexperienced conclusion that
in_array() does not work on associative arrays per se; it works on
simple arrays and I just don't have the experience to think of
extracting only the id fields.
I actually am using a slightly more complicated if else statement which
works.
Also, the other problem was the option selected definition required
Shawn's clarification
http://www.ptahhotep.com
http://www.chiccantine.com/andypantry.php

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



Re: [PHP] populate form input option dropdown box from existing data

2009-06-17 Thread PJ
Ashley Sheridan wrote:
> On Tue, 2009-06-16 at 20:46 -0400, PJ wrote:
>   
>> Ashley Sheridan wrote:
>> 
>>> On Tue, 2009-06-16 at 18:19 -0400, PJ wrote:
>>>   
>>>   
>>>> Ashley Sheridan wrote:
>>>> 
>>>> 
>>>>> On Tue, 2009-06-16 at 15:48 -0400, PJ wrote:
>>>>>   
>>>>>   
>>>>>   
>>>>>> jenai tomaka wrote:
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> You can try like this,
>>>>>>>
>>>>>>> $row = stored data;
>>>>>>>  
>>>>>>> and write the options like this
>>>>>>> 
>>>>>>>
>>>>>>>
>>>>>>> Yuri Yarlei.
>>>>>>>
>>>>>>> <http://brasil.microsoft.com.br/IE8/mergulhe/?utm_source=MSN%3BHotmail&utm_medium=Tagline&utm_campaign=IE8>
>>>>>>>   
>>>>>>>   
>>>>>>>   
>>>>>> Yuri, I'm still "wet behind the ears" on this so I don't quite
>>>>>> understand what you mean by "stored data" ;  and what does the "id"
>>>>>> (id==$row?"selected":"") mean?
>>>>>> I get the idea that this might be translated into something in the code
>>>>>> I have dreamed up - further down.
>>>>>>
>>>>>> echo "", $row['category'], ">>>>> />";
>>>>>> I suppose that I must add an if clause to insert the selected option for
>>>>>> the categories that are relevant...
>>>>>>
>>>>>>
>>>>>> Gentlemen,
>>>>>> I have been diligently studying all this and have just returned my
>>>>>> attention to the list, so I've read the replies/inputs and now comment:
>>>>>>
>>>>>> BTW, I had some problems with the multiple statement - it does not take
>>>>>> any parameters; it must simply be stated multiple without quotes.
>>>>>>
>>>>>> Now, I was happy to learn that it is simpler to populate the insert new
>>>>>> books page dynamically from the db. Much shorter & neater.
>>>>>> It looks to me like the best solution for the edit page is close to what
>>>>>> Yuri suggests.
>>>>>> Since the edit page is very similar to the insert new books page, I
>>>>>> merely need to populate the Select options box slightly differently.
>>>>>> This is the code to populate the insert page:
>>>>>> 
>>>>>> >>>>> $sql = "SELECT * FROM categories"; 
>>>>>>   if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>>>>>> while ( $row = mysql_fetch_assoc($results) ) {
>>>>>> echo "", $row['category'],
>>>>>> "";
>>>>>> }
>>>>>> }
>>>>>> ?>
>>>>>> 
>>>>>>
>>>>>> The problem nowis to find a way to add a conditional clause above that
>>>>>> will insert the option="selected" in the output.
>>>>>> The input for this comes from:
>>>>>> // do categories
>>>>>> $sql = "SELECT id, category FROM categories, book_categories
>>>>>> WHERE book_categories.bookID = $idIN &&
>>>>>> book_categories.categories_id = categories.id";;
>>>>>> if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>>>>>> while ( $row = mysql_fetch_assoc($results) ) {
>>>>>> echo$row['id'], "";
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> This may return any number of category ids so the problem is to figure
>>>>>> out a way to pass the ids from the above code to the right ids in the
>>>>>> first code above.
>>>>>> How & what do I search to match the two ids?
>>>>>>
>>>>>> -- 
>>>>>> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
>&

Re: [PHP] populate form input option dropdown box from existing data

2009-06-16 Thread PJ
Ashley Sheridan wrote:
> On Tue, 2009-06-16 at 18:19 -0400, PJ wrote:
>   
>> Ashley Sheridan wrote:
>> 
>>> On Tue, 2009-06-16 at 15:48 -0400, PJ wrote:
>>>   
>>>   
>>>> jenai tomaka wrote:
>>>> 
>>>> 
>>>>> You can try like this,
>>>>>
>>>>> $row = stored data;
>>>>>  
>>>>> and write the options like this
>>>>> 
>>>>>
>>>>>
>>>>> Yuri Yarlei.
>>>>>
>>>>> <http://brasil.microsoft.com.br/IE8/mergulhe/?utm_source=MSN%3BHotmail&utm_medium=Tagline&utm_campaign=IE8>
>>>>>   
>>>>>   
>>>> Yuri, I'm still "wet behind the ears" on this so I don't quite
>>>> understand what you mean by "stored data" ;  and what does the "id"
>>>> (id==$row?"selected":"") mean?
>>>> I get the idea that this might be translated into something in the code
>>>> I have dreamed up - further down.
>>>>
>>>> echo "", $row['category'], ">>> />";
>>>> I suppose that I must add an if clause to insert the selected option for
>>>> the categories that are relevant...
>>>>
>>>>
>>>> Gentlemen,
>>>> I have been diligently studying all this and have just returned my
>>>> attention to the list, so I've read the replies/inputs and now comment:
>>>>
>>>> BTW, I had some problems with the multiple statement - it does not take
>>>> any parameters; it must simply be stated multiple without quotes.
>>>>
>>>> Now, I was happy to learn that it is simpler to populate the insert new
>>>> books page dynamically from the db. Much shorter & neater.
>>>> It looks to me like the best solution for the edit page is close to what
>>>> Yuri suggests.
>>>> Since the edit page is very similar to the insert new books page, I
>>>> merely need to populate the Select options box slightly differently.
>>>> This is the code to populate the insert page:
>>>> 
>>>> >>> $sql = "SELECT * FROM categories"; 
>>>>   if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>>>> while ( $row = mysql_fetch_assoc($results) ) {
>>>> echo "", $row['category'],
>>>> "";
>>>> }
>>>> }
>>>> ?>
>>>> 
>>>>
>>>> The problem nowis to find a way to add a conditional clause above that
>>>> will insert the option="selected" in the output.
>>>> The input for this comes from:
>>>> // do categories
>>>> $sql = "SELECT id, category FROM categories, book_categories
>>>> WHERE book_categories.bookID = $idIN &&
>>>> book_categories.categories_id = categories.id";;
>>>> if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>>>> while ( $row = mysql_fetch_assoc($results) ) {
>>>> echo$row['id'], "";
>>>> }
>>>> }
>>>>
>>>> This may return any number of category ids so the problem is to figure
>>>> out a way to pass the ids from the above code to the right ids in the
>>>> first code above.
>>>> How & what do I search to match the two ids?
>>>>
>>>> -- 
>>>> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
>>>> -
>>>> Phil Jourdan --- p...@ptahhotep.com
>>>>http://www.ptahhotep.com
>>>>http://www.chiccantine.com/andypantry.php
>>>>
>>>>
>>>> 
>>>> 
>>>  is
>>> pretty bad HTML, as attributes should always have a value. Personally, I
>>> do something like this as it tends not to confuse the code too much
>>>
>>> $selected = ($id == $row)?'selected="selected"':'';
>>> print "";
>>>   
>>>   
>> I was unable to get any of the suggestions to work, except in_array().
>> However, the selected item refuses to become highlighted.
>> code:
>> 
>> > $sql = "SELECT * FROM categories&q

[PHP] sloppiness & stupidity

2009-06-16 Thread PJ
I'm sorry, guys, but I am really getting po'd.
The irresponsible sloppiness and stupidity is just getting to me.
In my quest for a way to populate a multiple option select box I have
run across so many errors that it's beyond belief... such nonsense as
"select for select or select="select" ( think this is right, but then
who knows?) & other variations; then theres in_array() that has
explanations about as clear as a cesspool - the way it's explained is
not at all clear, -- and somebody did an in_array($tring, "text") -
which is reversed... don't these idiots read what they are putting up on
the internet?
And some of you wonder why I ask stupid questions? Rare, indeed, is the
clear explanation or demonstration. I get the impression that there are
a lot of asholeys out there who learn the less than basic programming
and then forget that even a ignoramus as I can be looking for rather
complicated guidance. The Internet was a great promise, but god is is
overbloated with floating intellectual excrement.
Sorry, but ranting sometimes is good for the psyche. >:o

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] populate form input option dropdown box from existing data

2009-06-16 Thread PJ
Ashley Sheridan wrote:
> On Tue, 2009-06-16 at 18:19 -0400, PJ wrote:
>   
>> Ashley Sheridan wrote:
>> 
>>> On Tue, 2009-06-16 at 15:48 -0400, PJ wrote:
>>>   
>>>   
>>>> jenai tomaka wrote:
>>>> 
>>>> 
>>>>> You can try like this,
>>>>>
>>>>> $row = stored data;
>>>>>  
>>>>> and write the options like this
>>>>> 
>>>>>
>>>>>
>>>>> Yuri Yarlei.
>>>>>
>>>>> <http://brasil.microsoft.com.br/IE8/mergulhe/?utm_source=MSN%3BHotmail&utm_medium=Tagline&utm_campaign=IE8>
>>>>>   
>>>>>   
>>>> Yuri, I'm still "wet behind the ears" on this so I don't quite
>>>> understand what you mean by "stored data" ;  and what does the "id"
>>>> (id==$row?"selected":"") mean?
>>>> I get the idea that this might be translated into something in the code
>>>> I have dreamed up - further down.
>>>>
>>>> echo "", $row['category'], ">>> />";
>>>> I suppose that I must add an if clause to insert the selected option for
>>>> the categories that are relevant...
>>>>
>>>>
>>>> Gentlemen,
>>>> I have been diligently studying all this and have just returned my
>>>> attention to the list, so I've read the replies/inputs and now comment:
>>>>
>>>> BTW, I had some problems with the multiple statement - it does not take
>>>> any parameters; it must simply be stated multiple without quotes.
>>>>
>>>> Now, I was happy to learn that it is simpler to populate the insert new
>>>> books page dynamically from the db. Much shorter & neater.
>>>> It looks to me like the best solution for the edit page is close to what
>>>> Yuri suggests.
>>>> Since the edit page is very similar to the insert new books page, I
>>>> merely need to populate the Select options box slightly differently.
>>>> This is the code to populate the insert page:
>>>> 
>>>> >>> $sql = "SELECT * FROM categories"; 
>>>>   if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>>>> while ( $row = mysql_fetch_assoc($results) ) {
>>>> echo "", $row['category'],
>>>> "";
>>>> }
>>>> }
>>>> ?>
>>>> 
>>>>
>>>> The problem nowis to find a way to add a conditional clause above that
>>>> will insert the option="selected" in the output.
>>>> The input for this comes from:
>>>> // do categories
>>>> $sql = "SELECT id, category FROM categories, book_categories
>>>> WHERE book_categories.bookID = $idIN &&
>>>> book_categories.categories_id = categories.id";;
>>>> if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>>>> while ( $row = mysql_fetch_assoc($results) ) {
>>>> echo$row['id'], "";
>>>> }
>>>> }
>>>>
>>>> This may return any number of category ids so the problem is to figure
>>>> out a way to pass the ids from the above code to the right ids in the
>>>> first code above.
>>>> How & what do I search to match the two ids?
>>>>
>>>> -- 
>>>> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
>>>> -
>>>> Phil Jourdan --- p...@ptahhotep.com
>>>>http://www.ptahhotep.com
>>>>http://www.chiccantine.com/andypantry.php
>>>>
>>>>
>>>> 
>>>> 
>>>  is
>>> pretty bad HTML, as attributes should always have a value. Personally, I
>>> do something like this as it tends not to confuse the code too much
>>>
>>> $selected = ($id == $row)?'selected="selected"':'';
>>> print "";
>>>   
>>>   
>> I was unable to get any of the suggestions to work, except in_array().
>> However, the selected item refuses to become highlighted.
>> code:
>> 
>> > $sql = "SELECT * FROM categories";
>> //$selected = ($id == $row)?'selected="selected"':'';
>>   if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>> while ( $row = mysql_fetch_assoc($results) ) {
>> if (in_array($row['id'], $ccc)) {
>>   echo "",
>> $row['category'], "";
>>   }
>>   else echo "",
>> $row['category'], "";
>> }
>> }
>> ?>
>> 
>> I can't find anything that explains why the selected item is not
>> highlighted.
>>
>> -- 
>> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
>> -
>> Phil Jourdan --- p...@ptahhotep.com
>>http://www.ptahhotep.com
>>http://www.chiccantine.com/andypantry.php
>>
>> 
> Have you actually looked at the html this produces to see if any of the
> elements are being marked with the selected="selected" attribute?
>   
Good thinking; I feel dumb all over again... :-(

Yeah, view source doesn't show any "selected" words.
Something fishy is going on.

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] populate form input option dropdown box from existing data

2009-06-16 Thread PJ
Ashley Sheridan wrote:
> On Tue, 2009-06-16 at 15:48 -0400, PJ wrote:
>   
>> jenai tomaka wrote:
>> 
>>> You can try like this,
>>>
>>> $row = stored data;
>>>  
>>> and write the options like this
>>> 
>>>
>>>
>>> Yuri Yarlei.
>>>
>>> <http://brasil.microsoft.com.br/IE8/mergulhe/?utm_source=MSN%3BHotmail&utm_medium=Tagline&utm_campaign=IE8>
>>>   
>> Yuri, I'm still "wet behind the ears" on this so I don't quite
>> understand what you mean by "stored data" ;  and what does the "id"
>> (id==$row?"selected":"") mean?
>> I get the idea that this might be translated into something in the code
>> I have dreamed up - further down.
>>
>> echo "", $row['category'], "";
>> I suppose that I must add an if clause to insert the selected option for
>> the categories that are relevant...
>>
>>
>> Gentlemen,
>> I have been diligently studying all this and have just returned my
>> attention to the list, so I've read the replies/inputs and now comment:
>>
>> BTW, I had some problems with the multiple statement - it does not take
>> any parameters; it must simply be stated multiple without quotes.
>>
>> Now, I was happy to learn that it is simpler to populate the insert new
>> books page dynamically from the db. Much shorter & neater.
>> It looks to me like the best solution for the edit page is close to what
>> Yuri suggests.
>> Since the edit page is very similar to the insert new books page, I
>> merely need to populate the Select options box slightly differently.
>> This is the code to populate the insert page:
>> 
>> > $sql = "SELECT * FROM categories"; 
>>   if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>> while ( $row = mysql_fetch_assoc($results) ) {
>> echo "", $row['category'],
>> "";
>> }
>> }
>> ?>
>> 
>>
>> The problem nowis to find a way to add a conditional clause above that
>> will insert the option="selected" in the output.
>> The input for this comes from:
>> // do categories
>> $sql = "SELECT id, category FROM categories, book_categories
>> WHERE book_categories.bookID = $idIN &&
>> book_categories.categories_id = categories.id";;
>> if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>> while ( $row = mysql_fetch_assoc($results) ) {
>> echo$row['id'], "";
>> }
>> }
>>
>> This may return any number of category ids so the problem is to figure
>> out a way to pass the ids from the above code to the right ids in the
>> first code above.
>> How & what do I search to match the two ids?
>>
>> -- 
>> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
>> -
>> Phil Jourdan --- p...@ptahhotep.com
>>http://www.ptahhotep.com
>>http://www.chiccantine.com/andypantry.php
>>
>>
>> 
>  is
> pretty bad HTML, as attributes should always have a value. Personally, I
> do something like this as it tends not to confuse the code too much
>
> $selected = ($id == $row)?'selected="selected"':'';
> print "";
>   
I was unable to get any of the suggestions to work, except in_array().
However, the selected item refuses to become highlighted.
code:

",
$row['category'], "";
  }
  else echo "",
$row['category'], "";
}
}
?>

I can't find anything that explains why the selected item is not
highlighted.

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] populate form input option dropdown box from existing data

2009-06-16 Thread PJ
jenai tomaka wrote:
> You can try like this,
>
> $row = stored data;
>  
> and write the options like this
> 
>
>
> Yuri Yarlei.
>
> 
Yuri, I'm still "wet behind the ears" on this so I don't quite
understand what you mean by "stored data" ;  and what does the "id"
(id==$row?"selected":"") mean?
I get the idea that this might be translated into something in the code
I have dreamed up - further down.

echo "", $row['category'], "";
I suppose that I must add an if clause to insert the selected option for
the categories that are relevant...


Gentlemen,
I have been diligently studying all this and have just returned my
attention to the list, so I've read the replies/inputs and now comment:

BTW, I had some problems with the multiple statement - it does not take
any parameters; it must simply be stated multiple without quotes.

Now, I was happy to learn that it is simpler to populate the insert new
books page dynamically from the db. Much shorter & neater.
It looks to me like the best solution for the edit page is close to what
Yuri suggests.
Since the edit page is very similar to the insert new books page, I
merely need to populate the Select options box slightly differently.
This is the code to populate the insert page:

", $row['category'],
"";
}
}
?>


The problem nowis to find a way to add a conditional clause above that
will insert the option="selected" in the output.
The input for this comes from:
// do categories
$sql = "SELECT id, category FROM categories, book_categories
WHERE book_categories.bookID = $idIN &&
book_categories.categories_id = categories.id";;
if ( ( $results = mysql_query($sql, $db) ) !== false ) {
while ( $row = mysql_fetch_assoc($results) ) {
echo$row['id'], "";
}
}

This may return any number of category ids so the problem is to figure
out a way to pass the ids from the above code to the right ids in the
first code above.
How & what do I search to match the two ids?

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] how to extract fields from associative array into different variables

2009-06-16 Thread PJ
Ford, Mike wrote:
> On 15 June 2009 18:07, PJ advised:
>
>   
>> Is there an easier or simpler way to do this?
>> code:
>>
>> $sql = "SELECT first_name, last_name, book_author.ordinal
>>   FROM author, book_author
>>   WHERE book_author.bookID = $idIN && book_author.authID =
>> 
> author.id
>   
>> ORDER BY ordinal";
>>
>> $author = array();
>> if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>> while ( $row = mysql_fetch_array($results, MYSQL_ASSOC) ) {
>> 
>
>   
>> $author[] = $row; }
>> }
>> $numrows = mysql_num_rows($results);
>> switch ($numrows)
>> {
>> case 5:
>>   $first_nameIN = $author[0]['first_name'];
>>   $last_nameIN = $author[0]['last_name'];
>>   $first_name2IN = $author[1]['first_name'];
>>   $last_name2IN = $author[1]['last_name'];
>>   $first_name3IN = $author[2]['first_name'];
>>   $last_name3IN = $author[2]['last_name'];
>>   $first_name4IN = $author[3]['first_name'];
>>   $last_name4IN = $author[3]['last_name'];
>>   $first_name5IN = $author[4]['first_name'];
>>   $last_name5IN = $author[4]['last_name'];
>>   break;
>> case 4:
>>   $first_nameIN = $author[0]['first_name'];
>>   $last_nameIN = $author[0]['last_name'];
>> snip
>> 
>
> Why not just use $author[0]['first_name'] instead of $first_nameIN (and
> so on) in the rest of your code?
Duh, I think I learned something here... it works! Thank you a
zillion ;-)

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] how to extract fields from associative array into different variables

2009-06-16 Thread PJ
Ford, Mike wrote:
> On 15 June 2009 18:07, PJ advised:
>
>   
>> Is there an easier or simpler way to do this?
>> code:
>>
>> $sql = "SELECT first_name, last_name, book_author.ordinal
>>   FROM author, book_author
>>   WHERE book_author.bookID = $idIN && book_author.authID =
>> 
> author.id
>   
>> ORDER BY ordinal";
>>
>> $author = array();
>> if ( ( $results = mysql_query($sql, $db) ) !== false ) {
>> while ( $row = mysql_fetch_array($results, MYSQL_ASSOC) ) {
>> 
>
>   
>> $author[] = $row; }
>> }
>> $numrows = mysql_num_rows($results);
>> switch ($numrows)
>> {
>> case 5:
>>   $first_nameIN = $author[0]['first_name'];
>>   $last_nameIN = $author[0]['last_name'];
>>   $first_name2IN = $author[1]['first_name'];
>>   $last_name2IN = $author[1]['last_name'];
>>   $first_name3IN = $author[2]['first_name'];
>>   $last_name3IN = $author[2]['last_name'];
>>   $first_name4IN = $author[3]['first_name'];
>>   $last_name4IN = $author[3]['last_name'];
>>   $first_name5IN = $author[4]['first_name'];
>>   $last_name5IN = $author[4]['last_name'];
>>   break;
>> case 4:
>>   $first_nameIN = $author[0]['first_name'];
>>   $last_nameIN = $author[0]['last_name'];
>> snip
>> 
>
> Why not just use $author[0]['first_name'] instead of $first_nameIN (and
> so on) in the rest of your code?
>
>   
I probably should have explained in greater detail: there are up to 5
authors for each book in the db and the insert and update fields in the
form input needs the different variables as each author is treated
separately. I'm not sure if there is another way to do it.

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] how to extract fields from associative array into different variables

2009-06-16 Thread PJ
Ashley Sheridan wrote:
> On Mon, 2009-06-15 at 17:38 -0400, PJ wrote:
>   
>> Jay Blanchard wrote:
>> 
>>> [snip]
>>> In what way would this simplify or ease my pain?
>>> The difficulty, it seems to me, is not in retrieving the rows, but
>>> rather how to pass the row data to the variables. And since the number
>>> of rows is variable, I believe that the only way to assign the variables
>>> is by use of a loop? I think I'm beating my head against the wall for
>>> nothing... :-(
>>> [/snip]
>>>
>>> You asked for easier. In this way the data is assigned to a usable
>>> variable right out of the gate and that is an array variable. You can
>>> actually use it with either mysql_fetch_array or mysql_fetch_row. 
>>>
>>> Here is your query;
>>>
>>> $sql = "SELECT first_name, last_name, book_author.ordinal
>>>   FROM author, book_author
>>>   WHERE book_author.bookID = $idIN && book_author.authID = author.id
>>> ORDER BY ordinal";
>>>
>>> You need not declare another array, but do it this way instead;
>>>
>>>if ($results = mysql_query($sql, $db)) {
>>> while ( $row = mysql_fetch_array($results, MYSQL_ASSOC) ) {
>>> echo $row['first_name'];
>>> echo $row['last_name'];
>>>   
>>>   
>> Then I have to add some loopy thing to assign the values to the
>> $variables... a real pita since my variable do not lend themselves too
>> well to linear alterations ($varIn, $var2IN, $var3IN... etc... so $i=0
>> and $i++ arren't going to be too cooperative here... I guess I'd have to
>> change that to $var1IN... and then figure out how to do $var.$i.IN ... I
>> already tried, but don't seem to have it right
>> 
>>> etcetera.
>>> }
>>> }
>>>
>>> The lazy part I will agree with :)
>>>   
>>>   
>> Well, I shouldn't say it, but laziness is a characteristic of
>> "intelligence": why do more than you have to when you can be doing
>> something else. Actually, I am anything but lazy, I spend innumerable
>> hours trying to understand what all this coding is about... searching
>> the web and rummaging (and I do mean "rummaging") in all the lists and
>> posts ... but just going through 20 or 30 listings out of more than
>> 20,000 is already taxing... much easier to ask on the list... if someone
>> can understand my fuzzy questions, they may find the grace and
>> generosity to take pity on the ignoramus... ;-)
>> And I enjoy the ribbing and the humour ... it's a really very nice list!
>>
>>
>> -- 
>> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
>> -
>> Phil Jourdan --- p...@ptahhotep.com
>>http://www.ptahhotep.com
>>http://www.chiccantine.com/andypantry.php
>>
>>
>> 
> Why do you need them in separate variables? Can't you use them using
> array syntax elsewhere in your code?
Basically, I don't know how else to handle inserting and updating random
number of authors. Each book in the db may have up to 5 authors. I
imagine there is a simpler way to do it; I just don't have the knowledge
or experience or the time to learn another way. I'd be happy to have you
look at the code and hear some feedback. It's probably a miracle that
the site is working... ;-)
Oh, it's www.ptahhotep.com - my daughter's egyptology site; I just
migrated from pure (almost) html to php/mysql/css and am just doing the
finishing touches now - the edit page.

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



[PHP] populate form input option dropdown box from existing data

2009-06-15 Thread PJ
I am having difficulties figuring out how enter retrieved data into a
dropdown box for editing. Here's a snippet:
...snip

Civilization
Monuments, Temples & Tombs
Pharaohs and Queens... snip

As I understand it, I need to put an array ( $categoriesIN[] ) somewhere
in the above code... or do I need to insert a series of value "selected"
fields for the values?
The closest thing to what I need, seems to be in this post:
http://www.hpfreaks.com/forums/index.php?topic=165215
But it doesn't appear too inviting... not sure if they ever got it to
work...

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] how to extract fields from associative array into different variables

2009-06-15 Thread PJ
Jay Blanchard wrote:
> [snip]
> In what way would this simplify or ease my pain?
> The difficulty, it seems to me, is not in retrieving the rows, but
> rather how to pass the row data to the variables. And since the number
> of rows is variable, I believe that the only way to assign the variables
> is by use of a loop? I think I'm beating my head against the wall for
> nothing... :-(
> [/snip]
>
> You asked for easier. In this way the data is assigned to a usable
> variable right out of the gate and that is an array variable. You can
> actually use it with either mysql_fetch_array or mysql_fetch_row. 
>
> Here is your query;
>
> $sql = "SELECT first_name, last_name, book_author.ordinal
>   FROM author, book_author
>   WHERE book_author.bookID = $idIN && book_author.authID = author.id
> ORDER BY ordinal";
>
> You need not declare another array, but do it this way instead;
>
>if ($results = mysql_query($sql, $db)) {
> while ( $row = mysql_fetch_array($results, MYSQL_ASSOC) ) {
> echo $row['first_name'];
>   echo $row['last_name'];
>   
Then I have to add some loopy thing to assign the values to the
$variables... a real pita since my variable do not lend themselves too
well to linear alterations ($varIn, $var2IN, $var3IN... etc... so $i=0
and $i++ arren't going to be too cooperative here... I guess I'd have to
change that to $var1IN... and then figure out how to do $var.$i.IN ... I
already tried, but don't seem to have it right
> etcetera.
> }
> }
>
> The lazy part I will agree with :)
>   
Well, I shouldn't say it, but laziness is a characteristic of
"intelligence": why do more than you have to when you can be doing
something else. Actually, I am anything but lazy, I spend innumerable
hours trying to understand what all this coding is about... searching
the web and rummaging (and I do mean "rummaging") in all the lists and
posts ... but just going through 20 or 30 listings out of more than
20,000 is already taxing... much easier to ask on the list... if someone
can understand my fuzzy questions, they may find the grace and
generosity to take pity on the ignoramus... ;-)
And I enjoy the ribbing and the humour ... it's a really very nice list!


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] how to extract fields from associative array into different variables

2009-06-15 Thread PJ
Jay Blanchard wrote:
> [snip]
> Is there an easier or simpler way to do this?
> [/snip]
>
> http://us2.php.net/manual/en/function.mysql-fetch-row.php
>   
In what way would this simplify or ease my pain?
The difficulty, it seems to me, is not in retrieving the rows, but
rather how to pass the row data to the variables. And since the number
of rows is variable, I believe that the only way to assign the variables
is by use of a loop? I think I'm beating my head against the wall for
nothing... :-(
I know I'm a newbie (a very lazy and ignorant one, apparently) but I
don't quite understand. Or is there a gain in execution time or resource
usage?


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



[PHP] how to extract fields from associative array into different variables

2009-06-15 Thread PJ
Is there an easier or simpler way to do this?
code:

$sql = "SELECT first_name, last_name, book_author.ordinal
  FROM author, book_author
  WHERE book_author.bookID = $idIN && book_author.authID = author.id
ORDER BY ordinal";

$author = array();
if ( ( $results = mysql_query($sql, $db) ) !== false ) {
while ( $row = mysql_fetch_array($results, MYSQL_ASSOC) ) {
$author[] = $row;
}
}
$numrows = mysql_num_rows($results);
switch ($numrows)
{
case 5:
  $first_nameIN = $author[0]['first_name'];
  $last_nameIN = $author[0]['last_name'];
  $first_name2IN = $author[1]['first_name'];
  $last_name2IN = $author[1]['last_name'];
  $first_name3IN = $author[2]['first_name'];
  $last_name3IN = $author[2]['last_name'];
  $first_name4IN = $author[3]['first_name'];
  $last_name4IN = $author[3]['last_name'];
  $first_name5IN = $author[4]['first_name'];
  $last_name5IN = $author[4]['last_name'];
  break;
case 4:
  $first_nameIN = $author[0]['first_name'];
  $last_nameIN = $author[0]['last_name'];
snip

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] how to pass a number through href url?

2009-06-13 Thread PJ
Stuart wrote:
> 2009/6/13 PJ :
>   
>> I wish to be able to edit db field that is displayed in a page by
>> calling up another page to handle the editing.
>> The problem is how to pass the id (number) through an href. In other
>> words, can the number be included in the uri  and then filter the uri to
>> leave just the number?
>> Is something like this at all possible?
>> 
>
> Oh dear $DEITY. Please find a beginners tutorial to PHP and complete
> it before asking questions on this list.
>
> http://www.example.com/index.php?id=12345
>
> will give you
>
> $_GET['id'] == 12345
>
> -Stuart
>
> Thank you, Stuart.  ;-) 


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



[PHP] how to pass a number through href url?

2009-06-13 Thread PJ
I wish to be able to edit db field that is displayed in a page by
calling up another page to handle the editing.
The problem is how to pass the id (number) through an href. In other
words, can the number be included in the uri  and then filter the uri to
leave just the number?
Is something like this at all possible?

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] 3d image rotating

2009-06-13 Thread PJ
דניאל דנון wrote:
> Hello.
>
> I'm looking for way to rotate normal images, but not x/y, but with Z also.
> I get a source image (png, jpg, gif...) and I want to rotate it. assuming
> the "depth" of the image is 1 pixel for example...
>
> I'm looking for a way to do it without using imagemagick - only GD. I know
> it might be slower, but its need to run on a server without imagemagick.
>
> I've searched information about it, also in PEAR, but I couldn't find
> anything that takes a normal image and rotate it..
>
> Thanks, Daniel
>
>   
Hi Daniel,
I had the same question a short while ago and the only answer I could
find was to redo the image with either gimp or PhotoShop an save it as
png 8 with transparency. The only downside is that this seems to leave
the angled frame (if you use one) a bit scuzzy; but you dont need Z. The
other downside is that you can't dynamically rotate the image. Of
course, I am assuming that by "rotate" you mean turn it at an angle and
not "replace by other images".
HTH
Phil

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] order by what?

2009-06-11 Thread PJ
Robin Vickery wrote:
>
>
> 2009/6/11 PJ mailto:af.gour...@videotron.ca>>
>
> How can order by be forced to order alphabetically and ignore accents
> without stripping the accents for printout? This is a problem for both
> caps & normal letters.
>
>
> Depends on the database.
>
> If you're using mysql, the order is governed by the collation used. To
> get the order you want, you need a case-insensitive and
> accent-insensitive collation. Exactly which one you use will depend on
> the character set that you're using, but if you're character set is
> utf8, then the utf8_general_ci collation should work:
>
> SELECT fieldname FROM tablename ORDER BY fieldname COLLATE
> utf8_general_ci;
>
> -robin
Obviously there is another solution, albeit rather silly: re-enter all
the fields in alphabetical order with corresponding id fields in
numerical order... great, if you're not going to change the list and if
it's quite short... not too clever, though is it?

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] order by what?

2009-06-11 Thread PJ
Robin Vickery wrote:
>
>
> 2009/6/11 PJ mailto:af.gour...@videotron.ca>>
>
> How can order by be forced to order alphabetically and ignore accents
> without stripping the accents for printout? This is a problem for both
> caps & normal letters.
>
>
> Depends on the database.
>
> If you're using mysql, the order is governed by the collation used. To
> get the order you want, you need a case-insensitive and
> accent-insensitive collation. Exactly which one you use will depend on
> the character set that you're using, but if you're character set is
> utf8, then the utf8_general_ci collation should work:
>
> SELECT fieldname FROM tablename ORDER BY fieldname COLLATE
> utf8_general_ci;
>
> -robin
Nice thought, Robin. My collation is already uft8_general_ci.
Adding that condition to the query changes nothing; and specifying
another collation return a blank or null and the list is not echoed.
Even changing the collation in the db does not change anything. Same
wrong results.
Thanks anyway.

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] order by what?

2009-06-11 Thread PJ
Jay Blanchard wrote:
> [snip]
>   
>> [snip]
>> How can order by be forced to order alphabetically and ignore accents
>> without stripping the accents for printout? This is a problem for both
>> caps & normal letters.
>> [/snip]
>>
>> Definitely an SQL question. What character set are you using in your
>> database? Is the accent the first character of the string or is this a
>> multi-byte character? 
>>   
>> 
> utf8 general
> the accents are French - including first character and others in the
> words...
> e.g. Érable comes up before Autres; and Céréales appears before Café...
> I imagine it's a collation (character set) problem. I don't know what to
> use to eliminate this problem. Should the collation be latin1 swedish_ci
> ? I have never received a definitive response even on this list. :-(
> And this is an ever recurring problem as I work with several languages
> which all have accents...
> [/snip]
>
> Have you considered asking on the list of the database of your choice? Like 
> the MySQL list? 
>
>   
They're not as nice as the guys on this list... usually ;-)

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] order by what?

2009-06-11 Thread PJ
PJ wrote:
> Jay Blanchard wrote:
>   
>> [snip]
>> How can order by be forced to order alphabetically and ignore accents
>> without stripping the accents for printout? This is a problem for both
>> caps & normal letters.
>> [/snip]
>>
>> Definitely an SQL question. What character set are you using in your
>> database? Is the accent the first character of the string or is this a
>> multi-byte character? 
>>   
>> 
> utf8 general
> the accents are French - including first character and others in the
> words...
> e.g. Érable comes up before Autres; and Céréales appears before Café...
> I imagine it's a collation (character set) problem. I don't know what to
> use to eliminate this problem. Should the collation be latin1 swedish_ci
> ? I have never received a definitive response even on this list. :-(
> And this is an ever recurring problem as I work with several languages
> which all have accents...
>   
There are some options which all need some sort of adjustment.
If , e.g. É is used in the db instead of É the output onscreen is
a little black diamond with a quesion mark inside. The order is correct,
but the diamond is not acceptable... obviously, one cannot expect people
to change their browser or whatever adjustments just for my little diamonds.
Again, it probably means changing the collation - but where, in my database?
TIA

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] order by what?

2009-06-11 Thread PJ
Jay Blanchard wrote:
> [snip]
> How can order by be forced to order alphabetically and ignore accents
> without stripping the accents for printout? This is a problem for both
> caps & normal letters.
> [/snip]
>
> Definitely an SQL question. What character set are you using in your
> database? Is the accent the first character of the string or is this a
> multi-byte character? 
>   
utf8 general
the accents are French - including first character and others in the
words...
e.g. Érable comes up before Autres; and Céréales appears before Café...
I imagine it's a collation (character set) problem. I don't know what to
use to eliminate this problem. Should the collation be latin1 swedish_ci
? I have never received a definitive response even on this list. :-(
And this is an ever recurring problem as I work with several languages
which all have accents...


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



[PHP] order by what?

2009-06-11 Thread PJ
How can order by be forced to order alphabetically and ignore accents
without stripping the accents for printout? This is a problem for both
caps & normal letters.

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] how to get rid of that annoying |

2009-06-08 Thread PJ
Robert Cummings wrote:
>
>
> PJ wrote:
>> Robert Cummings wrote:
>>> PJ wrote:
>>>> Robert Cummings wrote:
>>>>> PJ wrote:
>>>>>> I know this a silly question, but I can't figure out if it's even
>>>>>> possible to get rid of that final annoying | in my pagination
>>>>>> script.
>>>>>>
>>>>>> Navigation";
>>>>>>
>>>>>> echo (($page !=1)?"first":"first")." ... ";
>>>>>> echo (($page>1)?"prev":"prev")." | ";
>>>>>> for($i=$page; $i<=($page+$records_per_page-2)+1; $i++){
>>>>>>   if ($i!=$page && $i>>>>> echo "$i", "
>>>>>> | ";
>>>>>>   elseif ($i>ceil($count/$records_per_page))
>>>>>> continue;
>>>>>>   else echo $i, " | ";
>>>>>> }
>>>> ---|
>>>>>> echo " | ... ".(($page<$count)?"next":"next");
>>>>>> echo "  ... ".(($page<$count)?"last":"last");
>>>>>> //echo "Table Order";
>>>>>> echo "Ordered alphabetically by book title : ";
>>>>>> echo $dir=="ASC"?"Ascending":"Ascending";
>>>>>> echo " | ";
>>>>>> echo $dir=="DESC"?"Descending":"Descending";
>>>>>> echo "";?>
>>>>>>
>>>>>> This produces a very nifty pagination - the problem is how to get
>>>>>> rid of
>>>>>> the final pages that show up as greater than what is available. The
>>>>>> script above works fine, except it leaves that final | ...
>>>>>> Any simple solutions?
>>>>>>
>>>>> Do it differently... build an array of the appropriate entries. When
>>>>> done, use implode( ' | ', $yourArray ).
>>>>>
>>>>> Cheers,
>>>>> Rob.
>>>> Hate to disappoint you all, but I finally found the errant | .
>>>> Ridiculous, really, that I bothered you all.
>>>> it's in the line indicated above --- echo " | ... " --- lose the | and
>>>> it all works like a charm.
>>>>
>>>> :-) ;-)
>>> You didn't disappoint me... I've seen code like that before, I just
>>> thought you'd benefit from a cleaner approach instead of the above
>>> mess.
>> Actually, as I am new to this, I still have another little glitch which
>> is a pita. Oh, I know it's a bit of a mess; I have a hard time
>> following, myself. But, being lazy, I'm trying to fix thigs with a
>> band-aid. :-(
>>
>> But I don't understand how I would "build an array of the appropriate
>> entries"... what entries do you mean?
>
> You have links, each separated by the pipe '|' character. Add each
> link to a links array:
>
> 
> $links = array();
> foreach( $items as $item )
> {
> $links[] = ''.$item.'';
> }
>
> echo implode( ' | ', $links );
>
> ?>
>
> Hope that helps.
I'm afraid I still don't understand. I think you are seeing something
that I don't see. What do you mean by link in the present context... are
you talking about some snippet of code equaling each page or every page
in the db? This is an ever growing db.

Anyway, I finally found the error of my ways (at least in this code). It
may look sloppy, but then I haven't looked that hard for other examples.
Some I found were too simple, others too bloated.
At least, this one works for what I need and does exactly what I wanted.
:-)
Here's the final fixed code; some obvious (I hope) variables are left
out and precede the code:

echo (($page !=1)?"first":"first")." ... ";
echo (($page>1)?"prev":"prev")." | ";
for($i=$page; $i<=($page+$records_per_page-2)+1; $i++){
  if ($i>ceil($count/$records_per_page))
continue;
  elseif ($i!=$page)
echo "$i", " | ";
  else
echo $i, " | ";
}
echo " ... ".(($pagenext":"next");
if ($page==ceil($count/$records_per_page))
  echo " ... last";
elseif ($i!=ceil($count/$records_per_page)) echo "  ...
".(($pagelast":"last");
else echo "  ... ".(($page<$count)?"last":"last");
echo "Ordered alphabetically by book title : ";
echo $dir=="ASC"?"Ascending":"Ascending";
echo " | ";
echo $dir=="DESC"?"Descending":"Descending";

If there is a way to simplify things, please do let me know (with an
example, please)
PJ



-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] how to get rid of that annoying |

2009-06-08 Thread PJ
Robert Cummings wrote:
> PJ wrote:
>> Robert Cummings wrote:
>>> PJ wrote:
>>>> I know this a silly question, but I can't figure out if it's even
>>>> possible to get rid of that final annoying | in my pagination script.
>>>>
>>>> Navigation";
>>>>
>>>> echo (($page !=1)?"first":"first")." ... ";
>>>> echo (($page>1)?"prev":"prev")." | ";
>>>> for($i=$page; $i<=($page+$records_per_page-2)+1; $i++){
>>>>   if ($i!=$page && $i>>> echo "$i", "
>>>> | ";
>>>>   elseif ($i>ceil($count/$records_per_page))
>>>> continue;
>>>>   else echo $i, " | ";
>>>> }
>> ---|
>>>> echo " | ... ".(($page<$count)?"next":"next");
>>>> echo "  ... ".(($page<$count)?"last":"last");
>>>> //echo "Table Order";
>>>> echo "Ordered alphabetically by book title : ";
>>>> echo $dir=="ASC"?"Ascending":"Ascending";
>>>> echo " | ";
>>>> echo $dir=="DESC"?"Descending":"Descending";
>>>> echo "";?>
>>>>
>>>> This produces a very nifty pagination - the problem is how to get
>>>> rid of
>>>> the final pages that show up as greater than what is available. The
>>>> script above works fine, except it leaves that final | ...
>>>> Any simple solutions?
>>>>
>>>
>>> Do it differently... build an array of the appropriate entries. When
>>> done, use implode( ' | ', $yourArray ).
>>>
>>> Cheers,
>>> Rob.
>> Hate to disappoint you all, but I finally found the errant | .
>> Ridiculous, really, that I bothered you all.
>> it's in the line indicated above --- echo " | ... " --- lose the | and
>> it all works like a charm.
>>
>> :-) ;-)
>
> You didn't disappoint me... I've seen code like that before, I just
> thought you'd benefit from a cleaner approach instead of the above mess.
Actually, as I am new to this, I still have another little glitch which
is a pita. Oh, I know it's a bit of a mess; I have a hard time
following, myself. But, being lazy, I'm trying to fix thigs with a
band-aid. :-(

But I don't understand how I would "build an array of the appropriate
entries"... what entries do you mean?


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] how to get rid of that annoying |

2009-06-08 Thread PJ
Robert Cummings wrote:
> PJ wrote:
>> I know this a silly question, but I can't figure out if it's even
>> possible to get rid of that final annoying | in my pagination script.
>>
>> Navigation";
>>
>> echo (($page !=1)?"first":"first")." ... ";
>> echo (($page>1)?"prev":"prev")." | ";
>> for($i=$page; $i<=($page+$records_per_page-2)+1; $i++){
>>   if ($i!=$page && $i> echo "$i", "
>> | ";
>>   elseif ($i>ceil($count/$records_per_page))
>> continue;
>>   else echo $i, " | ";
>> }
---|
>> echo " | ... ".(($page<$count)?"next":"next");
>> echo "  ... ".(($page<$count)?"last":"last");
>> //echo "Table Order";
>> echo "Ordered alphabetically by book title : ";
>> echo $dir=="ASC"?"Ascending":"Ascending";
>> echo " | ";
>> echo $dir=="DESC"?"Descending":"Descending";
>> echo "";?>
>>
>> This produces a very nifty pagination - the problem is how to get rid of
>> the final pages that show up as greater than what is available. The
>> script above works fine, except it leaves that final | ...
>> Any simple solutions?
>>
>
>
> Do it differently... build an array of the appropriate entries. When
> done, use implode( ' | ', $yourArray ).
>
> Cheers,
> Rob.
Hate to disappoint you all, but I finally found the errant | .
Ridiculous, really, that I bothered you all.
it's in the line indicated above --- echo " | ... " --- lose the | and
it all works like a charm.

:-) ;-)

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



[PHP] how to get rid of that annoying |

2009-06-08 Thread PJ
I know this a silly question, but I can't figure out if it's even
possible to get rid of that final annoying | in my pagination script.

Navigation";

echo (($page !=1)?"first":"first")." ... ";
echo (($page>1)?"prev":"prev")." | ";
for($i=$page; $i<=($page+$records_per_page-2)+1; $i++){
  if ($i!=$page && $i$i", " | ";
  elseif ($i>ceil($count/$records_per_page))
continue;
  else echo $i, " | ";
}
echo " | ... ".(($page<$count)?"next":"next");
echo "  ... ".(($page<$count)?"last":"last");
//echo "Table Order";
echo "Ordered alphabetically by book title : ";
echo $dir=="ASC"?"Ascending":"Ascending";
echo " | ";
echo $dir=="DESC"?"Descending":"Descending";
echo "";?>

This produces a very nifty pagination - the problem is how to get rid of
the final pages that show up as greater than what is available. The
script above works fine, except it leaves that final | ...
Any simple solutions?

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] formatting - design question

2009-06-08 Thread PJ
Ford, Mike wrote:
> On 04 June 2009 19:09, PJ advised:
>
>   
>> Nitsan Bin-Nun wrote:
>> 
>>>> From my experience I tend to use a difference ID for the
>>>> 
>> body tag, for
>> 
>>> instance  and then format it in my CSS using ID
>>> reference: #homepage .classname {
>>>   color: blue;
>>> }
>>>
>>> This way you can use a default format for all the pages and create
>>>   
> minor
>   
>>> (or major) changes in the theme in no time :)
>>>
>>> I would also suggest to attach the CSS filename reference at the
>>>   
> 
>   
>>> tag the update time of the file, so that the browser will
>>>   
> automatically
>   
>>> update the cache of the CSS whenever you decide to edit it.
>>>
>>> Just my 2 cents ;)
>>>
>>>   
>> Oh, I think it's worth a lot more than that.
>> I just installed IE 8 just to have it for verification. It's no better
>> than IE 6. I never use them personally.
>> But how do you produce interesting web pages to look well on both
>> without making stupid compromises. What looks well on Firefox, looks
>> 
> like
>   
>> MSshit on IE. 
>> 
>
> This may be a silly question, but reading this just makes me wonder --
> you do have an appropriate  to prevent IE going into Quirks Mode?
>   
I do, thanks. PJ
> I don't usually have *that* much trouble getting IE to render very
> similarly to Firefox (and IE8 is reportedly much better), but if IE is
> in Quirks Mode it makes a huge difference and presents all sorts of
> rendering problems. (The Firefox Web Developer plugin will tell you if a
> page is rendering in Quirks Mode or Standards Compliance Mode.)
>
> Cheers!
>
> Mike
>
>  --
> Mike Ford,  Electronic Information Developer,
> C507, Leeds Metropolitan University, Civic Quarter Campus, 
> Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom
> Email: m.f...@leedsmet.ac.uk
> Tel: +44 113 812 4730
>
>
> To view the terms under which this email is distributed, please go to 
> http://disclaimer.leedsmet.ac.uk/email.htm
>
>   


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] https setup

2009-06-05 Thread PJ
Shanon Swafford wrote:
>> -Original Message-
>> From: PJ [mailto:af.gour...@videotron.ca] 
>> Sent: Thursday, June 04, 2009 3:59 PM
>> To: php-general@lists.php.net
>> Subject: [PHP] https setup
>>
>> Can't find anything on G or web - but I probably didn't try hard enough.
>> I am unable to set my virtual hosts to handle https.
>> I have apache22, mod_ssl, opnenssl and the httpd and httpd-vhosts.conf
>> files are set up "correctly" but directing a sensitive user information
>> page to an HTTPS page returns an error of "not found". The virtual hosts
>> works fine, except for HTTPS.
>> This is on my intranet for local developing.
>> TIA
>> 
>
> 
> -
>
> >From what I've found, it doesn't work like http.  You can NOT do virtual
> hosts via https with apache listening on the same IP AND PORT.  Something
> about the encrypted session is set up before the domain is analyzed by
> apache.
>
> You have to have a unique IP or PORT for each domain you want to serve with
> https.
>
> For example, if you want:
> https://example1.com
>  and
> https://example2.com
>
> all on the same http server, you have to either:
>
> assign a separate IP for each domain and let apache do the vhost by IP
>  or
> define a separate PORT for each domain and make apache do the vhost by PORT.
>
> If I'm wrong, somebody please let me know because I'd love to do vhosts like
> this as well.
>
> Regards,
> Shanon
>
>
>   
I solved my problem. Problem was unclear directions for setup;
httpd-ssl.conf and httpd-vhosts.conf were not properly explalin for
configuration. The secure setup is done in the ssl file with the 443
port and the same host is repeated in the vhost file.  I haven't
mentioned this, but my setup is with name-based vhosts, not address or
whatever...
So far as I can see, this should work fine for numerous hosts both on
whatever ports you choose plus the default 443 for ssl.
Don't forget, you have to have a certificate, real or dummy for this to
work. :-)


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] formatting - design question

2009-06-05 Thread PJ
Peter Ford wrote:
> PJ wrote:
>   
>> tedd wrote:
>> 
>>> At 3:58 PM -0400 6/4/09, PJ wrote:
>>>   
>>>> tedd wrote:
>>>>
>>>>  > Style sheets are meant simplify things so decide on how you want
>>>> 
>>>>>  things to look uniformly throughout your site and then stick with it.
>>>>>  There's really no good reason to keep changing things throughout a
>>>>> site.
>>>>>
>>>>>  Cheers,
>>>>>
>>>>>  tedd
>>>>>
>>>>>
>>>>>   
>>>> Maybe I'm just too complicated. ;-)
>>>> I do try to keep it simple. But then, little things creep in, like a
>>>> login box on the index page which mucks up all the other pages. Then
>>>> there is a recipe page which is totally different, yet to keep is
>>>> stylistically continuous it uses a similar layout to the other pages but
>>>> different. The same for the main recipe page, and the same for the
>>>> portraits of producers - all the pages are different yet remain within a
>>>> cohesive style. CSS gets super bloated and almost unamageable. Most
>>>> sites are very repetitive; mine tend to be "provocative" or semthing
>>>> like that. I really don't see an ooption. Although, Nitsan's body tags
>>>> sound promising. I'll have to try that; maybe the solution is to do a
>>>> series of definitions unique just fo certain pages. :-)
>>>> 
>>> That's simply an example of not thinking things out before you write
>>> the code.
>>>
>>> First you figure out a layout, then you populate it. You don't pick a
>>> layout, populate it and then change the layout. That leads to a
>>> lackluster and "lack of thought" site.
>>>
>>> Cheers,
>>>
>>> tedd
>>>
>>>
>>>   
>> If only it were that simple.
>> When one is developing, one is always changing. And even when you're
>> finally "live and on the air", you will still be changing or else your
>> site will die before your client gets a chance to see all you can offer.
>> It's a matter of evolution and adaptation, Darwin. ;-)
>>
>> 
>
> Agree with PJ here:
> More likely, you go live and the boss says "Can you make that look more like 
> ...?"
> "Er, yes, but it totally stuffs the whole design..."
>
> Evolution was *not* carefully thought out - that would be Intelligent Design 
> 
>   
Chuckle, chuckle. ;-)

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] https setup

2009-06-05 Thread PJ
Per Jessen wrote:
> PJ wrote:
>
>   
>> Can't find anything on G or web - but I probably didn't try hard
>> enough. 
>> 
>
> Correct :-)
>
>   
>> I am unable to set my virtual hosts to handle https. 
>> I have apache22, mod_ssl, opnenssl and the httpd and httpd-vhosts.conf
>> files are set up "correctly" but directing a sensitive user
>> information page to an HTTPS page returns an error of "not found". The
>> virtual hosts works fine, except for HTTPS.
>> This is on my intranet for local developing.
>> 
>
> Is your webserver listening for https requests?  Port 443, check it
> with "netstat -ltn".  Or check your "listen.conf" file.
>
> /Per
>
>   
Thanks for responding.
The problem was muddy instructions for the setup. I finally figure it out.

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] https setup

2009-06-05 Thread PJ
Michael A. Peters wrote:
> PJ wrote:
>> Can't find anything on G or web - but I probably didn't try hard enough.
>> I am unable to set my virtual hosts to handle https.
>> I have apache22, mod_ssl, opnenssl and the httpd and httpd-vhosts.conf
>> files are set up "correctly" but directing a sensitive user information
>> page to an HTTPS page returns an error of "not found". The virtual hosts
>> works fine, except for HTTPS.
>> This is on my intranet for local developing.
>> TIA
>>
>
> By "not found" do you mean a 404 error from the https domain?
> If so, then you probably just have the DocumentRoot directive set up
> incorrectly for your secure domain.
>
The problem was and remains in httpd-ssl.conf. It is not at all  clear
how the ssl.conf and the vhosts.conf files are related. The same site is
entered in https-ssl.conf and in httpd-vhosts.conf but uner different
ports *:80 and :*:443.
What is rather annoying is that in the ssl-conf file there is a dummy
setup but it does not indicate that this is what you have to change -
rather than the vhosts file. Nothing like having the blind leading the
blind. ;-)
I solved my immediate problem by modifying the httpd-ssl.conf file; up
to then I understood that the the configuration for vhosts depended on
the port where vhosts was pointing. Now, what is not clear is whether I
need to add more entries in the httpd-ssl.conf file for the other sites;
I would assume yes.
Thanks for responding. PJ

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



[PHP] https setup

2009-06-04 Thread PJ
Can't find anything on G or web - but I probably didn't try hard enough.
I am unable to set my virtual hosts to handle https.
I have apache22, mod_ssl, opnenssl and the httpd and httpd-vhosts.conf
files are set up "correctly" but directing a sensitive user information
page to an HTTPS page returns an error of "not found". The virtual hosts
works fine, except for HTTPS.
This is on my intranet for local developing.
TIA

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] formatting - design question

2009-06-04 Thread PJ
tedd wrote:
> At 3:58 PM -0400 6/4/09, PJ wrote:
>> tedd wrote:
>>
>>  > Style sheets are meant simplify things so decide on how you want
>>>  things to look uniformly throughout your site and then stick with it.
>>>  There's really no good reason to keep changing things throughout a
>>> site.
>>>
>>>  Cheers,
>>>
>>>  tedd
>>>
>>>
>> Maybe I'm just too complicated. ;-)
>> I do try to keep it simple. But then, little things creep in, like a
>> login box on the index page which mucks up all the other pages. Then
>> there is a recipe page which is totally different, yet to keep is
>> stylistically continuous it uses a similar layout to the other pages but
>> different. The same for the main recipe page, and the same for the
>> portraits of producers - all the pages are different yet remain within a
>> cohesive style. CSS gets super bloated and almost unamageable. Most
>> sites are very repetitive; mine tend to be "provocative" or semthing
>> like that. I really don't see an ooption. Although, Nitsan's body tags
>> sound promising. I'll have to try that; maybe the solution is to do a
>> series of definitions unique just fo certain pages. :-)
>
> That's simply an example of not thinking things out before you write
> the code.
>
> First you figure out a layout, then you populate it. You don't pick a
> layout, populate it and then change the layout. That leads to a
> lackluster and "lack of thought" site.
>
> Cheers,
>
> tedd
>
>
If only it were that simple.
When one is developing, one is always changing. And even when you're
finally "live and on the air", you will still be changing or else your
site will die before your client gets a chance to see all you can offer.
It's a matter of evolution and adaptation, Darwin. ;-)

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] formatting - design question

2009-06-04 Thread PJ
tedd wrote:
> At 2:08 PM -0400 6/4/09, PJ wrote:
>> Nitsan Bin-Nun wrote:
>>>  >From my experience I tend to use a difference ID for the body tag,
>>> for
>>>  instance  and then format it in my CSS using ID
>>>  reference:
>>>  #homepage .classname {
>>>color: blue;
>>>  }
>>>
>>>  This way you can use a default format for all the pages and create
>>> minor (or
>>>  major) changes in the theme in no time :)
>>>
>>>  I would also suggest to attach the CSS filename reference at the
>>>  tag
>>>  the update time of the file, so that the browser will automatically
>>> update
>>>  the cache of the CSS whenever you decide to edit it.
>>>
>>>  Just my 2 cents ;)
>>>  
>> Oh, I think it's worth a lot more than that.
>> I just installed IE 8 just to have it for verification. It's no better
>> than IE 6. I never use them personally.
>> But how do you produce interesting web pages to look well on both
>> without making stupid compromises. What looks well on Firefox, looks
>> like MSshit on IE.
>
> The way you do it is to keep it simple.
>
> If you use a different style sheet for every page, then not only does
> that cause more load times, but it confuses the Hell out of things, in
> my opinion.
>
> Style sheets are meant simplify things so decide on how you want
> things to look uniformly throughout your site and then stick with it.
> There's really no good reason to keep changing things throughout a site.
>
> Cheers,
>
> tedd
>
>
Maybe I'm just too complicated. ;-)
I do try to keep it simple. But then, little things creep in, like a
login box on the index page which mucks up all the other pages. Then
there is a recipe page which is totally different, yet to keep is
stylistically continuous it uses a similar layout to the other pages but
different. The same for the main recipe page, and the same for the
portraits of producers - all the pages are different yet remain within a
cohesive style. CSS gets super bloated and almost unamageable. Most
sites are very repetitive; mine tend to be "provocative" or semthing
like that. I really don't see an ooption. Although, Nitsan's body tags
sound promising. I'll have to try that; maybe the solution is to do a
series of definitions unique just fo certain pages. :-)

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] formatting - design question

2009-06-04 Thread PJ
Nitsan Bin-Nun wrote:
> >From my experience I tend to use a difference ID for the body tag, for
> instance  and then format it in my CSS using ID
> reference:
> #homepage .classname {
>   color: blue;
> }
>
> This way you can use a default format for all the pages and create minor (or
> major) changes in the theme in no time :)
>
> I would also suggest to attach the CSS filename reference at the  tag
> the update time of the file, so that the browser will automatically update
> the cache of the CSS whenever you decide to edit it.
>
> Just my 2 cents ;)
>   
Oh, I think it's worth a lot more than that.
I just installed IE 8 just to have it for verification. It's no better
than IE 6. I never use them personally.
But how do you produce interesting web pages to look well on both
without making stupid compromises. What looks well on Firefox, looks
like MSshit on IE.

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



[PHP] formatting - design question

2009-06-04 Thread PJ
This may not be strictly php but I think is may be relevant.
Were I to use a different css file for every page (that is slightly
different), would that affect performance?
It seems to me that might be a way of simplifying and certainly speeding
up development (design-wise, anyway) when using css. A different css
file for different pages would certainly make it a breeze to design a
page; otherwise it is hell to try to put all formatting in one file - it
even tends to get fairly bloated and difficult to follow your own shadow.

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] forms problem

2009-06-04 Thread PJ
Shawn McKenzie wrote:
> PJ wrote:
>   
>> AngeloZanetti wrote:
>> 
>>> Shawn McKenzie wrote:
>>>
>>>   
>>>> PJ wrote:
>>>>
>>>> 
>>>>> PROBLEM 1 solved: errant s removed; strange that they were
>>>>>  inhibiting entry of data into form field?
>>>>>
>>>>> PROBLEM 2 not resolved: but the form was off the page and
>>>>> clipped in upper right hand corner. What can be done to get it
>>>>> to show correctly?
>>>>>
>>>>>
>>>>>   
>>>> Remove the link to any stylesheets that you're using and see what
>>>> it looks like.
>>>>
>>>>
>>>>
>>>>
>>>> 
>>> Where is your source code / form so we can see what is going on?
>>>
>>> http://www.Elemental.co.za http://www.Elemental.co.za 
>>> http://www.wapit.co.za http://www.wapit.co.za
>>>
>>>   
>> The code: ...snip  > method="post" action=""> 
>> accès client > value="" size="10" /> mot de passe > />> size="10" /> > value="  entrez " /> > href="inscription.php"> Inscription   >
>> I had posted this earlier... just before finding the blockage for the
>> input in PROBLEM 1, though I don't know why some stray s would
>> cause that.
>>
>>
>> 
>
> Based on the fact that you said things were "off the page and clipped in
> the upper right hand corner", I thought that you had a style that may
> have positioned the div or the form or something.  If you disable all
> styles, whether in the head of the document or via an external
> stylesheet, then that should show the form on the page as it should.
 I think I didn't explain correctly; It does not appear on the page(IE
6) as it should & does in Firefox3.
The form is displayed but off-screen on startup; The page is set for a
width of 1025px but the display is probably about 900px so the form is
just off-screen to the right. But it is clipped in the middle and all
you see is the password and submit fields.
I suspect that the guilty party here is the CSS - I have the top margin
set to -100px in order to position it where I want it. I guess, I have
to find another way to position it. :-(

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] forms problem

2009-06-04 Thread PJ
Andrew Ballard wrote:
> On Wed, Jun 3, 2009 at 7:13 PM, PJ  wrote:
>   
>> Tom Chubb wrote:
>>     
>>> 2009/6/3 PJ :
>>>
>>>   
>>>> The code:
>>>> ...snip
>>>> 
>>>> Â  Â  Â  Â 
>>>> Â  Â  Â  Â  Â  Â accès client >>> name="title" value="" size="10" />
>>>> Â  Â  Â  Â  Â  Â mot de passe >>> value=">>> echo $passwd; ?>" size="10" />
>>>>            >>> value="      entrez     " />
>>>> Â  Â  Â  Â  Â  Â  Inscription 
>>>> Â  Â  Â  Â 
>>>> Â  Â >>> snip...
>>>>
>>>> PROBLEM 1: On Firefox3, the first input (accès client) does not accept
>>>> any input, does not show the cursor; the second input (mot de passe)
>>>> works fine.
>>>>
>>>> PROBLEM 2: The form does not appear on IE 6
>>>>
>>>> Running FreeBSD 7.1, apache22, php 5, using sessions, CSS
>>>>
>>>> Am I doing something wrong?
>>>>
>>>> --
>>>> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
>>>> -
>>>> Phil Jourdan --- p...@ptahhotep.com
>>>> Â  http://www.ptahhotep.com
>>>> Â  http://www.chiccantine.com/andypantry.php
>>>>
>>>>
>>>> --
>>>> PHP General Mailing List (http://www.php.net/)
>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>
>>>>
>>>>
>>>> 
>>> I think the first problem is because both your inputs are defined as 
>>> "title".
>>>
>>>   
>> Does that change anything in the functionanlity? If so, how?
>> Bastien says it works in IE8; here it does not in IE6. :-)
>>
>> 
>
> I'm not sure about functionanlity, but it definitely changes the
> functionality. ;-) 
>
> It means that regardless of whether someone is able to enter a value
> in the field you have labeled "accès client", your PHP page will never
> see it because it will look at the value from the field you have
> labeled "mot de passe", even if it is left blank. And that is true
> regardless of which browser they are using. In some scripting platform
> other than PHP, or if you process the raw post data yourself it could
> be different, but in PHP the variable $_POST['title'] will only have
> one value in it, and it will be the last one passed by the form. (In
> this case, "mot de passe".)
>
> Andrew
>   
Thanks Andrew, I hadn't gotten that far and had not thought about
that... it's a wake-up call for me. Glad to learn that. PJ

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] forms problem

2009-06-03 Thread PJ
AngeloZanetti wrote:
>
> Shawn McKenzie wrote:
>   
>> PJ wrote:
>> 
>>> PROBLEM 1 solved: errant s removed; strange that they were
>>> inhibiting entry of data into form field?
>>>
>>> PROBLEM 2 not resolved: but the form was off the page and clipped in
>>> upper right hand corner. What can be done to get it to show correctly?
>>>
>>>   
>> Remove the link to any stylesheets that you're using and see what it
>> looks like.
>>
>>
>>
>> 
>
> Where is your source code / form so we can see what is going on?
>
> http://www.Elemental.co.za http://www.Elemental.co.za 
> http://www.wapit.co.za http://www.wapit.co.za 
>   

The code:
...snip

   
   accès client 
   mot de passe 
   
Inscription 
   
   s would cause that.


-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] forms problem

2009-06-03 Thread PJ
Tom Chubb wrote:
> 2009/6/3 PJ :
>   
>> The code:
>> ...snip
>> 
>>
>>accès client > name="title" value="" size="10" />
>>mot de passe 
>>> value="  entrez " />
>> Inscription 
>>
>>> snip...
>>
>> PROBLEM 1: On Firefox3, the first input (accès client) does not accept
>> any input, does not show the cursor; the second input (mot de passe)
>> works fine.
>>
>> PROBLEM 2: The form does not appear on IE 6
>>
>> Running FreeBSD 7.1, apache22, php 5, using sessions, CSS
>>
>> Am I doing something wrong?
>>
>> --
>> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
>> -
>> Phil Jourdan --- p...@ptahhotep.com
>>   http://www.ptahhotep.com
>>   http://www.chiccantine.com/andypantry.php
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>> 
>
> I think the first problem is because both your inputs are defined as "title".
>   
Does that change anything in the functionanlity? If so, how?
Bastien says it works in IE8; here it does not in IE6. :-)

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



[PHP] forms problem

2009-06-03 Thread PJ
PROBLEM 1 solved: errant s removed; strange that they were
inhibiting entry of data into form field?

PROBLEM 2 not resolved: but the form was off the page and clipped in
upper right hand corner. What can be done to get it to show correctly?

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



[PHP] forms problem

2009-06-03 Thread PJ
The code:
...snip


accès client 
mot de passe 

 Inscription 

http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



[PHP] rotate an image

2009-06-01 Thread PJ
Not replace images. R o t a t e... like 15 degrees clockwise???
I chacked the manual and what is suggested doesn't seem to want to work.
I have GD enabled, but all I get is a garbled output on the page.
Her's what was offered:
| |
I want to display an image rotated (canted, if you prefer) to the right
or left next to text.
There's not much (or too much) info on how to do this.
Obviously, I can resize, rotate and create a png file with transparent
bg... but why go through all that hassle?
Any ideas, anyone?

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



[PHP] backslashes, string replacement, mysql_real_escape_strings and languages

2009-05-30 Thread PJ
Ok, let's get this straightened out, please.
I'm coming up with little annoyances like text with é & the like
being displayed and not displayed, having to enter it to get it
displayed, and sometimes seeing the code rather than the accented character.
And then there is preg_replace! When I have to use foreign characters
and I often do in several languages, preg removes the & and the spaces
that I don't want in a string but it also replaces the foreign language
accent formatting(e.g. î with icirc). Now that is annoying. I then
have to replace the space&space with space/space and omit the
preg_replace. That's a workaround... but that prevents filtering out
lost spaces. And how does all that relate to latin1 and utf8_general?
I'm setting up my databases with utf8_general... so, now what? Should I
be reverting to latin1(or is it 15) I don't recall... Is there a way to
fix this cross language problem?
Ooooh, boy. :'(

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] recipes anyone?

2009-05-30 Thread PJ
Ashley Sheridan wrote:
> On Fri, 2009-05-29 at 19:24 -0400, PJ wrote:
>   
>> Michael A. Peters wrote:
>> 
>>> Bob McConnell wrote:
>>>   
>>>> like a web based front end,
>>>> exclusion of specific ingredients due to allergies and being able to
>>>> attach dated notes about alterations or substitutions I try each time
>>>> 
>>> That sounds wicked.
>>> One of my brothers is allergic to corn.
>>> Being able to flag ingredients that contain corn (usually ingredients
>>> that contain corn syrup) would also be great.
>>>
>>> Fortunately nothing too drastic happens when he gets corn, he gets a
>>> rash and a bad attitude - but it still manages to slip its way into a
>>> lot of things you wouldn't think contain corn.
>>>
>>> I think it may be corn syrup itself and not corn that he is allergic
>>> to, I don't remember.
>>>
>>>   
>> Oh my god, you have just treaded into one horrible hornet's nest... corn
>> is probably the worst thing imaginable when it come to the food chain,
>> nutrition, ecology, global warmiing, allergies, "green" fuel, etc. etc.
>> not to mention that we as "human beings" are practically being turned
>> into corn ourselves.
>> Maybe your brother already knows about some of this, but it would be
>> worth it for you to pursue the subject and you would be horrifies what
>> corn is doing to our bodies and our planet. That is truly Montezuma's
>> Revenge. If you want to know where to look, I'll check it out from my
>> reading... I don't have that on me at the moment. ;-)
>>
>> -- 
>> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
>> -
>> Phil Jourdan --- p...@ptahhotep.com
>>http://www.ptahhotep.com
>>http://www.chiccantine.com/andypantry.php
>>
>>
>> 
> So, if corn is bad, eating it will get rid of it faster right? :p
>
>
> Ash
> www.ashleysheridan.co.uk
>
>
>   
No it will turn you into a corn cob! ;-)
The authority on that is Michael Pollan... check out his books; you'll
never eat the same again.

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] recipes anyone?

2009-05-29 Thread PJ
Shawn McKenzie wrote:
> Michael A. Peters wrote:
>   
>> Bob McConnell wrote:
>> 
>>> like a web based front end,
>>> exclusion of specific ingredients due to allergies and being able to
>>> attach dated notes about alterations or substitutions I try each time
>>>   
>> That sounds wicked.
>> One of my brothers is allergic to corn.
>> Being able to flag ingredients that contain corn (usually ingredients
>> that contain corn syrup) would also be great.
>>
>> Fortunately nothing too drastic happens when he gets corn, he gets a
>> rash and a bad attitude - but it still manages to slip its way into a
>> lot of things you wouldn't think contain corn.
>>
>> I think it may be corn syrup itself and not corn that he is allergic to,
>> I don't remember.
>> 
>
> Oh God, please don't get PJ started on corn!
>
>   
Too late! :-P

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] recipes anyone?

2009-05-29 Thread PJ
Michael A. Peters wrote:
> Bob McConnell wrote:
> > like a web based front end,
> > exclusion of specific ingredients due to allergies and being able to
> > attach dated notes about alterations or substitutions I try each time
>
> That sounds wicked.
> One of my brothers is allergic to corn.
> Being able to flag ingredients that contain corn (usually ingredients
> that contain corn syrup) would also be great.
>
> Fortunately nothing too drastic happens when he gets corn, he gets a
> rash and a bad attitude - but it still manages to slip its way into a
> lot of things you wouldn't think contain corn.
>
> I think it may be corn syrup itself and not corn that he is allergic
> to, I don't remember.
>
Oh my god, you have just treaded into one horrible hornet's nest... corn
is probably the worst thing imaginable when it come to the food chain,
nutrition, ecology, global warmiing, allergies, "green" fuel, etc. etc.
not to mention that we as "human beings" are practically being turned
into corn ourselves.
Maybe your brother already knows about some of this, but it would be
worth it for you to pursue the subject and you would be horrifies what
corn is doing to our bodies and our planet. That is truly Montezuma's
Revenge. If you want to know where to look, I'll check it out from my
reading... I don't have that on me at the moment. ;-)

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] recipes anyone?

2009-05-29 Thread PJ
Bob McConnell wrote:
> From: PJ
>   
>> I'd like to get some input on how to deal with recipes.
>> use html pages to store and display, XML or db or... ? And what about
>> clips, like flvs ? TIA.
>>
>> 
>
> There are as many ways to do cookbooks as there are cooks. I am familiar
> with half a dozen, without counting the professional packages put out by
> another department here where I work.
>
> RecipeML is one option, but it is seriously incomplete if you need to
> include nutritional information.
>
> Qookbooks, Gormet (Gnome), Krecipes (KDE) MealMaster, Master Cook,
> Recipants, etc. all have different storage formats and display formats.
> Some are well documented, some are buried in the code, and some are
> still kept secret. You can take your pick, or combine them and roll your
> own.
>
> A bigger issue is how to import existing recipe files. I have several
> years of messages collected from newsgroups like rec.food.recipes,
> r.f.cooking, r.f.baking, etc. that I would like to put into a usable,
> and searchable format. But there are too many variations in the formats
> and naming conventions used to be able to write a single routine to
> handle them all. It is much easier just to use those already published
> in MealMaster formats. At least that one is documented clearly now that
> they are out of business.
>
> Bob McConnell
>   
Thank you gentlemen. Basically, that's what I figured. But this does
give me some more stuff to mull over. The only thing I'm really
wondering is if it's worth doing anything with XML.
I do have a number of recipes already in HTML; probably will try to
re-use them and modify/or adapt with CSS.
Thanks, again.

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



[PHP] recipes anyone?

2009-05-29 Thread PJ
I'd like to get some input on how to deal with recipes.
use html pages to store and display, XML or db or... ? And what about
clips, like flvs ? TIA.

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



  1   2   3   4   >