[PHP] Re: Need help to understand a code
On 22-09-2012 12:34, Ashickur Rahman Noor wrote: Hi all I need some help to understand a code. The code is like this $result = mysql_query($sSQL) or die(err: . mysql_error().$sSQL); if($row = mysql_fetch_array($result)) { foreach($row as $key =$value){ $$key=$value;} } I don't get the code from the foreach loop. It simply assigns all values from the array to variables, which have the name of the keys. So basically what happens is: $array = array('a'=1, 'b'=2, 'c'=3); foreach($array as $key=$val) { $$key = $val; } will result in the creation of: $a = 1; $b = 2; $c = 3; $$foo means I want a variable whose name is contained in the variable $foo. So if $foo has the value 'bar', then you'll actually be saying I want a variable whose name is 'bar': $bar. So: $foo = 'bar'; $bar = 'this works!'; echo $$foo; // returns this works! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need help to understand a code
On Sat, 2012-09-22 at 13:13 +0200, Maciek Sokolewicz wrote: On 22-09-2012 12:34, Ashickur Rahman Noor wrote: Hi all I need some help to understand a code. The code is like this $result = mysql_query($sSQL) or die(err: . mysql_error().$sSQL); if($row = mysql_fetch_array($result)) { foreach($row as $key =$value){ $$key=$value;} } I don't get the code from the foreach loop. It simply assigns all values from the array to variables, which have the name of the keys. So basically what happens is: $array = array('a'=1, 'b'=2, 'c'=3); foreach($array as $key=$val) { $$key = $val; } will result in the creation of: $a = 1; $b = 2; $c = 3; $$foo means I want a variable whose name is contained in the variable $foo. So if $foo has the value 'bar', then you'll actually be saying I want a variable whose name is 'bar': $bar. So: $foo = 'bar'; $bar = 'this works!'; echo $$foo; // returns this works! Be careful with this though. I'm working on fixing some old code that someone wrote. They used this technique to update their code when it got moved to a server where register_globals was turned off. -- Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Re: Need help to understand a code
Hi Ashley I am updating some one code. Thanks for the notify. Thanks to all. Now I get that. -- Dedicated Linux Forum in Bangladesh http://goo.gl/238Ck 2048R/89C932E1 http://goo.gl/TkP5U Coordinator - Public Relation Cell, FOSS Bangladesh http://fossbd.org/ Mozilla Reps http://reps.mozilla.org 01199151550, 01551151550
Re: [PHP] Re: Need help to understand a code
On Sat, 2012-09-22 at 17:43 +0600, Ashickur Rahman Noor wrote: Hi Ashley I am updating some one code. Thanks for the notify. Thanks to all. Now I get that. -- Dedicated Linux Forum in Bangladesh http://goo.gl/238Ck 2048R/89C932E1 http://goo.gl/TkP5U Coordinator - Public Relation Cell, FOSS Bangladesh http://fossbd.org/ Mozilla Reps http://reps.mozilla.org 01199151550, 01551151550 It's probably fine doing that for your example, as the content coming from the database will be content you expect, but be wary of using it on any of the user-generated arrays like $_GET, or $_POST. -- Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Re: Need help to understand a code
Op 22 sep. 2012 13:47 schreef Ashley Sheridan a...@ashleysheridan.co.uk het volgende: On Sat, 2012-09-22 at 17:43 +0600, Ashickur Rahman Noor wrote: Hi Ashley I am updating some one code. Thanks for the notify. Thanks to all. Now I get that. -- Dedicated Linux Forum in Bangladesh http://goo.gl/238Ck 2048R/89C932E1 http://goo.gl/TkP5U Coordinator - Public Relation Cell, FOSS Bangladesh http://fossbd.org/ Mozilla Reps http://reps.mozilla.org 01199151550, 01551151550 It's probably fine doing that for your example, as the content coming from the database will be content you expect, but be wary of using it on any of the user-generated arrays like $_GET, or $_POST. And a few months/years later you decide to add a new column to your db which has the same name as one of the variables you're already using and the script starts acting very strange... People should stop using bad coding habits like these.. - Matijn
RES: [PHP] Re: Need help to understand a code
+1 to bad maintainability of the code. As a suggestion, one better solution could be something like: [...] class Entity { public $id; public $name; } [...] $entity = new Entity(); foreach [...] $entity-$$key = $value; [...] And, of course, never ever use * in SQL queries. Samuel. -Mensagem original- De: Matijn Woudt [mailto:tijn...@gmail.com] Enviada em: sábado, 22 de setembro de 2012 11:02 Para: a...@ashleysheridan.co.uk Cc: Ashickur Rahman Noor; PHP List Assunto: Re: [PHP] Re: Need help to understand a code Op 22 sep. 2012 13:47 schreef Ashley Sheridan a...@ashleysheridan.co.uk het volgende: On Sat, 2012-09-22 at 17:43 +0600, Ashickur Rahman Noor wrote: Hi Ashley I am updating some one code. Thanks for the notify. Thanks to all. Now I get that. -- Dedicated Linux Forum in Bangladesh http://goo.gl/238Ck 2048R/89C932E1 http://goo.gl/TkP5U Coordinator - Public Relation Cell, FOSS Bangladesh http://fossbd.org/ Mozilla Reps http://reps.mozilla.org 01199151550, 01551151550 It's probably fine doing that for your example, as the content coming from the database will be content you expect, but be wary of using it on any of the user-generated arrays like $_GET, or $_POST. And a few months/years later you decide to add a new column to your db which has the same name as one of the variables you're already using and the script starts acting very strange... People should stop using bad coding habits like these.. - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] Re: Need help to understand a code
Samuel Lopes Grigolato samuel.grigol...@gmail.com wrote: +1 to bad maintainability of the code. As a suggestion, one better solution could be something like: [...] class Entity { public $id; public $name; } [...] $entity = new Entity(); foreach [...] $entity-$$key = $value; [...] And, of course, never ever use * in SQL queries. Samuel. -Mensagem original- De: Matijn Woudt [mailto:tijn...@gmail.com] Enviada em: sábado, 22 de setembro de 2012 11:02 Para: a...@ashleysheridan.co.uk Cc: Ashickur Rahman Noor; PHP List Assunto: Re: [PHP] Re: Need help to understand a code Op 22 sep. 2012 13:47 schreef Ashley Sheridan a...@ashleysheridan.co.uk het volgende: On Sat, 2012-09-22 at 17:43 +0600, Ashickur Rahman Noor wrote: Hi Ashley I am updating some one code. Thanks for the notify. Thanks to all. Now I get that. -- Dedicated Linux Forum in Bangladesh http://goo.gl/238Ck 2048R/89C932E1 http://goo.gl/TkP5U Coordinator - Public Relation Cell, FOSS Bangladesh http://fossbd.org/ Mozilla Reps http://reps.mozilla.org 01199151550, 01551151550 It's probably fine doing that for your example, as the content coming from the database will be content you expect, but be wary of using it on any of the user-generated arrays like $_GET, or $_POST. And a few months/years later you decide to add a new column to your db which has the same name as one of the variables you're already using and the script starts acting very strange... People should stop using bad coding habits like these.. - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php there's nothing wrong with using * in queries. -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] Re: Need help to understand a code
On 22-09-2012 16:19, Samuel Lopes Grigolato wrote: +1 to bad maintainability of the code. As a suggestion, one better solution could be something like: [...] class Entity { public $id; public $name; } [...] $entity = new Entity(); foreach [...] $entity-$$key = $value; [...] And, of course, never ever use * in SQL queries. Samuel. If you're doing it that way, just use mysqli and then mysqli_result's fetch_object with your Entity as the class. ie: $result = $mysqli-query('some query'); $entity = $result-fetch_object('Entity'); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RES: RES: [PHP] Re: Need help to understand a code
I disagree with you Ashley, some arguments can be found here: http://sqlblog.com/blogs/aaron_bertrand/archive/2009/10/10/bad-habits-to-kick-using-select-omitting-the-column-list.aspx Using explicit columns names in the select clause is, IMHO, at least a good documentation for what is being requested to the database layer. +1 to Maciek's suggestion, had totally forgotten this one. Cheers. -Mensagem original- De: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Enviada em: sábado, 22 de setembro de 2012 11:52 Para: Samuel Lopes Grigolato; 'PHP List' Assunto: Re: RES: [PHP] Re: Need help to understand a code Samuel Lopes Grigolato samuel.grigol...@gmail.com wrote: +1 to bad maintainability of the code. As a suggestion, one better solution could be something like: [...] class Entity { public $id; public $name; } [...] $entity = new Entity(); foreach [...] $entity-$$key = $value; [...] And, of course, never ever use * in SQL queries. Samuel. -Mensagem original- De: Matijn Woudt [mailto:tijn...@gmail.com] Enviada em: sábado, 22 de setembro de 2012 11:02 Para: a...@ashleysheridan.co.uk Cc: Ashickur Rahman Noor; PHP List Assunto: Re: [PHP] Re: Need help to understand a code Op 22 sep. 2012 13:47 schreef Ashley Sheridan a...@ashleysheridan.co.uk het volgende: On Sat, 2012-09-22 at 17:43 +0600, Ashickur Rahman Noor wrote: Hi Ashley I am updating some one code. Thanks for the notify. Thanks to all. Now I get that. -- Dedicated Linux Forum in Bangladesh http://goo.gl/238Ck 2048R/89C932E1 http://goo.gl/TkP5U Coordinator - Public Relation Cell, FOSS Bangladesh http://fossbd.org/ Mozilla Reps http://reps.mozilla.org 01199151550, 01551151550 It's probably fine doing that for your example, as the content coming from the database will be content you expect, but be wary of using it on any of the user-generated arrays like $_GET, or $_POST. And a few months/years later you decide to add a new column to your db which has the same name as one of the variables you're already using and the script starts acting very strange... People should stop using bad coding habits like these.. - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php there's nothing wrong with using * in queries. -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: RES: [PHP] Re: Need help to understand a code
On Sat, 2012-09-22 at 12:12 -0300, Samuel Lopes Grigolato wrote: I disagree with you Ashley, some arguments can be found here: http://sqlblog.com/blogs/aaron_bertrand/archive/2009/10/10/bad-habits-to-kick-using-select-omitting-the-column-list.aspx Using explicit columns names in the select clause is, IMHO, at least a good documentation for what is being requested to the database layer. +1 to Maciek's suggestion, had totally forgotten this one. Cheers. -Mensagem original- De: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Enviada em: sábado, 22 de setembro de 2012 11:52 Para: Samuel Lopes Grigolato; 'PHP List' Assunto: Re: RES: [PHP] Re: Need help to understand a code Samuel Lopes Grigolato samuel.grigol...@gmail.com wrote: +1 to bad maintainability of the code. As a suggestion, one better solution could be something like: [...] class Entity { public $id; public $name; } [...] $entity = new Entity(); foreach [...] $entity-$$key = $value; [...] And, of course, never ever use * in SQL queries. Samuel. -Mensagem original- De: Matijn Woudt [mailto:tijn...@gmail.com] Enviada em: sábado, 22 de setembro de 2012 11:02 Para: a...@ashleysheridan.co.uk Cc: Ashickur Rahman Noor; PHP List Assunto: Re: [PHP] Re: Need help to understand a code Op 22 sep. 2012 13:47 schreef Ashley Sheridan a...@ashleysheridan.co.uk het volgende: On Sat, 2012-09-22 at 17:43 +0600, Ashickur Rahman Noor wrote: Hi Ashley I am updating some one code. Thanks for the notify. Thanks to all. Now I get that. -- Dedicated Linux Forum in Bangladesh http://goo.gl/238Ck 2048R/89C932E1 http://goo.gl/TkP5U Coordinator - Public Relation Cell, FOSS Bangladesh http://fossbd.org/ Mozilla Reps http://reps.mozilla.org 01199151550, 01551151550 It's probably fine doing that for your example, as the content coming from the database will be content you expect, but be wary of using it on any of the user-generated arrays like $_GET, or $_POST. And a few months/years later you decide to add a new column to your db which has the same name as one of the variables you're already using and the script starts acting very strange... People should stop using bad coding habits like these.. - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php there's nothing wrong with using * in queries. -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. There are plenty of times that you need all fields from a table though. I go by the rule that if I need less than two thirds of the fields of a table, then I specify the fields I need, otherwise, it's easier to go with *. I've looked at the link you posted. The join issue is too broad. I use * with joins, but avoid the conflicts by specifying the table name, still going by the ⅔ rule above on a table by table basis. Of course, if there are tables used in the join that are not necessary to the actual output, I won't include them in the list, but I may do something like this: SELECT a.a, a.b, a.c, b.* FROM a LEFT JOIN a on a.a = b.a I would say that if you're in the position of writing the queries then you should be aware of the database schema, so using the query as a form of documentation shouldn't be a factor. Of course there are occasions where the database is updated and breaks code, in which case specifying all the field names would potentially avoid that, but procedures should be in place which would at least make you aware of such updates to allow you to plan for them. -- Thanks, Ash http://www.ashleysheridan.co.uk
RES: RES: RES: [PHP] Re: Need help to understand a code
When I said that it’s a form of documentation, I was saying that I think it’s better to know everything the script is using from the tables right on the SQL command, without the need to inspect all the code, for example: SELECT * FROM a; $values = some_fetch_array_thing […] bunch of lines of code echo $values[“column1”]; […] another bunch of code echo $values[“column2”]; In my opinion it’s is easier to forget that column2 is being utilized by this script, than if it was explicit in the SQL command. Of course, if the lifecycle of the array fetched from the resultset doesn’t spread too much, there isn’t any problem. Besides that, I’ve got your points =). The “a.*” thing successfully beats the join problem. One last point: “Of course there are occasions where the database is updated and breaks code, in which case specifying all the field names would potentially avoid that”, we should only declare in the SELECT clause fields we’re actually using along the script, and even if we go with the “*” way the code will broke eventually with schema changes. Regards. De: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Enviada em: sábado, 22 de setembro de 2012 12:35 Para: Samuel Lopes Grigolato Cc: 'PHP List' Assunto: Re: RES: RES: [PHP] Re: Need help to understand a code On Sat, 2012-09-22 at 12:12 -0300, Samuel Lopes Grigolato wrote: I disagree with you Ashley, some arguments can be found here: http://sqlblog.com/blogs/aaron_bertrand/archive/2009/10/10/bad-habits-to-kick-using-select-omitting-the-column-list.aspx Using explicit columns names in the select clause is, IMHO, at least a good documentation for what is being requested to the database layer. +1 to Maciek's suggestion, had totally forgotten this one. Cheers. -Mensagem original- De: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Enviada em: sábado, 22 de setembro de 2012 11:52 Para: Samuel Lopes Grigolato; 'PHP List' Assunto: Re: RES: [PHP] Re: Need help to understand a code Samuel Lopes Grigolato samuel.grigol...@gmail.com wrote: +1 to bad maintainability of the code. As a suggestion, one better solution could be something like: [...] class Entity { public $id; public $name; } [...] $entity = new Entity(); foreach [...] $entity-$$key = $value; [...] And, of course, never ever use * in SQL queries. Samuel. -Mensagem original- De: Matijn Woudt [mailto:tijn...@gmail.com] Enviada em: sábado, 22 de setembro de 2012 11:02 Para: a...@ashleysheridan.co.uk Cc: Ashickur Rahman Noor; PHP List Assunto: Re: [PHP] Re: Need help to understand a code Op 22 sep. 2012 13:47 schreef Ashley Sheridan a...@ashleysheridan.co.uk het volgende: On Sat, 2012-09-22 at 17:43 +0600, Ashickur Rahman Noor wrote: Hi Ashley I am updating some one code. Thanks for the notify. Thanks to all. Now I get that. -- Dedicated Linux Forum in Bangladesh http://goo.gl/238Ck 2048R/89C932E1 http://goo.gl/TkP5U Coordinator - Public Relation Cell, FOSS Bangladesh http://fossbd.org/ Mozilla Reps http://reps.mozilla.org 01199151550, 01551151550 It's probably fine doing that for your example, as the content coming from the database will be content you expect, but be wary of using it on any of the user-generated arrays like $_GET, or $_POST. And a few months/years later you decide to add a new column to your db which has the same name as one of the variables you're already using and the script starts acting very strange... People should stop using bad coding habits like these.. - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php there's nothing wrong with using * in queries. -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. There are plenty of times that you need all fields from a table though. I go by the rule that if I need less than two thirds of the fields of a table, then I specify the fields I need, otherwise, it's easier to go with *. I've looked at the link you posted. The join issue is too broad. I use * with joins, but avoid the conflicts by specifying the table name, still going by the ⅔ rule above on a table by table basis. Of course, if there are tables used in the join that are not necessary to the actual output, I won't include them in the list, but I may do something like this: SELECT a.a, a.b, a.c, b.* FROM a LEFT JOIN a on a.a = b.a I would say that if you're in the position of writing the queries then you should be aware of the database schema, so using the query as a form of documentation shouldn't be a factor. Of course there are occasions where the database is updated and breaks code, in which case specifying all the field names would potentially avoid that, but procedures should be in place which would at least make you aware of such updates to allow you to plan
[PHP] Re: Need Help in Yaf spreading
CC to php-general. thanks On Mon, Aug 20, 2012 at 4:06 PM, Laruence larue...@php.net wrote: Hi: Yaf (http://pecl.php.net/yaf) is a PHP MVC framework, which is build as a PHP extension. It could be considered as the fastest PHP framework for now(http://www.laruence.com/2011/12/02/2333.html), and it has already been used in a lots of productions in baidu, sina. like weibo.com. we gain 76% performance boost while refactor weibo.com based on yaf ( of course and some other improvements) so, I can say that Yaf is very popular in chinese world. but it was a little hysteretic in english world. I asked for some help in sepreading Yaf in english world. any recommends of Yaf (post, twitter, etc) will be appreciated. thanks -- Laruence Xinchen Hui http://www.laruence.com/ -- Laruence Xinchen Hui http://www.laruence.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need Help resolving the undefined variable and getting property of non-object errors
Terion Miller wrote: Hello All, I am having problems resolving errors with some images causing the Undefined variable and getting property of non-object errors, I am trying to make a copy function so that an order can be viewed then resubmitted as a new order with minimal changes if needed. Here's my code: --could it be out of order as in the select should be above the insert? I bolded where the errors are happening. --- if ($GO == Save) { echo $AdminID; $sql = SELECT Name FROM admin WHERE AdminID='$AdminID'; $result = mysql_query ($sql); echo mysql_num_rows($result); //if 0 then $result is empty * $row = mysql_fetch_object($result);this is giving me problems and I tried changing the object to assoc * $Notes = ~. date(F j, Y g:i a) . - Planet Discover Enhanced Listing Submitted by . $row-Name .\n; *This is the trying to get property of non object* -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need help on MySQL query
Rahat Bashir schrieb: Hi Experts, EID Mubarak to all. I need your help on writing a MySQL query. Scenario: CREATE TABLE transaction ( `id` int NOT NULL ATUTO INCREMENT, `date` datetime NOT NULL, `withdrawn` double (12,2) NULL, `deposit` double (12,2) NULL ); SELECT * FROM transaction; id date withdrawn deposit -- --- -- 1 2008-12-01 00:00:00 NULL1.00 2 2008-12-02 00:00:00 4000.00 NULL 3 2008-12-04 00:00:00 2000.00 NULL 4 2008-12-05 00:00:00 NULL4500.00 5 2008-12-06 00:00:00 500.00 1500.00 The above is all I have. I want to make query which should output an extra calculated column named balance, something like following: Expected output from query: id date withdrawn depositbalance -- --- -- - 1 2008-12-01 00:00:00 NULL1.00 1.00 2 2008-12-02 00:00:00 4000.00 NULL 6000.00 3 2008-12-04 00:00:00 2000.00 NULL 4000.00 4 2008-12-05 00:00:00 NULL4500.00 8500.00 5 2008-12-06 00:00:00 500.00 1500.00 9500.00 Thanks in advance Hi Rahat, you can see more information about MySQL on www.mysql.com and show how to build/make Queries well. Regards Carlos Medina -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: need help,pls
While we can point you in the right direction we can't build your project for you. You cover such a wide range of topics it's like you're trying to write a huge project but don't know actually how to use PHP. My recomendation is to go get a good PHP book, there's been a lot of discussion about good books in the newsgroups in the past, and read that. Most of these topics are covered to some extent in a good book. Also your question is really hard to follow, take a look at this http://www.catb.org/~esr/faqs/smart-questions.html - Dan esimaje juan toritseju [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] hi, My name is Juan, i need help from you and i will be greatful if you could assist me,i have got an academic project to create a website .Within the page i should create a login session for users ,i will have a database to save designs, i do know how to create the database but, do not know how to create the loggin sessions for users and also use flash in Php to enable a user to select one or more designs to appear on the other also to make a background color for the designs to be placed on,i ought to make it possible for the user to be able to change the background color to see which color suits the design,also make it possible for a user to be able to upload their own designs and make it sharable to other users.I will really appreciate if you will be able to direct me on how to go about this work.Looking forward to hearing from you soon.Thanks - Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for your freeaccount today. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: need help
Sancar Saran wrote: Beatiful web design one of the best webs site design books also this kind of books wery hard to find (because most of them try to teach you html tag by tag). You may look some other photoshop books for generating images. And of course practice makes perfect As a programmer you may think like I do, in that you like examples rather than language theory. In this respect and for the HTML/CSS part (I agree with Sancar that as a C++ programmer you probably wont struggle with PHP itself), I find www.csszengarden.com a great please for insipration and clean HTML design. I would say that you have to watch out as some people do take things a little far with their CSS and do some odd things make it fit the fixed HTML available. Col. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need help with modifying values
modify_values2.php ++ ?php include(connect.php); $sql = Select * from leaderboard ; $result = mysql_query($sql); You'll want to do something like: $id = mysql_real_escape_string($_GET['id']); $sql = Select * from leaderboard WHERE ID='$id'; David Hall -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: need help finding parsing error please
* Bruce Gilbert [EMAIL PROTECTED]: Hello, I am getting this on the following code, and I am not sure what is causing the error and need some pros to take a look at it for me. the error is: Parse error: parse error, unexpected '{' in /hsphere/local/home/bruceg/inspired-evolution.com/Contact_Form2.php on line 161 snip if ($_POST['op']!='ds') { // they need to see the form echo $form_block; } else if ($_POST[op] == ds) { Where's the end to this elseif? You follow it immediately with the following lines, which simply won't work (can't define functions inside if() blocks). //Function saves time and space by eliminating unneccesary code function check($fieldname) { -- Matthew Weier O'Phinney Zend Certified Engineer http://weierophinney.net/matthew/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: need help finding parsing error please
Matthew Weier O'Phinney wrote: * Bruce Gilbert [EMAIL PROTECTED]: Hello, I am getting this on the following code, and I am not sure what is causing the error and need some pros to take a look at it for me. the error is: Parse error: parse error, unexpected '{' in /hsphere/local/home/bruceg/inspired-evolution.com/Contact_Form2.php on line 161 the error is correct. (that sounds funny) find the line containing: if (isset($err_msg) || isset($email_err) { echo and look _very_ _very_ carefully at it. look again. see it now? I don't know if my mail client made a mess of your code layout or if it was just a mess - if it was a mess to begin with then I would recommend you try and be more consistent in the way you present your code - it makes it easier to maintain and debug - granted php doesn't care about the layout - you can write everything on a single line if you really want. google on Coding Standards - pick a style your eyes like and try to stick with it - you wont regret it. snip if ($_POST['op']!='ds') { // they need to see the form echo $form_block; } else if ($_POST[op] == ds) { Where's the end to this elseif? You follow it immediately with the following lines, which simply won't work (can't define functions inside if() blocks). Matthew but it's perfectly valid to define a function inside an if() block... It generally gets doen in apps where they have to support older versions of php and conditionally define functions if they don't exist e.g. if (!defined(array_push)) { function array_push($arr, $val) { /*stuff*/ } } //Function saves time and space by eliminating unneccesary code function check($fieldname) { -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: need help finding parsing error please
* Jochem Maas [EMAIL PROTECTED] : Matthew Weier O'Phinney wrote: * Bruce Gilbert [EMAIL PROTECTED] : I am getting this on the following code, and I am not sure what is causing the error and need some pros to take a look at it for me. the error is: Parse error: parse error, unexpected '{' in /hsphere/local/home/bruceg/inspired-evolution.com/Contact_Form2.php on line 161 the error is correct. (that sounds funny) find the line containing: if (isset($err_msg) || isset($email_err) { echo and look _very_ _very_ carefully at it. look again. see it now? I don't know if my mail client made a mess of your code layout or if it was just a mess - if it was a mess to begin with then I would recommend you try and be more consistent in the way you present your code - it makes it easier to maintain and debug - granted php doesn't care about the layout - you can write everything on a single line if you really want. google on Coding Standards - pick a style your eyes like and try to stick with it - you wont regret it. +1 I personally use PEAR's CS, and made that decision a little over a year ago. I've never looked back, and code I've had to maintain that predates that decision gets updated -- simply because it makes maintenance and debugging a thousandfold easier. snip if ($_POST['op']!='ds') { // they need to see the form echo $form_block; } else if ($_POST[op] == ds) { Where's the end to this elseif? You follow it immediately with the following lines, which simply won't work (can't define functions inside if() blocks). Matthew but it's perfectly valid to define a function inside an if() block... It generally gets doen in apps where they have to support older versions of php and conditionally define functions if they don't exist e.g. if (!defined(array_push)) { function array_push($arr, $val) { /*stuff*/ } } D'oh! I was thinking this was an anonymous function (ala perl), and of course it's not. Good catch, Jochem. -- Matthew Weier O'Phinney Zend Certified Engineer http://weierophinney.net/matthew/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need help with PHP / MySQL connect problem
Linda H [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I added the following to the top of my script: ?php echo phpinfo(); ? Got all sorts of environment and path info. Not anything about MySQL, but I didn't see anything that looked obviously wrong, though I don't understand a lot of it. I ried reinstalling MySQL, Apache, and PHP. No change. Linda What does php.ini have for this line display_errors = On If it's off, set it on. Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need help with PHP / MySQL connect problem
i recently met samekind of problem, could you pls specify the OS, Apache, Php and MySQL vesrions you are using? vk On 7/18/05, Mark Rees [EMAIL PROTECTED] wrote: Linda H [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I added the following to the top of my script: ?php echo phpinfo(); ? Got all sorts of environment and path info. Not anything about MySQL, but I didn't see anything that looked obviously wrong, though I don't understand a lot of it. I ried reinstalling MySQL, Apache, and PHP. No change. Linda What does php.ini have for this line display_errors = On If it's off, set it on. Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- vk. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need help with PHP / MySQL connect problem
Quoting Linda H [EMAIL PROTECTED]: I added the following to the top of my script: ?php echo phpinfo(); ? Got all sorts of environment and path info. In addition to the other excellent suggestions so far, make sure (looking at the phpinfo page, under Configuration File Path) that your install is using the php.ini file you think it is. I got bit by this (I kept editing the php.ini file in one directory, but it was reading the file from another). It really does sound like error reporting is turned off. hth, Rick -- Rick Emery When once you have tasted flight, you will forever walk the Earth with your eyes turned skyward, for there you have been, and there you will always long to return -- Leonardo Da Vinci -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need help with PHP / MySQL connect problem
For those who didn't join this thread at the beginning, I'm running MySQL 4.0.21, Apache 2.0.52 and PHP 5.0.2 on a Windows XP system. I installed in the sequence - MySQL, then Apache, then PHP. MySQL was running when the others were installed (which is what the book I am using seemed to indicate). Apache was not running when PHP was installed. What does php.ini have for this line display_errors = On Now we are getting somewhere. Even though error_reporting was set to E_ALL, display_errors was Off. I set it On and now I'm getting an error. Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Group\Apache2\htdocs\example\test_connect.php on line 15 the phpinfo() display doesn't reference MySQL at all. It does reference SQLite with the following info: SQLite supportenabled: PECL Module version 2.0-dev $Id: sqlite.c,v 1.146.2.2 2004/08/02 22:43:42 iliaa Exp $ SQLite Library: 2.8.14 SQLite Encoding: iso8859 Directive: sqlite_assoc_case, Local Value: 0, Master Value: 0 So it looks like MySQL didn't get configured with PHP. In the PHP FAQ on database issues, I found the following: 4. PHP 5 no longer bundles MySQL client libraries, what does this mean to me? Can I still use MySQL with PHP? I try to use MySQL and get function undefined errors, what gives? Yes. There will always be MySQL support in PHP of one kind or another. The only change in PHP 5 is that we are no longer bundling the client library itself. Some reasons in no particular order: * Most systems these days already have the client library installed. * Given the above, having multiple versions of the library can get messy. For example, if you link mod_auth_mysql against one version and PHP against another, and then enable both in Apache, you get a nice fat crash. Also, the bundled library didn't always play well with the installed server version. The most obvious symptom of this being disagreement over where to find the mysql.socket Unix domain socket file. * Maintenance was somewhat lax and it was falling further and further behind the released version. * Future versions of the library are under the GPL and thus we don't have an upgrade path since we cannot bundle a GPL'ed library in a BSD/Apache-style licensed project. A clean break in PHP 5 seemed like the best option. This won't actually affect that many people. Unix users, at least the ones who know what they are doing, tend to always build PHP against their system's libmyqlclient library simply by adding the --with-mysql=/usr option when building PHP. Windows users may enable the extension php_mysql.dll inside php.ini. Also, be sure libmysql.dll is available to the systems PATH. For more details on how, read the FAQ on http://www.php.net/manual/en/faq.installation.php#faq.installation.addtopathsetting up the Windows systems PATH. Because libmysql.dll (and many other PHP related files) exist in the PHP folder, you'll want to add the PHP folder to your systems PATH. I added my PHP folder (C:\php5\) to my system path and restarted (libmysql.ddl is in php5). Still get the error. I enabled the extension php_mysql.dll in php.ini and Apache startup says it can't find it (php_mysql.dll is in C:\php5\ext). So, should I move php_mysql.dll to c:\php5, change the system path, or what? And what about php.ini showing sqlite instead of MySQL? Do I need to get the MySQL client libraries (what are they called and where do I put them - I already have some mysql dll's in the PHP libraries. Linda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need help with PHP / MySQL connect problem
Linda H [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] For those who didn't join this thread at the beginning, I'm running MySQL 4.0.21, Apache 2.0.52 and PHP 5.0.2 on a Windows XP system. I installed in the sequence - MySQL, then Apache, then PHP. MySQL was running when the others were installed (which is what the book I am using seemed to indicate). Apache was not running when PHP was installed. What does php.ini have for this line display_errors = On Now we are getting somewhere. Even though error_reporting was set to E_ALL, display_errors was Off. I set it On and now I'm getting an error. Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Group\Apache2\htdocs\example\test_connect.php on line 15 the phpinfo() display doesn't reference MySQL at all. It does reference SQLite with the following info: SQLite supportenabled: PECL Module version 2.0-dev $Id: sqlite.c,v 1.146.2.2 2004/08/02 22:43:42 iliaa Exp $ SQLite Library: 2.8.14 SQLite Encoding: iso8859 Directive: sqlite_assoc_case, Local Value: 0, Master Value: 0 So it looks like MySQL didn't get configured with PHP. In the PHP FAQ on database issues, I found the following: 4. PHP 5 no longer bundles MySQL client libraries, what does this mean to me? Can I still use MySQL with PHP? I try to use MySQL and get function undefined errors, what gives? Yes. There will always be MySQL support in PHP of one kind or another. The only change in PHP 5 is that we are no longer bundling the client library itself. Some reasons in no particular order: * Most systems these days already have the client library installed. * Given the above, having multiple versions of the library can get messy. For example, if you link mod_auth_mysql against one version and PHP against another, and then enable both in Apache, you get a nice fat crash. Also, the bundled library didn't always play well with the installed server version. The most obvious symptom of this being disagreement over where to find the mysql.socket Unix domain socket file. * Maintenance was somewhat lax and it was falling further and further behind the released version. * Future versions of the library are under the GPL and thus we don't have an upgrade path since we cannot bundle a GPL'ed library in a BSD/Apache-style licensed project. A clean break in PHP 5 seemed like the best option. This won't actually affect that many people. Unix users, at least the ones who know what they are doing, tend to always build PHP against their system's libmyqlclient library simply by adding the --with-mysql=/usr option when building PHP. Windows users may enable the extension php_mysql.dll inside php.ini. Also, be sure libmysql.dll is available to the systems PATH. For more details on how, read the FAQ on http://www.php.net/manual/en/faq.installation.php#faq.installation.addtopat hsetting up the Windows systems PATH. Because libmysql.dll (and many other PHP related files) exist in the PHP folder, you'll want to add the PHP folder to your systems PATH. I added my PHP folder (C:\php5\) to my system path and restarted (libmysql.ddl is in php5). Still get the error. I enabled the extension php_mysql.dll in php.ini and Apache startup says it can't find it (php_mysql.dll is in C:\php5\ext). Make sure this is set as follows in php.ini, then restart apache extension_dir = c:\php\ext So, should I move php_mysql.dll to c:\php5, change the system path, or what? And what about php.ini showing sqlite instead of MySQL? Do I need to get the MySQL client libraries (what are they called and where do I put them - I already have some mysql dll's in the PHP libraries. Linda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need help with PHP / MySQL connect problem
Thanks for the advice, Matt, but it doesn't seem to solve my problem. php.ini is in the C:Program Files/WINDOWS directory and error_reporting was set to E_ALL. I found php5ts.dll in the WINDOWS/system32 directory. I copied it to WINDOWS/system, just in case. My install instructions said to put it with my other dlls, which might be in either directory. Most of them are in system32. Using this at the top of your script will allow PHP and MySQL to interact. $_POST['dbconn']=mysql_select_db(database_name, mysql_connect(server_name,user_name,password)); I put this in my script (changing parameters as appropriate) but got no results and no error messages. Any other ideas. I've spent hours on this, trying everything I could think of and I'm very frustrated. The rest of my output is still suppressed if I put the connect script above it in the file. It does sound like you have notices and warnings turned off in php.ini: Find php.ini (not sure where it installs to in Windows version), and set error_reporting = E_ALL. This will show all notices and warnings generated by your PHP code; extremely usefull in debugging. Matt Darby Linda H wrote: I'm running MySQL 4.0.21, Apache 2.0.52 and PHP 5.0.2 on a Windows XP system. I can run scripts with PHP and HTML statements and see correct output in my browser. But when I try to connect to MySQL I get nothing, including no error messages. One book I have says to run the following scrip to test the connection. It should print either the Resource name or an error message: ?php echo mysql_connect ('localhost','calendar','pass1234'); # host, user, password ? I get no output at all, and if the statement is placed in a larger script, above html/PHP output, it suppresses that as well. Using the mysql monitor from the DOS command prompt, I can connect as user 'calendar' with password 'pass1234', select a database and execute SQL statements successfully. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need help with PHP / MySQL connect problem
Try this just for kicks: ? aslkdjfalsd; ? See if this will output errors. It's rather hard to debug without error messages ;) If I remember correctly, isn't php.ini supposed to be in c:/PHP? Linda H wrote: Thanks for the advice, Matt, but it doesn't seem to solve my problem. php.ini is in the C:Program Files/WINDOWS directory and error_reporting was set to E_ALL. I found php5ts.dll in the WINDOWS/system32 directory. I copied it to WINDOWS/system, just in case. My install instructions said to put it with my other dlls, which might be in either directory. Most of them are in system32. Using this at the top of your script will allow PHP and MySQL to interact. $_POST['dbconn']=mysql_select_db(database_name, mysql_connect(server_name,user_name,password)); I put this in my script (changing parameters as appropriate) but got no results and no error messages. Any other ideas. I've spent hours on this, trying everything I could think of and I'm very frustrated. The rest of my output is still suppressed if I put the connect script above it in the file. It does sound like you have notices and warnings turned off in php.ini: Find php.ini (not sure where it installs to in Windows version), and set error_reporting = E_ALL. This will show all notices and warnings generated by your PHP code; extremely usefull in debugging. Matt Darby Linda H wrote: I'm running MySQL 4.0.21, Apache 2.0.52 and PHP 5.0.2 on a Windows XP system. I can run scripts with PHP and HTML statements and see correct output in my browser. But when I try to connect to MySQL I get nothing, including no error messages. One book I have says to run the following scrip to test the connection. It should print either the Resource name or an error message: ?php echo mysql_connect ('localhost','calendar','pass1234'); # host, user, password ? I get no output at all, and if the statement is placed in a larger script, above html/PHP output, it suppresses that as well. Using the mysql monitor from the DOS command prompt, I can connect as user 'calendar' with password 'pass1234', select a database and execute SQL statements successfully. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need help with PHP / MySQL connect problem
Try this just for kicks: ? aslkdjfalsd; ? Nope - nothing :-( See if this will output errors. It's rather hard to debug without error messages ;) No kidding! If I remember correctly, isn't php.ini supposed to be in c:/PHP? It came in c:/php5 as php.ini-recommended. My instructions were to move it to c:\WINDOWS and rename to php.ini. Linda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need help with PHP / MySQL connect problem
I added the following to the top of my script: ?php echo phpinfo(); ? Got all sorts of environment and path info. Not anything about MySQL, but I didn't see anything that looked obviously wrong, though I don't understand a lot of it. I ried reinstalling MySQL, Apache, and PHP. No change. Linda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need help with PHP / MySQL connect problem
You should definitely see a listing for MySQL in phpinfo()... What order did you install MySQL/PHP/Apache? Linda H wrote: I added the following to the top of my script: ?php echo phpinfo(); ? Got all sorts of environment and path info. Not anything about MySQL, but I didn't see anything that looked obviously wrong, though I don't understand a lot of it. I ried reinstalling MySQL, Apache, and PHP. No change. Linda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: need help parsing named.conf file
Torsten Rosenberger wrote: Hello is there a way to parse the named.conf file with preg_match_all to get back an array which looks like [options][directory] = '/var/lib/named' [options][forwoarder] = '192.168.0.2' [zone][mydomain.com][type] = 'master' [zone][mydomain.com][notify] = 'yes' [zone][domain2.com][type] = 'slave' . . BR/Torsten and the named.conf looks like.? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: need help parsing named.conf file
and the named.conf looks like.? options { # The directory statement defines the name server's working directory directory /var/lib/named; # Write dump and statistics file to the log subdirectory. The # pathenames are relative to the chroot jail. dump-file /var/log/named_dump.db; statistics-file /var/log/named.stats; # The forwarders record contains a list of servers to which queries # should be forwarded. Enable this line and modify the IP address to # your provider's name server. Up to three servers may be listed. forwarders { 192.0.2.1; 192.0.2.2; }; # Enable the next entry to prefer usage of the name server declared in # the forwarders section. #forward first; notify no; }; # To configure named's logging remove the leading '#' characters of the # following examples. #logging { # # Log queries to a file limited to a size of 100 MB. # channel query_logging { # file /var/log/named_querylog # versions 3 size 100M; # print-time yes; // timestamp log entries # }; # category queries { # query_logging; # }; # # # Or log this kind alternatively to syslog. # channel syslog_queries { # syslog user; # severity info; # }; # category queries { syslog_queries; }; # # # Log general name server errors to syslog. # channel syslog_errors { # syslog user; # severity error; # }; # category default { syslog_errors; }; # # # Don't log lame server messages. # category lame-servers { null; }; #}; # The following zone definitions don't need any modification. The first one # is the definition of the root name servers. The second one defines # localhost while the third defines the reverse lookup for localhost. zone . in { type hint; file root.hint; }; zone localhost in { type master; file localhost.zone; }; zone 0.0.127.in-addr.arpa in { type master; file 127.0.0.zone; }; BR/Torsten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need Help
Use ?php ? if you are implementing php. I think that you can predefine what scriptlanguage to use, and therefore ? ? can be used. /Peter Suneel [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] Hi to all any one Could tell me any diffrence between ?php ? and ? ?. And which one is better to use and in which situations. Byee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need help with a regular expression
Please ignor... I got it... alex On Thu, 30 Sep 2004 16:22:02 -0500, Alex Hogan [EMAIL PROTECTED] wrote: I have a series of questions that are multiple choice. Some of the questions have multiple answers to them. Those questions have answers that are indicated by a checkbox that is named something like; Q4_1 Q4_2 etc... Of those, each one of the checkboxes that indicate a correct answer is given a point value. I need only get the total points of question 4 and not the individual checkbox scores. What I have; foreach($_POST as $key = $value){ if($key != 'Submit'){ if($key == ereg(^Q4_.[0-9]$, $key)){ $Q4score[$i] = $value; } print $key.: .$value.br; $Score[$i] = $value; } $i++; } print 'Q4: '.array_sum($Q4score); - Returns 0 print 'Total: '.array_sum($Score); - Returns correctly Is my ereg() wrong? My understanding is ereg(^Q4_.[0-9]$, $key) should look for a $key starting with 'Q4_' followed by a single number and place those values into an array named $Q4scores. What am I missing? Thanks, alex hogan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need help... getting information from external xml document
Also, forgot to ask if there are any specific settings that need to be set within php for it to work. On Thu, 23 Sep 2004 09:55:32 -0400, GH [EMAIL PROTECTED] wrote: I am new to php and xml and would like to know how I can set a variable (i.e $terror_threat_level) equal to the value of Threat_Advisory's Condition in the following that is available at http://www.dhs.gov/dhspublic/getAdvisoryCondition ... ?xml version=1.0 encoding=UTF-8 ? THREAT_ADVISORY CONDITION=ELEVATED / can anyone help? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need help... getting information from external xml document
From: GH [EMAIL PROTECTED] I am new to php and xml and would like to know how I can set a variable (i.e $terror_threat_level) equal to the value of Threat_Advisory's Condition in the following that is available at http://www.dhs.gov/dhspublic/getAdvisoryCondition ... ?xml version=1.0 encoding=UTF-8 ? THREAT_ADVISORY CONDITION=ELEVATED / Hmmm... I couldn't get SimpleXML to work with this data; maybe it doesn't pick up attributes or that XML could be better formed??? I'm sure there's an XML way to do it, but if you don't find anything, here's a quick way to match it with regular expressions. ? $str = file_get_contents('http://www.dhs.gov/dhspublic/getAdvisoryCondition'); preg_match('/CONDITION=([^]+)/',$str,$match); echo $match[1]; ? Off topic, I was thinking this XML would be better formed XML as: THREAT_ADVISORY_CONDITIONELEVATED/THREAT_ADVISORY_CONDITION and then you can use: $str = file_get_contents('http://www.dhs.gov/dhspublic/getAdvisoryCondition'); $xml = simplexml_load_string($str); but simplexml simply has one element, [0] = ELEVATED. You can't do $xml[0] or $xml-0 (since $xml is an object), etc and you have to do $threat = current($xml); echo $threat; You can cast $xml to an array, but that still doesn't seem very intuitive: $a = (array)$xml; echo $a[0]; I'm not an XML wiz by any means... is this just bad XML that SimpleXML is handling the best it can or is SimpleXML acting up?? If it's bad XML put out by DHS, then I can pass some messages up the chain... :) ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need help... getting information from external xml document
As John noted at the end... I do not have control over the format of the XML... but thanks I will try... BTW i am using PHP4 is SimpleXML able to be used and if so how? Sorry for the newbie question On Thu, 23 Sep 2004 10:44:31 -0400, John Holmes [EMAIL PROTECTED] wrote: From: GH [EMAIL PROTECTED] I am new to php and xml and would like to know how I can set a variable (i.e $terror_threat_level) equal to the value of Threat_Advisory's Condition in the following that is available at http://www.dhs.gov/dhspublic/getAdvisoryCondition ... ?xml version=1.0 encoding=UTF-8 ? THREAT_ADVISORY CONDITION=ELEVATED / Hmmm... I couldn't get SimpleXML to work with this data; maybe it doesn't pick up attributes or that XML could be better formed??? I'm sure there's an XML way to do it, but if you don't find anything, here's a quick way to match it with regular expressions. ? $str = file_get_contents('http://www.dhs.gov/dhspublic/getAdvisoryCondition'); preg_match('/CONDITION=([^]+)/',$str,$match); echo $match[1]; ? Off topic, I was thinking this XML would be better formed XML as: THREAT_ADVISORY_CONDITIONELEVATED/THREAT_ADVISORY_CONDITION and then you can use: $str = file_get_contents('http://www.dhs.gov/dhspublic/getAdvisoryCondition'); $xml = simplexml_load_string($str); but simplexml simply has one element, [0] = ELEVATED. You can't do $xml[0] or $xml-0 (since $xml is an object), etc and you have to do $threat = current($xml); echo $threat; You can cast $xml to an array, but that still doesn't seem very intuitive: $a = (array)$xml; echo $a[0]; I'm not an XML wiz by any means... is this just bad XML that SimpleXML is handling the best it can or is SimpleXML acting up?? If it's bad XML put out by DHS, then I can pass some messages up the chain... :) ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need help... getting information from external xml document
I am new to php and xml and would like to know how I can set a variable (i.e $terror_threat_level) equal to the value of Threat_Advisory's Condition in the following that is available at http://www.dhs.gov/dhspublic/getAdvisoryCondition ... ?xml version=1.0 encoding=UTF-8 ? THREAT_ADVISORY CONDITION=ELEVATED / if you are using php 5 you could try this: $file = 'http://www.dhs.gov/dhspublic/getAdvisoryCondition'; $xml = simplexml_load_file($file); print findAttribute($xml,'CONDITION'); function findAttribute($object, $attribute) { foreach($object-attributes() as $a = $b) { if ($a == $attribute) { $return = $b; } } if($return) { return $return; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need help... getting information from external xml document
From: GH [EMAIL PROTECTED] BTW i am using PHP4 is SimpleXML able to be used and if so how? No, SimpleXML is for PHP5 only. You're probably better off using the regular expression method rather than loading an entire XML solution for such a small bit of code... ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need help... getting information from external xml document
Sounds good... from that RegExpression what exactly is that returning? just the value in the quotes? Thanks Gary On Thu, 23 Sep 2004 11:11:16 -0400, John Holmes [EMAIL PROTECTED] wrote: From: GH [EMAIL PROTECTED] BTW i am using PHP4 is SimpleXML able to be used and if so how? No, SimpleXML is for PHP5 only. You're probably better off using the regular expression method rather than loading an entire XML solution for such a small bit of code... ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need help... getting information from external xml document
As John noted at the end... I do not have control over the format of the XML... but thanks I will try... BTW i am using PHP4 is SimpleXML able to be used and if so how? I would just use John's regex idea, I am guessing (i could be wrong though, I have been many times before) that the format is not going to change much $str = file_get_contents('http://www.dhs.gov/dhspublic/getAdvisoryCondition'); preg_match('/CONDITION=([^]+)/',$str,$match); echo $match[1]; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need Help for Session
Afzal Hussain ) wrote: Sir, I am afzal hussain from bangladesh. Acually i am getting some problem using session in php. This is the sample code that i have written, session_start(); //$vbl=This variable is registered; //session_register('vbl'); $_SESSION['vb1'] = This variable is registered; //echo $vbl; echo $_SESSION['vb1']; ? it shows this output. Warning: Cannot send session cookie - headers already sent by (output started at c:/program files/abria merlin/apache/htdocs/session.php:3) in c:/program files/abria merlin/apache/htdocs/session.php on line 4 Warning: Cannot send session cache limiter - headers already sent (output started at c:/program files/abria merlin/apache/htdocs/session.php:3) in c:/program files/abria merlin/apache/htdocs/session.php on line 4 Warning: open(/tmp\sess_178d4e9e23a4d7b1f061f93e7f172496, O_RDWR) failed: m (2) in c:/program files/abria merlin/apache/htdocs/session.php on line 4 This variable is registered Finding no other way i am sending this email to u. Could u pls tell me what s\could be the problem. and How i can i solve that problem. thanks you very much. afzal Hussian - Do you Yahoo!? Win 1 of 4,000 free domain names from Yahoo! Enter now. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need Help for Session
1.You must call session_start before making a HTML for client. 2.Please use if (!session_is_registered('vb1')) session_register('vb1'); --- S. Kang [EMAIL PROTECTED] wrote: Afzal Hussain ) wrote: Sir, I am afzal hussain from bangladesh. Acually i am getting some problem using session in php. This is the sample code that i have written, session_start(); //$vbl=This variable is registered; //session_register('vbl'); $_SESSION['vb1'] = This variable is registered; //echo $vbl; echo $_SESSION['vb1']; ? it shows this output. Warning: Cannot send session cookie - headers already sent by (output started at c:/program files/abria merlin/apache/htdocs/session.php:3) in c:/program files/abria merlin/apache/htdocs/session.php on line 4 Warning: Cannot send session cache limiter - headers already sent (output started at c:/program files/abria merlin/apache/htdocs/session.php:3) in c:/program files/abria merlin/apache/htdocs/session.php on line 4 Warning: open(/tmp\sess_178d4e9e23a4d7b1f061f93e7f172496, O_RDWR) failed: m (2) in c:/program files/abria merlin/apache/htdocs/session.php on line 4 This variable is registered Finding no other way i am sending this email to u. Could u pls tell me what s\could be the problem. and How i can i solve that problem. thanks you very much. afzal Hussian - Do you Yahoo!? Win 1 of 4,000 free domain names from Yahoo! Enter now. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = -DIGITAL SIGNATURE--- ///Mohsen Pahlevanzadeh Network administrator programmer My home phone is: +98213810146 My email address is m_pahlevanzadeh at yahoo dot com My website is: http://webnegar.net __ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Need help
On 09 April 2004 16:39, Strogg wrote: [snip original problem for which a fix has been posted] $taxrate = 0.175; //local tax rate in UK is 17.5% You should note that UK VAT is always rounded *down*, so that this: $totalamount = $totalamount * (1 + $taxrate); should be something like: $totalamount += round($totalamount*$taxrate-0.00499, 2); or: $totalamount += floor($totalamount*taxrate*100)/100; Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need help
This the script that is falling over. It calculates everything correct until the amount reaches £1,000, and then it falls over and reads only the 1 before the comma, and then outputs the price to be paid as £1.18 (£1 + the taxrate (0.175 rounded up)) ? echo pOrder Processed at ; echo date(H:i, jS F); echo br; echo pYou ordered:; echo br; echo $tyreqty. Tyresbr; echo $oilqty. Bottles of Oilbr; echo $sparkqty. Spark Plugs; $totalqty = 0; $totalamount = 0.00; define(TYREPRICE, 100); define(OILPRICE, 10); define(SPARKPRICE, 5); $totalqty = $tyreqty + $oilqty + $sparkqty; $totalamount = $tyreqty * TYREPRICE + $oilqty * OILPRICE + $sparkqty * SPARKPRICE; $totalamount = number_format($totalamount, 2); echo br\n; echo Items Ordered: .$totalqty.br\n; echo Subtotal: £.$totalamount.br\n; $taxrate = 0.175; //local tax rate in UK is 17.5% $totalamount = $totalamount * (1 + $taxrate); $totalamount = number_format($totalamount, 2); echo Total Including Tax: £.$totalamount.br\n; ? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.655 / Virus Database: 420 - Release Date: 08/04/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need help
Strogg wrote: This the script that is falling over. It calculates everything correct until the amount reaches £1,000, and then it falls over and reads only the 1 before the comma, and then outputs the price to be paid as £1.18 (£1 + the taxrate (0.175 rounded up)) ? echo pOrder Processed at ; echo date(H:i, jS F); echo br; echo pYou ordered:; echo br; echo $tyreqty. Tyresbr; echo $oilqty. Bottles of Oilbr; echo $sparkqty. Spark Plugs; $totalqty = 0; $totalamount = 0.00; define(TYREPRICE, 100); define(OILPRICE, 10); define(SPARKPRICE, 5); $totalqty = $tyreqty + $oilqty + $sparkqty; $totalamount = $tyreqty * TYREPRICE + $oilqty * OILPRICE + $sparkqty * SPARKPRICE; $totalamount = number_format($totalamount, 2); echo br\n; echo Items Ordered: .$totalqty.br\n; echo Subtotal: £.$totalamount.br\n; $taxrate = 0.175; //local tax rate in UK is 17.5% $totalamount = $totalamount * (1 + $taxrate); $totalamount = number_format($totalamount, 2); echo Total Including Tax: £.$totalamount.br\n; ? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.655 / Virus Database: 420 - Release Date: 08/04/2004 Here's your problem: $totalamount = number_format($totalamount, 2); That creates a string with a comma in it. When you try to read it as a number again, the comma screws it up. Wait to do the number_format until you output like this: echo Subtotal: £.number_format($totalamount, 2).br\n; ... echo Total Including Tax: £.number_format($totalamount, 2).br\n; In other words, instead of assigning the number formatted string back to $totalamount, format it only on output. -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need help with output from form to .txt file
Kristers Hotmail wrote: Hi!! When i send data from a form and there is some special characters like ' \ php seems to add an extra \ before every special character in the transfer from the form to the point when I put the data in the .txt file where i store it. It is a guestbook I'm using the script for so it is a bit anoying. I also have a guestbook where I use MySQL as database and I do not have the same problem there. Esample: I'm sendeing hello from the form The result I get in my gb.txt file is \hello\ Why is that?? Can anyone help me Regards Krister Hi, there is a function which delete the backslahes. Before you put the text in the file, do stripslashes($yourstring) -- - RPG Genesis 2004 - - Make your dreams believable - http://www.rpg-genesis.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: need help getting one variable
In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... hello all i need help to enter one variable in a cookie and then retreive it back later, i know this probably sounds dumb to most but this is really the first time ive tried working with cookies so please bear with me, thanks for any help. http://www.php.net/setcookie is a good starting point. -- Quod subigo farinam A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need help
?php echo $_SERVER['REMOTE_ADDR']; ? Mba wrote: How could I use this php code, ?php print($REMOTE_ADDR); ? in order to show the ip in a web page? thanks - Do you Yahoo!? Free Pop-Up Blocker - Get it now -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need Help With gethostbyname()
Well, try only the toplevel domain... For example, I have like hns345667dsvdtrt34.telia.com, I doubt that is registred, but telia.com sure is... I hope.. :S -- // DvDmanDT MSN: [EMAIL PROTECTED] Mail: [EMAIL PROTECTED] Dan Anderson [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] I have a section of my script where I call gethostbyname($hostname) . For some host names that are not registered (according to register.com) I am still getting an IP address returned? What is happening? -Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Need Help With gethostbyname()
I have a section of my script where I call gethostbyname($hostname) . For some host names that are not registered (according to register.com) I am still getting an IP address returned? What is happening? Well, try only the toplevel domain... For example, I have like hns345667dsvdtrt34.telia.com, I doubt that is registred, but telia.com sure is... I hope.. :S telia.com is a second level, not a top level, .com is the top level in your example. Also, only looking up the second level is a bad idea. In many cases the third level is actually being used to signify something (the host). All of the hosts in our server farm use the same second level, but the third level signifies which box I'm talking about. If I do an nslookup on my second level I'm going to get the IP bound to the webserver that hosts the corporate site (because that's how we have it set up), but if I do an nslookup on servername.domain.com (servername being the name of one of the servers in our farm) I'm going to get the IP for the host designated by servername. For example, ftb.ca.gov (California franchise tax board) is not the same as dot.ca.gov (California Dept. of Transportation) which is not the same as cdfa.ca.gov (department of food and agriculture), but they all fall under the ca.gov second level because they are all government offices for the state of California, which falls under the .gov top level because it is a government branch within the United States. To answer the original question, verisign has decided it is a good idea to wildcard the .com and .net TLDs to point to http://sitefinder.verisign.com, so if you do a look up on a non-existant domain in those TDLs it will now give an IP. I believe a BIND patch has already been released to negate this change. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need Help With gethostbyname()
Ok, I was wrong about top level stuff... My point was that you don't register every box at like register.com, you only register secondlevel.. Register.com only checks second level (I guess), while php queries the name on some dns server, which gives php another dns server and so on, until it finds what it's looking for... Gah, jusst forget I even started typing this message, I have no real idea what I'm talking about... -- // DvDmanDT MSN: [EMAIL PROTECTED] Mail: [EMAIL PROTECTED] Jennifer Goodie [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] I have a section of my script where I call gethostbyname($hostname) . For some host names that are not registered (according to register.com) I am still getting an IP address returned? What is happening? Well, try only the toplevel domain... For example, I have like hns345667dsvdtrt34.telia.com, I doubt that is registred, but telia.com sure is... I hope.. :S telia.com is a second level, not a top level, .com is the top level in your example. Also, only looking up the second level is a bad idea. In many cases the third level is actually being used to signify something (the host). All of the hosts in our server farm use the same second level, but the third level signifies which box I'm talking about. If I do an nslookup on my second level I'm going to get the IP bound to the webserver that hosts the corporate site (because that's how we have it set up), but if I do an nslookup on servername.domain.com (servername being the name of one of the servers in our farm) I'm going to get the IP for the host designated by servername. For example, ftb.ca.gov (California franchise tax board) is not the same as dot.ca.gov (California Dept. of Transportation) which is not the same as cdfa.ca.gov (department of food and agriculture), but they all fall under the ca.gov second level because they are all government offices for the state of California, which falls under the .gov top level because it is a government branch within the United States. To answer the original question, verisign has decided it is a good idea to wildcard the .com and .net TLDs to point to http://sitefinder.verisign.com, so if you do a look up on a non-existant domain in those TDLs it will now give an IP. I believe a BIND patch has already been released to negate this change. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need Help With gethostbyname()
BIND9 isn't the only game in town... Here's something from bugtraq Worth noting (although a bit OT for php-general) that versign mananged to introduce a nice little XSS w/ this- see full-disclosure list for details -Evan -- Forwarded Message -- Subject: Re: Verisign abusing .COM/.NET monopoly, BIND releases new Date: Wed, 17 Sep 2003 18:19:32 -0400 (EDT) From: Damaged Industries [EMAIL PROTECTED] To: [EMAIL PROTECTED] On Wed, 17 Sep 2003, SR wrote: This is simply amazing, Verisign has just turned the .COM and .NET TLD DNS servers up-side-down for their own economical gain and, in doing so, disrupted network traffic for most of the Internet. Mail administrators who use any non-existant DNSBL to mark email as spam suddenly has all their mails deleted, people using localhost.localdomain.com on their servers for administrative purposes are scrambling to find out the cause of their problems and DNS problems arise everywhere as neg caching is essentially disabled and all DNS caches have to cache each and every randomly typed DNS query. The BIND patch that prevents this should be released Wednesday. djbdns already has a patch (make that two patches). They are available from djbdns.org Several patches have been out: Bind9 patch: http://www.isc.org/products/BIND/delegation-only.html Bind8 patch: http://achurch.org/bind-verisign-patch.html Djbdns patch: http://tinydns.org/djbdns-1.05-ignoreip.patch PowerDNS patch: http://www.imperialviolet.org/binary/powerdns.patch Userfriendly :) http://ars.userfriendly.org/cartoons/?id=20030917mode=classic -- damaged --- On Wednesday 17 September 2003 04:31 pm, Jennifer Goodie wrote: I have a section of my script where I call gethostbyname($hostname) . For some host names that are not registered (according to register.com) I am still getting an IP address returned? What is happening? Well, try only the toplevel domain... For example, I have like hns345667dsvdtrt34.telia.com, I doubt that is registred, but telia.com sure is... I hope.. :S telia.com is a second level, not a top level, .com is the top level in your example. Also, only looking up the second level is a bad idea. In many cases the third level is actually being used to signify something (the host). All of the hosts in our server farm use the same second level, but the third level signifies which box I'm talking about. If I do an nslookup on my second level I'm going to get the IP bound to the webserver that hosts the corporate site (because that's how we have it set up), but if I do an nslookup on servername.domain.com (servername being the name of one of the servers in our farm) I'm going to get the IP for the host designated by servername. For example, ftb.ca.gov (California franchise tax board) is not the same as dot.ca.gov (California Dept. of Transportation) which is not the same as cdfa.ca.gov (department of food and agriculture), but they all fall under the ca.gov second level because they are all government offices for the state of California, which falls under the .gov top level because it is a government branch within the United States. To answer the original question, verisign has decided it is a good idea to wildcard the .com and .net TLDs to point to http://sitefinder.verisign.com, so if you do a look up on a non-existant domain in those TDLs it will now give an IP. I believe a BIND patch has already been released to negate this change. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need Help With gethostbyname()
* Thus wrote Jennifer Goodie ([EMAIL PROTECTED]): I have a section of my script where I call gethostbyname($hostname) . For some host names that are not registered (according to register.com) I am still getting an IP address returned? What is happening? Well, try only the toplevel domain... For example, I have like hns345667dsvdtrt34.telia.com, I doubt that is registred, but telia.com sure is... I hope.. :S To answer the original question, verisign has decided it is a good idea to wildcard the .com and .net TLDs to point to http://sitefinder.verisign.com, so if you do a look up on a non-existant domain in those TDLs it will now give an IP. I believe a BIND patch has already been released to negate this change. hmm.. that explains quite a bit. I was wondering how opera got there on a lookup that should have been bad. Time to block that IP now.. geesh. I dont want to be going to that site if the lookup fails. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need help on screen display error
I see a couple have tried my poll. Please ask and I will send that php file... Gloria Gloria L. McMillan wrote: Hi, all! I have a working database at: http://dakotacom.net/~glomc/forms/CAT.html It does send info to the database, but only shows [ at the upper left of screen when it is supposed to print to screen. Could somebody help me find what is wrong in my .php file? Thanks, Gloria -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: need help with MySQL full text searching!!!!
Hi James so what you are saying is that if I am not running mysql 4.0.10-gamma then the full text search wont work. Strange because if I run the full text search on both full text indexed fields I get the correct resultset, however I only want to do a full text search on a column at a time, let me explain why: because I have a title field and an abstract field which are both full text, but i give the user the option of either searching for the title or the abstract thats why I have them both full text indexed but would only like to query 1 at a time. So I am still not sure what to do.Could you please give me more advice. thanx in Advance Angelo - Original Message - From: James Rodenkirch [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, July 21, 2003 6:27 PM Subject: [PHP] Re: need help with MySQL full text searching You need to use mysql 4.0.10-gamma for full text searching to work Angelo Zanetti wrote: Hi I have a table which contains 3 fields (ID, Title, Abstract) the title and abstract fields have been fulltext indexes like this: ALTER TABLE biblio ADD FULLTEXT (title,abstract); that worked fine, however my problem is whenever I want to do a select statement only comparing 1 of the columns to inputted data ( in a Select statement): $result = mysql_query(SELECT * FROM Biblio WHERE MATCH (title) AGAINST ('$searchString')); It gives me this error: Can't find FULLTEXT index matching the column list. It appears that i cant just compare a single fulltext indexed column if there are other fulltext indexed columns. When I try it with both columns then it works but I just want to compare 1 column. eg: $result = mysql_query(SELECT * FROM Biblio WHERE MATCH (title, abstract) AGAINST ('$searchString')); So is there anyway that I can just compare 1 column with text entered? Do I have t make some sort of temporary table to do this? All the examples I have found show the select statement with 2 columns or if they use 1 coumn its because there is only 1 column in their table. Any help would be appreciated! TIA Angelo ps. sorry that this may be a bit off topic -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: need help with MySQL full text searching!!!!
On Tuesday 22 July 2003 15:46, Angelo Zanetti wrote: Hi James so what you are saying is that if I am not running mysql 4.0.10-gamma then the full text search wont work. Strange because if I run the full text search on both full text indexed fields I get the correct resultset, however I only want to do a full text search on a column at a time, let me explain why: because I have a title field and an abstract field which are both full text, but i give the user the option of either searching for the title or the abstract thats why I have them both full text indexed but would only like to query 1 at a time. So I am still not sure what to do.Could you please give me more advice. thanx in Advance This has absolutely nothing to do with PHP. Please take it to the MySQL list. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Chairman of the Bored. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: need help with MySQL full text searching!!!!
You need to use mysql 4.0.10-gamma for full text searching to work Angelo Zanetti wrote: Hi I have a table which contains 3 fields (ID, Title, Abstract) the title and abstract fields have been fulltext indexes like this: ALTER TABLE biblio ADD FULLTEXT (title,abstract); that worked fine, however my problem is whenever I want to do a select statement only comparing 1 of the columns to inputted data ( in a Select statement): $result = mysql_query(SELECT * FROM Biblio WHERE MATCH (title) AGAINST ('$searchString')); It gives me this error: Can't find FULLTEXT index matching the column list. It appears that i cant just compare a single fulltext indexed column if there are other fulltext indexed columns. When I try it with both columns then it works but I just want to compare 1 column. eg: $result = mysql_query(SELECT * FROM Biblio WHERE MATCH (title, abstract) AGAINST ('$searchString')); So is there anyway that I can just compare 1 column with text entered? Do I have t make some sort of temporary table to do this? All the examples I have found show the select statement with 2 columns or if they use 1 coumn its because there is only 1 column in their table. Any help would be appreciated! TIA Angelo ps. sorry that this may be a bit off topic -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need Help: Please click on Test Link
Well, worked nicely for me... Can you tell me where you can fetch this kind of information? -- [Win2000 | Apache/1.3.23] [PHP/4.2.3 | MySQL/3.23.53] Ivo Fokkema PHP MySQL programmer Leiden University Medical Centre Netherlands Suhas Pharkute [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi I need your help. Can you please visit a site http://sspsoft.com/test/ip2ll.php (in case if you cannot get it, please click on http://ns1.webhostdns.us and then click on the website link.) which should identify your Country, State, City. Please click on one of the buttons to provide feedback. I am trying to get hits from different parts of the world to make sure that it works. Planning to develop a webservice from this. Thanks in advance, Suhas _ Encrypt your PHP code for FREE at http://encphp.sspsoft.com _ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need Help: Please click on Test Link
Suhas Pharkute wrote: http://sspsoft.com/test/ip2ll.php (in case if you cannot get it, please click on http://ns1.webhostdns.us and then click on the website link.) which should identify your Country, State, City. Please click on one of the buttons to provide feedback. I'm in London, England and got the following result: United Kingdom, England, Southend-on-Sea So providing feedback with your options is a little tricky. England is a country not a state. It'll cause confusion if you regard it as such. Southend-on-Sea is not where I'm located. Close but no cigar :) Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Need Help: Please click on Test Link
All I got was Error -Original Message- From: Peter Clarke [mailto:[EMAIL PROTECTED] Sent: Thursday, July 17, 2003 7:14 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: Need Help: Please click on Test Link Suhas Pharkute wrote: http://sspsoft.com/test/ip2ll.php (in case if you cannot get it, please click on http://ns1.webhostdns.us and then click on the website link.) which should identify your Country, State, City. Please click on one of the buttons to provide feedback. I'm in London, England and got the following result: United Kingdom, England, Southend-on-Sea So providing feedback with your options is a little tricky. England is a country not a state. It'll cause confusion if you regard it as such. Southend-on-Sea is not where I'm located. Close but no cigar :) Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: need help w/ sql query - update and select at once
you probably cant ge this to work in PHP. try creating a temporary table -shiva [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] hi i'm trying to get this sql query to work, i'm trying to update and select at the same time, i'm not even sure if this is even possible update db.tablename set field1='yes' where (select * from db.tablename,db.tablename2 where db.tablename.userid=db.tablename2.userid); basically i have a column called 'userid'. this column exists in both tablename, and tablename2. where the value of userid in tablename is equal to the value of userid in tablename2, i'd like to set the value of field1 to 'yes'. can this be done from the command line? or am i better off writing another php page to accomplish this? thanks again redmond -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: need help w/ sql query - update and select at once
you probably cant ge this to work in MySQL. try creating a temporary table Shivanischal A [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] you probably cant ge this to work in PHP. try creating a temporary table -shiva [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] hi i'm trying to get this sql query to work, i'm trying to update and select at the same time, i'm not even sure if this is even possible update db.tablename set field1='yes' where (select * from db.tablename,db.tablename2 where db.tablename.userid=db.tablename2.userid); basically i have a column called 'userid'. this column exists in both tablename, and tablename2. where the value of userid in tablename is equal to the value of userid in tablename2, i'd like to set the value of field1 to 'yes'. can this be done from the command line? or am i better off writing another php page to accomplish this? thanks again redmond -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: need help on coding
Shien Hang Low [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] From: Gabor Hojtsy [EMAIL PROTECTED] To: Shien Hang Low [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: need help on coding Date: Sun, 15 Jun 2003 12:26:53 +0200 Please ask support questions at [EMAIL PROTECTED] Goba Shien Hang Low : hi there, i am very sorry, previously i have send you an email but it is the email wich code is wrong, so this is the correct one. thank you i am a php code user and i have below questions and problems wish you could help me out and i think it is very easy for you. thank you . problem : code : ? $data= message; echo $data; ? output : message --- if i want the output to be : message i try to used the below code but fail: ? $data = message; echo $data; ? so i wonder if i want to get the output that with the 'quatation' mark how can i do it, your help means alot to me thank you for your time and patient . best regards, shienhang _ Are you in love? Find a date on MSN Personals http://match.msn.com.my/ _ Download ringtones, logos and picture messages from MSN Malaysia http://www.msn.com.my/mobile/ringtones/default.asp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: need help on coding
you need to quote in your code. Thomas On Sun, 15 Jun 2003 17:01:03 + [EMAIL PROTECTED] (Shien Hang Low) wrote: From: Gabor Hojtsy [EMAIL PROTECTED] To: Shien Hang Low [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: need help on coding Date: Sun, 15 Jun 2003 12:26:53 +0200 Please ask support questions at [EMAIL PROTECTED] Goba Shien Hang Low : hi there, i am very sorry, previously i have send you an email but it is the email wich code is wrong, so this is the correct one. thank you i am a php code user and i have below questions and problems wish you could help me out and i think it is very easy for you. thank you . problem : code : ? $data= message; echo $data; ? output : message --- if i want the output to be : message i try to used the below code but fail: ? $data = message; echo $data; ? so i wonder if i want to get the output that with the 'quatation' mark how can i do it, your help means alot to me thank you for your time and patient . best regards, shienhang _ Are you in love? Find a date on MSN Personals http://match.msn.com.my/ _ Download ringtones, logos and picture messages from MSN Malaysia http://www.msn.com.my/mobile/ringtones/default.asp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: need help on coding
Shien Hang Low [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] problem : code : ? $data= message; echo $data; ? output : message --- if i want the output to be : message i try to used the below code but fail: ? $data = message; echo $data; ? so i wonder if i want to get the output that with the 'quatation' mark how can i do it, your help means alot to me thank you for your time and patient . There are two ways of doing this: First, you could use a literal string (using single- quote marks ie ' ) $data = ' message '; Secondly, you could escape the quotation marks inside the string, ie $data = \message\ ; I find the first method is a little easier to read; however, single-quoted strings are not evaluated for variable substitution, ie $insert = 'test'; // $data = ' $insert ';// will not work! $data = ' ' . $insert . ' '; $data = \$insert\ ; Hope this helps. -- Hugh Bothwell [EMAIL PROTECTED] Kingston ON Canada v3.1 GCS/E/AT d- s+: a- C+++ L+$ P+ E- W+++$ N++ K? w++ M PS+ PE++ Y+ PGP+ t-- 5++ !X R+ tv b DI+++ D-(++) G+ e(++) h-- r- y+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need help with display of results
I will send my whole php file to anybpody willing to help me display this one long answer question. Some previous helpers added some stuff that isn't being used, but I don't know how to get rid of it. Gloria Gloria L. McMillan wrote: Hi, again! I did not see my question as yet so I will repost it. I have had help writing HTML code to display the results of my PHP-- McSQL actions. But when I attempt to show the DATE and q40 (comments) with the HTML code below, all I see on screen is: ]in the upper left corner. URL: http://DakotaCom.net/~glomc/forms/Adj03.html (A poll on part-time faculty) Here's the code for the display that is not working... But the ] may refer to earlier code in this long php file. I did not send the whole file, only the HTML part. /* Printing results in HTML */ /* COMMENTED 2002-05-02 print table\n; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { print \ttr\n; foreach ($line as $col_value) { print \t\ttd$col_value/td\n; } print \t/tr\n; } print /table\n; */ while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { printf( div class=\colorfield\ table trthDATE/ththCOMMENTS/th/tr\n trtd%s/tdtd%s/td/tr /table /div br / br /\n, $row['added']); $row['q40']); } /* Free resultset */ mysql_free_result($result); /* Close the database connection */ mysql_close($link); ? /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need help with coding problem
You seem to be missing your last bracket for the while loop that you started to state the end of the block. Ben C. [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have a subscription service and am trying to not allow the buyer to proceed purchasing another subscription if one of their subscriptions is over 29 days past due in their payment. I am trying to query each invoice and checking to see if it is past due more than 29 days, if it is I want a message to come up saying that it can not proceed because they account is not current. Can you look at the code below and let me know if you see something wrong. It is not working for me. Thanks. --START CODE-- $sql_1 =SELECT * FROM $table_name WHERE buyerid = \$buyerid\ AND paidinfull is NULL; $result_1 = @mysql_query($sql_, $connection) or die(Error # . mysql_errno() . : . mysql_error()); if(mysql_num_rows($result_1) 0){ while($row = mysql_fetch_array($result_1)) { $duedate1 = $row['duedate']; $paiddate1 = $row['paiddate']; $paidinfull = $row['paidinfull']; $duedatestamp = strtotime($duedate1); // due date unix timestamp $difference = time() - $duedatestamp; // diff in seconds $differencedays = $difference / 86400; // 60 x 60 x 24 hours floor rounds the days down $differencedays1 = floor($differencedays); $paiddatestamp = strtotime($paiddate1);// paid date unix timestamp $diffdays = floor(((paiddatestamp - duedatestamp) / 86400)); if (!$paiddate1) { $daysout = $differencedays1; } else { $daysout = $diffdays; } if ($daysout 29) { echo You cannot add this product as your account is 30 days past due; exit; } END CODE-- -- The content of this email message and any attachments are confidential and may be legally privileged, intended solely for the addressee. If you are not the intended recipient, be advised that any use, dissemination, distribution, or copying of this e-mail is strictly prohibited. If you receive this message in error, please notify the sender immediately by reply email and destroy the message and its attachments. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: need help with parsing form input ...
function make_alphanum($string_val) { return eregi_replace([^[:alnum:]], , $string_val); } strips everything except ALPHA and NUM Chars Joel Kenn Murrah [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Greetings. I'm out of my league here, not knowing enough about regular expressions yet to do this, so I desperately need someone's help ... I need to parse form input to eliminate unwanted characters (punctuation, mostly) ... for instance, if the web site visitor types smith,susan--33 into the field, i want to parse that line to eliminate the initial space, the comma, and the dashes so that $myvariable=smithsusan33 any help in doing this would be GREATLY appreciate. thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: need help with parsing form input ...
Thanks ... one more thing: is there a way to modify this to allow a period (dot) to included, as well as the alha and num characters? once again, thanks. function make_alphanum($string_val) { return eregi_replace([^[:alnum:]], , $string_val); } strips everything except ALPHA and NUM Chars Joel Kenn Murrah [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Greetings. I'm out of my league here, not knowing enough about regular expressions yet to do this, so I desperately need someone's help ... I need to parse form input to eliminate unwanted characters (punctuation, mostly) ... for instance, if the web site visitor types smith,susan--33 into the field, i want to parse that line to eliminate the initial space, the comma, and the dashes so that $myvariable=smithsusan33 any help in doing this would be GREATLY appreciate. thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: need help with parsing form input ...
eregi_replace([^[:alnum:].], , $string_val); notice the period after the first closing brace. Kenn Murrah [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks ... one more thing: is there a way to modify this to allow a period (dot) to included, as well as the alha and num characters? once again, thanks. function make_alphanum($string_val) { return eregi_replace([^[:alnum:]], , $string_val); } strips everything except ALPHA and NUM Chars Joel Kenn Murrah [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Greetings. I'm out of my league here, not knowing enough about regular expressions yet to do this, so I desperately need someone's help ... I need to parse form input to eliminate unwanted characters (punctuation, mostly) ... for instance, if the web site visitor types smith,susan--33 into the field, i want to parse that line to eliminate the initial space, the comma, and the dashes so that $myvariable=smithsusan33 any help in doing this would be GREATLY appreciate. thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: Need help with ? vs. php?
That's fixed. Thanks. Now, another problem. The data I capture in a form (web page 1) are not received by the PHP page (web page 2). Is there something different with the previous version of PHP? Thanks to all of you for your help. Jean-Louis -Original Message- From: LeTortorec, Jean-Louis Sent: Wednesday, March 05, 2003 11:59 AM To: '[EMAIL PROTECTED]' Subject: Need help with ? vs. php? Hello everyone, I've installed the Apache v2.0.44 with PHP4.3.1., under Windows. My pages starting and ending with ?? don't work anymore. I would have to change them to ?php...php?. Do you know if there is a way for keeping ? running? Thanks for your help.
Re: [PHP] RE: Need help with ? vs. php?
set register_globals=on in php.ini or use $_POST/$_GET super global array - Original Message - From: LeTortorec, Jean-Louis [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 05, 2003 12:14 PM Subject: [PHP] RE: Need help with ? vs. php? That's fixed. Thanks. Now, another problem. The data I capture in a form (web page 1) are not received by the PHP page (web page 2). Is there something different with the previous version of PHP? Thanks to all of you for your help. Jean-Louis -Original Message- From: LeTortorec, Jean-Louis Sent: Wednesday, March 05, 2003 11:59 AM To: '[EMAIL PROTECTED]' Subject: Need help with ? vs. php? Hello everyone, I've installed the Apache v2.0.44 with PHP4.3.1., under Windows. My pages starting and ending with ?? don't work anymore. I would have to change them to ?php...php?. Do you know if there is a way for keeping ? running? Thanks for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] RE: Need help with ? vs. php?
That's fixed. Thanks. Now, another problem. The data I capture in a form (web page 1) are not received by the PHP page (web page 2). Is there something different with the previous version of PHP? Register_globals ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need help with ? vs. php?
Don't know if anyone said it, but you do not need to use php?, it's invalid AFAIK... just probably as they said, set short_tags=On in php.ini or something similar... Jean-Louis Letortorec [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello everyone, I've installed the Apache v2.0.44 with PHP4.3.1., under Windows. My pages starting and ending with ?? don't work anymore. I would have to change them to ?php...php?. Do you know if there is a way for keeping ? running? Thanks for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need help storing and displaying html/text!
Hmmm... I guess no one is doing this??? Seems fairly common. Thanks! Shawn Shawn McKenzie [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have a form and I want the user to be able to enter html in a text area. This will then be stored in an array in a config file. Example $htmlstuff[1] = 'script type=text/javascriptsome stuff here/script'; When they visit the form again it will display as they entered it and they can modify it and save it back to the array. The problem is I keep getting multiple \ on the single and double quotes every time they submit the form, as well as multiple newlines and trailing spaces. I have looked at and tried combinations of stripslashes(), htmlspecialchars() and htmlentities(), so I don't need a link to the PHP manual. I can't find the right combination and don't know when to do what to get this to work. Can anyone give me a good example? Serious help appreciated... Thanks! -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need help storing and displaying html/text!
On Tuesday 11 February 2003 07:03, Shawn McKenzie wrote: Hmmm... I guess no one is doing this??? Seems fairly common. Patience. You should allow 1 day to give every list subscriber a chance to read your post. Shawn McKenzie [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have a form and I want the user to be able to enter html in a text area. This will then be stored in an array in a config file. Example $htmlstuff[1] = 'script type=text/javascriptsome stuff here/script'; When they visit the form again it will display as they entered it and they can modify it and save it back to the array. The problem is I keep getting multiple \ on the single and double quotes every time they submit the form, as well as multiple newlines and trailing spaces. I have looked at and tried combinations of stripslashes(), htmlspecialchars() and htmlentities(), so I don't need a link to the PHP manual. I can't find the right combination and don't know when to do what to get this to work. Can anyone give me a good example? The new recommended settings for magic_quotes_* are OFF so in psuedo-code: INPUT get data from post/get and validate html_entity_decode() the data addslashes() to data and insert into DB OUTPUT get data from DB htmlentities() the data output it -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* The answer to the question of Life, the Universe, and Everything is... Four day work week, Two ply toilet paper! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need help.
check your sql-statement! Thkiat wrote: Can someone tell me what should I do to solve this problem? Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/epcc/public_html/exoops/class/database/mysql.php on line 134 Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/epcc/public_html/exoops/class/database/mysql.php on line 134 Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/epcc/public_html/exoops/class/database/mysql.php on line 134 Warning: chmod failed: Operation not permitted in /home/epcc/public_html/exoops/modules/PP-News/include/admin_envois_mails.php on line 489 Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/epcc/public_html/exoops/class/database/mysql.php on line 134 Warning: chmod failed: Operation not permitted in /home/epcc/public_html/exoops/modules/PP-News/include/admin_envois_mails.php on line 489 Erreur : Directory /home/epcc/public_html/exoops/modules/PP-News/archives/ Directory , aucune archive n'a été crée Newsletter sent to 2 users -- Sebastian Mendel [EMAIL PROTECTED] www.sebastianmendel.de www.tekkno4u.de www.nofetish.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need help.
Show us your code...we can't read your mind. - Original Message - Thkiat wrote: Can someone tell me what should I do to solve this problem? Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/epcc/public_html/exoops/class/database/mysql.php on line 134 Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/epcc/public_html/exoops/class/database/mysql.php on line 134 Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/epcc/public_html/exoops/class/database/mysql.php on line 134 Warning: chmod failed: Operation not permitted in /home/epcc/public_html/exoops/modules/PP-News/include/admin_envois_mails.php on line 489 Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/epcc/public_html/exoops/class/database/mysql.php on line 134 Warning: chmod failed: Operation not permitted in /home/epcc/public_html/exoops/modules/PP-News/include/admin_envois_mails.php on line 489 Erreur : Directory /home/epcc/public_html/exoops/modules/PP-News/archives/ Directory , aucune archive n'a été crée Newsletter sent to 2 users -- Sebastian Mendel [EMAIL PROTECTED] www.sebastianmendel.de www.tekkno4u.de www.nofetish.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need help.
- Original Message - Thkiat wrote: Can someone tell me what should I do to solve this problem? Of course... Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/epcc/public_html/exoops/class/database/mysql.php on line 134 Fix your problem on line 134 Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/epcc/public_html/exoops/class/database/mysql.php on line 134 Same thing here... Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/epcc/public_html/exoops/class/database/mysql.php on line 134 and here... Warning: chmod failed: Operation not permitted in /home/epcc/public_html/exoops/modules/PP-News/include/admin_envois_mails.php on line 489 Ah, this is different. Here you'd want to fix your problem on line 489. Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/epcc/public_html/exoops/class/database/mysql.php on line 134 and again back to the line 134 thing that should be fixed by now. Warning: chmod failed: Operation not permitted in /home/epcc/public_html/exoops/modules/PP-News/include/admin_envois_mails.php on line 489 I already covered this one, right? Erreur : Directory /home/epcc/public_html/exoops/modules/PP-News/archives/ Directory , aucune archive n'a été crée Newsletter sent to 2 users ---John Holmes... PS: Your query is failing and you can't do chmod() because you're running as the web server. Post your code if you want more help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need Help in escaping and\
Hi \ is the escape character: $real_path=$real_path.\DefaultFld\SubFld\; should be $real_path=$real_path.\\DefaultFld\\SubFld\\; or $real_path .= \\DefaultFld\\SubFld\\; if you want to shorten it. Ppf wrote: Hi All: I am trying to generate the directory path dynamically to save the Uploaded file. when i try to concatnate the string with\ it generate an error, Hope you guys can help me in this here is the code $real_Path=realpath(../../index.php); $real_path=$real_path.\DefaultFld\SubFld\; Here is generate error, I don't know how to escape the and \ . I will appreciate your help Thanks in advance Prad __ Do you Yahoo!? U2 on LAUNCH - Exclusive greatest hits videos http://launch.yahoo.com/u2 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: need help with project
Check out FFL on Sourceforge.net. Currently, it is still a standalone PHP app, but in the near/coming soon future they are going to have it as a PHPWebsite Module. That is nice for me, since I have just converted to PHPWebsite (would have used nuke, but it pissed me off when it wouldn't let me do ANYTHING to config and install), so I will probably go ahead and download it, add it to my site somewhere, then use the module when it comes out. Will be nice to see how it works. Hope that helps somewhat. Kevin Myrick www.ultimatealchemy.com --- David Jackson [EMAIL PROTECTED] wrote: Karl -- Before you go reinventing the wheel , you might check http://freshmeat.net ... of course there is nothing actually wrong with reinventing the wheel *grin* David Jackson Karl James wrote: Hello people Im in need help with creating a system where it will let me Add/drop players off a web page..basically of a roster with salary cap control And I want to do trades as well This is for a fantasy football page. And I need to have username and passwords so my owners can login and there is no cheating.. http://www.ultimatefootballleague.com/index4.shtml This is my site. Please email me directly if you are interested in helping. Thanks Karl james -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: need help with project
Karl -- Before you go reinventing the wheel , you might check http://freshmeat.net ... of course there is nothing actually wrong with reinventing the wheel *grin* David Jackson Karl James wrote: Hello people Im in need help with creating a system where it will let me Add/drop players off a web page..basically of a roster with salary cap control And I want to do trades as well This is for a fantasy football page. And I need to have username and passwords so my owners can login and there is no cheating.. http://www.ultimatefootballleague.com/index4.shtml This is my site. Please email me directly if you are interested in helping. Thanks Karl james -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need help...
Received fro Yves le duaron : Try this for example ; '.$pattern.([^]*)?(\/)?(?(2)|(.*)?\/.$pattern.)'siU Please notice the U (ungreedy) to enhance the speed. This also match empty tags ... Sorry I have no login to send this to the mailing list, do this for me please ! Baroiller Pierre-Emmanuel [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] Hi everyone... I've got a little problem : I've got an html template, with javasript functions and stylesheets in many places... This html template is made via a big big template handler i've done... All seems to work... But, now, I would like to clean this html page to procude a 'readable' page If got a page like this : html head /head body xyxyxyxyxyx script function nb1() {} /script y yy style .outter {} /style /body /html And.. I would like to produce a page like this : html head style .outter {} /style script function nb1() {} /script /head body xyxyxyxyxyx y yy /body html Anyone have and idea ? I've tried with some preg_match_all() but... The only that work for me is '/head[^]*(.*)\/head[^]*/si' witch returns the head content... (where I'll add style script contents).. I've tried to change 'head' with 'script' or 'style' but.. It doesn't work... Like I'm not a regex guru ...I'm looking for help.. Regards, P.E. Baroiller -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need help...
Like noone seems to find something usefull to help me.. I've done the work myself :) I've tried this : $eregstr=/style[^]*([^]|[^\/]|\/[^style]|\/style[^])*\/style[^]* /msi; $data=preg_match_all($eregstr,$str,$matches); $str=preg_replace($eregstr,,$str); $styles=implode(\n,$matches[0]); $eregstr=/head[^]*(.*)\/head[^]*/si; $str=preg_replace($eregstr,head\\1.$styles./head,$str); And, actually, it works fine.. Any other solution ? ( faster...??) Baroiller Pierre-Emmanuel [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] Hi everyone... I've got a little problem : I've got an html template, with javasript functions and stylesheets in many places... This html template is made via a big big template handler i've done... All seems to work... But, now, I would like to clean this html page to procude a 'readable' page If got a page like this : html head /head body xyxyxyxyxyx script function nb1() {} /script y yy style .outter {} /style /body /html And.. I would like to produce a page like this : html head style .outter {} /style script function nb1() {} /script /head body xyxyxyxyxyx y yy /body html Anyone have and idea ? I've tried with some preg_match_all() but... The only that work for me is '/head[^]*(.*)\/head[^]*/si' witch returns the head content... (where I'll add style script contents).. I've tried to change 'head' with 'script' or 'style' but.. It doesn't work... Like I'm not a regex guru ...I'm looking for help.. Regards, P.E. Baroiller -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Need help with HTTP-Authentication
Hi David,. Http authentication is probly not what you would want to use. Especially if you want to program in timeouts, you would be better off using session based login variables. Cookies are even better with an encrypted pasword that has a windows of time that you have to goto other pages to renew. Why HTTP auth? Is it mandatory? Well its not mandatory i gues. I just thought that using HTTP-Authentication was one of the more secure ways of a login system? But i have heared not thats not the case, so i might go for a login system with sessions instead, or cookies. What would u use and why? What excactly do u mean with timeouts? I know this hasnt been any help, sorry! Thats okay;-) Keeps the discusion alive;-) Best regards, Davy Obdam, mailto:info;davyobdam.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need help with HTTP-Authentication
Hi, a simple question.. :) how do you do ? You can use 2 methods : with a .htaccess file on your webserver, updated with your table fields or a direct authentification with http headers and a little bit of php... Tell me more? may be I could help you. Regards, P.E. Baroiller Davy Obdam [EMAIL PROTECTED] a écrit dans le message de news: 001901c2747e$fa0184a0$[EMAIL PROTECTED] Hi People,. I have a problem with HTTP-Authentication, i have 2 users in my database, and i want both to be able to login. However it works, but only the first user is able to login. I Use a MySQL 3.23.xx database, PHP 4.2.3 and Apache 2.0.40. Can anyone help me with this, any help would be greatly apreciated. Thanks already;-)Maybe some examples?? ;-) Best regards, Davy Obdam, mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need help with HTTP-Authentication
direct authentication with http headers ?php file://if some_variable is NOT set then redirect to some other location session_start(); if (!isset($HTTP_GET_VARS[some_variable])) { header( 'Location: http://www.yourfavoritepage.com/login.php?v=nogo' ); } ? html !-- Your html code goes here -- /html THIS E-MAIL MESSAGE AND ALL ATTACHMENTS TRANSMITTED HEREWITH ARE TRADE SECRET AND/OR CONFIDENTIAL INFORMATION INTENDED ONLY FOR THE VIEWING AND USE OF ADDRESSEE. IF THE READER OF THIS MESSAGE IS NOT THE INTENDED RECIPIENT, YOU ARE HEREBY NOTIFIED THAT ANY REVIEW, USE, COMMUNICATION, DISSEMINATION, DISTRIBUTION OR COPYING OF THIS COMMUNICATION IS PROHIBITED. IF YOU HAVE RECEIVED THIS COMMUNICATION IN ERROR, PLEASE NOTIFY THE SENDER IMMEDIATELY BY TELEPHONE OR ELECTRONIC MAIL, AND DELETE THIS MESSAGE AND ALL COPIES AND BACKUPS THEREOF. THANK YOU FOR YOUR COOPERATION. -Original Message- From: BAROILLER [EMAIL PROTECTED] To: [EMAIL PROTECTED] [EMAIL PROTECTED]; [EMAIL PROTECTED] [EMAIL PROTECTED]; [EMAIL PROTECTED] [EMAIL PROTECTED] Date: Wednesday, October 16, 2002 2:15 AM Subject: [PHP] Re: Need help with HTTP-Authentication Hi, a simple question.. :) how do you do ? You can use 2 methods : with a .htaccess file on your webserver, updated with your table fields or a direct authentification with http headers and a little bit of php... Tell me more? may be I could help you. Regards, P.E. Baroiller Davy Obdam [EMAIL PROTECTED] a écrit dans le message de news: 001901c2747e$fa0184a0$[EMAIL PROTECTED] Hi People,. I have a problem with HTTP-Authentication, i have 2 users in my database, and i want both to be able to login. However it works, but only the first user is able to login. I Use a MySQL 3.23.xx database, PHP 4.2.3 and Apache 2.0.40. Can anyone help me with this, any help would be greatly apreciated. Thanks already;-)Maybe some examples?? ;-) Best regards, Davy Obdam, mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need help with HTTP-Authentication
Http authentication is probly not what you would want to use. Especially if you want to program in timeouts, you would be better off using session based login variables. Cookies are even better with an encrypted pasword that has a windows of time that you have to goto other pages to renew. Why HTTP auth? Is it mandatory? I know this hasnt been any help, sorry! Davy Obdam [EMAIL PROTECTED] wrote in message 001901c2747e$fa0184a0$960a@davy">news:001901c2747e$fa0184a0$960a@davy... Hi People,. I have a problem with HTTP-Authentication, i have 2 users in my database, and i want both to be able to login. However it works, but only the first user is able to login. I Use a MySQL 3.23.xx database, PHP 4.2.3 and Apache 2.0.40. Can anyone help me with this, any help would be greatly apreciated. Thanks already;-)Maybe some examples?? ;-) Best regards, Davy Obdam, mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: need help with a chat code problem
as each one I want to delete will be the smallest ID number (as it grows with each message added to it). I think you mean the lowest ID in the table and I suppose you're looking for a MySQL query. As of MySQL version 4 (currently in development) you can use delete from tablename where id in (select min( id ) from tablename);. I suppose you're not working with the development version of MySQL. For MySQL 3.x you will have to use two queries: - select min(id) from tablename - delete from tablename where id=min(id) Unfortunatly it's not possible to do delete from tablename where id=min(id), because the min-function is a so called group function. Grtz Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: need help
to do a comparison between two values / variables, you have to use == instead of = = is an assignment while == is a comparison operator if($row['gid'] == 0) { $rat = 110; } elseif($row['gid'] == 1) { $rat = 9.5; } else { $rat = 6.6; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: need help
From: B.C. Lance [EMAIL PROTECTED] Sent: Sunday, August 11, 2002 9:53 AM Subject: [PHP] Re: need help to do a comparison between two values / variables, you have to use == instead of = = is an assignment while == is a comparison operator if($row['gid'] == 0) I write these this way so that the php parser nags me about it if I forget the other equal sign: if(0 == $row['gid']) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: need help
From: B.C. Lance [EMAIL PROTECTED] Sent: Sunday, August 11, 2002 10:17 AM Subject: Re: [PHP] Re: need help snip Matt wrote: if(0 == $row['gid']) /snip ahhh. let the parser do the check. works great if you are not comparing with 2 variables :) in fact, another way to avoid this kinda pitfall, switch is another alternative. but of course, switch has its pitfall too. break ;) Yeah, it doesn't always work, but it adds to the reliablity of the code. In my code, it's more often used then not. It's hard to think that way though, as it's backwards logic, at least to me. I always think it first the other way ($val == constant), and type it backwards :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need Help with register_globals OFF
Thanks for the tips, Justin. Sounds like a good idea. Do you, or anyone, know if the $_POST vars stay defined even after moving on to another page? Do I also need to unset $_POST after passing the vars each time? From: [EMAIL PROTECTED] (Justin French) Newsgroups: php.general Date: Sat, 03 Aug 2002 15:46:57 +1000 To: Monty [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: [PHP] Re: Need Help with register_globals OFF Anyone want to share any tips on how to deal with form vars passed to a script with register_globals turned off? Do you simply refer to them directly with $_GET['var'] or do you initialize vars locally that contain all the $_GET vars? Well I usually choose to POST forms, not GET them, but yeah, I just deal with the vars as $_POST['var']. If I'm referencing the vars a LOT, I make regular $vars out of each element in the POST array: $myvar = $_POST['myvar']; If there's a lot of them, I do it with a foreach loop... something like: ? foreach($_POST as $key = $value) { $$key = $value; } ? ...will do the trick. It achieves the same as register_globals, but only from one source, the POST array. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need Help with register_globals OFF
Well, I just upgraded a number of PHP scripts to function with register_globals turned off, and now better understand what's required to work with variables more securely. I wanted to share that the extract() command turned out to be a big help. Using it meant I didn't have to put $_POST[' '] around every variable passed by a form. Instead, I put one or both of these lines of code at the beginning of scripts that use forms or receive vars passed via the URL: extract($_POST); extract($_GET); extract() creates local variables using the 'key' and 'value' from the $_POST or $_GET arrays. I even discovered it works with multidimensional arrays that may be passed by forms. In that case, if I have an array named formvar that collects all data from the form (i.e., $formvar['name'], $formvar['address'], etc.), then I use extract this way: extract($_POST['formvar']); This will create local variables named $name and $address that contain the values passed from the form. Here's where you can find more about this function: http://www.php.net/manual/en/function.extract.php One thing to remember is that if you put extract() in a custom function (which I did initially), it won't really work because the variables are created only within the scope of the function, so, as soon as it returns to the script, the vars it created are released. Monty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need help to choose hosting!
I would recommend Infinology Smart Consumers: http://smartconsumers.infinology.com/ You should look at them. I use them and I am very pleased with their service. Their servers have very fast response times and the give you plentiful features. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Mantas Kriauciunas [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hey php-general, i want to buy hosting. but i can't find good one for me. maybe someone could point some links. but this is what i need! Storage up to 100MB normal transfer limit(best would be without) CGI/Perl/PHP/ASP/SSI/SSL MySQL database (can be only 1) some pop3 mailboxes free domain transfer (maybe free domain if i pay for 1 year ahead) FTP access SSH access Shell capability up to 3 background processes if anyone know combination like that i would appreaciate your help! thanks -- Best regards, Mantas Contacts: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need help to choose hosting!
have you tried: http://www.hostrix.com ? //Elias Mantas Kriauciunas [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hey php-general, i want to buy hosting. but i can't find good one for me. maybe someone could point some links. but this is what i need! Storage up to 100MB normal transfer limit(best would be without) CGI/Perl/PHP/ASP/SSI/SSL MySQL database (can be only 1) some pop3 mailboxes free domain transfer (maybe free domain if i pay for 1 year ahead) FTP access SSH access Shell capability up to 3 background processes if anyone know combination like that i would appreaciate your help! thanks -- Best regards, Mantas Contacts: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need help to choose hosting!
http://ispcheck.com is the place. Listing of many webhostings. Go and see. Regards, Andrey Hey php-general, i want to buy hosting. but i can't find good one for me. maybe someone could point some links. but this is what i need! Storage up to 100MB normal transfer limit(best would be without) CGI/Perl/PHP/ASP/SSI/SSL MySQL database (can be only 1) some pop3 mailboxes free domain transfer (maybe free domain if i pay for 1 year ahead) FTP access SSH access Shell capability up to 3 background processes if anyone know combination like that i would appreaciate your help! thanks -- Best regards, Mantas Contacts: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Need Help with register_globals OFF
on 03/08/02 3:35 PM, Monty ([EMAIL PROTECTED]) wrote: Well, to answer my own question, I found a decent tutorial on using sessions with the new register_globals off here: http://www.wdvl.com/Authoring/Languages/PHP/Maintaining_state/session_variab les.html Anyone want to share any tips on how to deal with form vars passed to a script with register_globals turned off? Do you simply refer to them directly with $_GET['var'] or do you initialize vars locally that contain all the $_GET vars? Well I usually choose to POST forms, not GET them, but yeah, I just deal with the vars as $_POST['var']. If I'm referencing the vars a LOT, I make regular $vars out of each element in the POST array: $myvar = $_POST['myvar']; If there's a lot of them, I do it with a foreach loop... something like: ? foreach($_POST as $key = $value) { $$key = $value; } ? ...will do the trick. It achieves the same as register_globals, but only from one source, the POST array. Justin Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Re: need help with uploading images
Hi, Tuesday, July 30, 2002, 1:53:50 PM, you wrote: D This looks good but I just have one question about it if you don't mind, D what if someone was uploading a gif or a PNG file? can it be made to only D detect jpgs? D Thanks in advance D Deadsam Try it this way, it will check if it is a jpeg and it has a horizontal and vertical size so you can be pretty sure it is an image file. (you do not need the gd package for getimagesize()) /** Check for the type of the image : only allow jpeg's */ $im = getimagesize($_FILES['uploadFile'); if(!($im[2] == 2 $im[0] 0 $im[1] 0)){ echo You can only upload jpg images.; exit(); } The $im[2] being set to 2 means it is a jpeg other image types have a different number, have a look at the getimagesize()function for details -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php