Re: [PHP] timestamp to english
On Monday 10 March 2003 14:34, Lord Loh. wrote: > How do I convert the unix time stamp (the one I get by the time()) to a > readable English language time > > I am getting data from mySQL by the "now()" function strftime() -- 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 nice thing about standards is that there are so many of them to choose from. -- Andrew S. Tanenbaum */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] timestamp to english
> How do I convert the unix time stamp (the one I get by the time()) to a > readable English language time > > I am getting data from mySQL by the "now()" function Unix timestamps in PHP and the result of NOW() in MySQL are totally different. You'd use the date() function in PHP to format a Unix timestamp. You'd use the DATE_FORMAT() function in MySQL to format a MySQL timestamp. You'd use the TO_UNIXTIME() function to convert a MySQL timestamp into a Unix timestamp. Does that help? ---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: timestamp to english
PHP look at the Date( ) Function at php.net http://us2.php.net/manual/en/function.date.php Joel "Lord Loh." <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > How do I convert the unix time stamp (the one I get by the time()) to a > readable English language time > > I am getting data from mySQL by the "now()" function > > Please Help > Thank You. > > Lord Loh. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 10 Mar 2003 07:30:17 -0000 Issue 1929
php-general Digest 10 Mar 2003 07:30:17 - Issue 1929 Topics (messages 138873 through 138924): Content Management Systems 138873 by: shaun Re: Form input security 138874 by: Petre Agenbag 138876 by: John W. Holmes php/mysql grouping output 138875 by: Kelly Meeks 138877 by: Jack Help with session needed 138878 by: Øystein Håland 138879 by: Jack Help me out pl 138880 by: Øystein Håland 138923 by: Lord Loh. Easy Way. 138881 by: Vincent M. 138883 by: Jason Sheets 138884 by: Mark Heintz PHP Mailing Lists 138885 by: Vincent M. 138886 by: Chris Hayes Can someone explain this? include problem.? 138882 by: Beauford.2002 138887 by: Chris Hayes 138894 by: Beauford.2002 138907 by: Leo Spalteholz true, false 13 by: Liam Gibbs 138889 by: Ernest E Vogelsinger strange behaviour with login page 138890 by: Steve Pollard 138891 by: Bob Irwin 138892 by: Andre Dubuc 138893 by: Leo Spalteholz 138895 by: Bob Irwin Join 138896 by: Philip J. Newman fgetcsv quit working.. 138897 by: CDitty 138898 by: Jason Sheets 138900 by: CDitty fopen and file dump to a databace... 138899 by: Mark Tehara 138902 by: Jimmy Brake 138903 by: Bob Irwin Displaying a file 138901 by: Todd Cary 138904 by: Justin French 138905 by: Mark Tehara 138906 by: Justin French 138909 by: Todd Cary 138912 by: - Edwin 138920 by: Justin French MySQL or PHP question? 138908 by: John Taylor-Johnston Images out side the wwwroot 138910 by: Philip J. Newman 138913 by: - Edwin auto_increment $value 138911 by: John Taylor-Johnston 138914 by: - Edwin 138915 by: John Taylor-Johnston 138917 by: John Taylor-Johnston Re: What am i doing wrong? SQL Query in PHP 138916 by: Rahul.Brenda timestamp to english 138918 by: Lord Loh. Re: PERL/PHP, MSSQL, Unix AIX 138919 by: Frank M. Kromann 138921 by: Frank M. Kromann dynamic/multidimensional arrays in classes 138922 by: Patrick Teague 138924 by: John W. Holmes Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- --- Begin Message --- I would really appreciate some advice from anyone who has worked with or developed their own content management system. This is my scenario, when i have finished creating a site, i want to be able to add in the CMS with a minimum amount of fuss. I want to be able to get the CMS to recognize all the tables and somehow allow me to set the tables and fields that the client can update safely (i.e. if it is an employment recruitment site then they will be able to add jobs but not job_id). This will save me so much time rather than having to handcode the CMS for every site. I think i have an answer to my problem, and would be interested to hear your opinion. When i install the CMS it will read the existing tables and create 2 new tables: CMS_TABLES cms_table_id(PK) cms_table_name cms_table_is_editable CMS_FIELDS cms_field_id(PK) cms_table_id(FK) cms_field_name cms_field_is_editable cms_field_type cms_field_size cms_field_is_primary_key As an administrator I will be able to set fields and tables which are editable. Now when i go to the database management page i can do 'SELECT * FROM CMS_FIELDS WHERE cms_table_id = '$_GET[table_id]' AND cms_field_editable = TRUE Also does anyone have any suggestions for editing static content? Any comments here would be greatly appreciated. Thanks --- End Message --- --- Begin Message --- It all depends on what you will do with the data... The use will dictate the level of cleaning up. You MUST clean it up for DB entries as you mentioned, but if you are only going to e-mail the contents "as-is" to yourself etc, then cleaning up the data becomes of lesser importance. On Sun, 2003-03-09 at 21:18, Chris Cook wrote: > Hello all, > > When using forms, when do I have to worry about cleaning up user data? I > know to use escapeshellarg() when using system functions, but how about when > using the user data for database inserts? Also, if I do not insert the data > into the database or use any system commands, do I still need to clean the > data? > > Thanks, > Chris > > > > > _ > Add photos to your e-mail with MSN 8. Get 2 months FREE*. > http://join.msn.com/?page=features/featuredemail > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > --- End Message --- --- Begin Mes
RE: [PHP] dynamic/multidimensional arrays in classes
> I'm having problems figuring this out. This first way gives me a 'Fatal > Error: Cannot use [] for reading in class.php on line xx' > > class myClass > { >var $arr = array(); > >function add_something( $value ) >{ > $this->$arr[] = $value; // this is the line causing the error $this->arr[] = $value ---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: Help me out plzzzz
You can't do it from java script... See the php docs...there are good examples too. Hope this helps. Lord Loh. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] dynamic/multidimensional arrays in classes
I'm having problems figuring this out. This first way gives me a 'Fatal Error: Cannot use [] for reading in class.php on line xx' class myClass { var $arr = array(); function add_something( $value ) { $this->$arr[] = $value; // this is the line causing the error } } I've also tried using count() to find out how many items are in $arr, but it keeps saying that $r == 0... i.e. function add_something( $value ) { $r = count($arr); /* if( is_null( $r ) { $r = 0; } */ //print( $r ); $this->$arr[$r] = $value; } I've tried this both with & without the commented section & still $r = 0 even if you use '$class->add_something("my value");' 50 times. I'm guessing once this problem is solved it will work for multidimensional arrays as well? Patrick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PERL/PHP, MSSQL, Unix AIX
Hi Kelvin, You can use both PERL and PHP (prefered :-)). You need to download, compile and install FreeTDS (http://freetds.org). If you are using PHP you need to recompile it using --with-mssql. This will enable the mssql extension. You can then create a php script to read the text file, parse it and create the data in a MSSQL server on a Win32 box (PHP is running on your AIX box). - Frank > Hi, > > I got a little project and I need to come up with a solution on how to > finish it and was hoping if you guys can give me any ideas. > > I have a PERL script on a Unix AIX machine that checks for incoming update > of data. Specificly what it does is, when it runs, it will look at the > corresponding directories in the AIX machine and record the time WHEN a data > has come in and check if the time is delayed or on time, kind of like how > the flight Arrival/departure information work in an airport. After it > collects this information, it will store these information in a text file. > > I need to display this information in a form of a web page so that my > internal staff can see this information. I usually store this kind of > information in a MSSQL table and use PHP to general a page that collects its > information from the database/MSSQL table. > > The way I want to do it, somehow store/update the data in the text file of > the AIX machine to the MSSQL table so that my php page would be able to get > the updated information for display. > > My problem is I haven't come up with a solution as to how I can pull this > text file out fo the AIX machine and transfer the data to the MSSQL table. > > Anyone have an ideas? IS there anything in PHP I can use to do this? > > Any help is appreicated, thanks! > > Kelvin > > -- > 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] Displaying a file
on 10/03/03 3:40 PM, Todd Cary ([EMAIL PROTECTED]) wrote: > OK! This makes sense. What is the syntax to do > > b) output an appropriate header for the file type > c) pass through the actual file contents > > if I were doing an HTML file - if I were doing a PDF file? *Slaps forehead loudly* Did you read that article? Didn't think so. It deals with PDF, headers, and plenty of other stuff. If you still have a question after reading the article and trying the sample code, THEN ask away. Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PERL/PHP, MSSQL, Unix AIX
Hi Kelvin, You can use both PERL and PHP (prefered :-)). You need to download, compile and install FreeTDS (http://freetds.org). If you are using PHP you need to recompile it using --with-mssql. This will enable the mssql extension. You can then create a php script to read the text file, parse it and create the data in a MSSQL server on a Win32 box (PHP is running on your AIX box). - Frank > Hi, > > I got a little project and I need to come up with a solution on how to > finish it and was hoping if you guys can give me any ideas. > > I have a PERL script on a Unix AIX machine that checks for incoming update > of data. Specificly what it does is, when it runs, it will look at the > corresponding directories in the AIX machine and record the time WHEN a data > has come in and check if the time is delayed or on time, kind of like how > the flight Arrival/departure information work in an airport. After it > collects this information, it will store these information in a text file. > > I need to display this information in a form of a web page so that my > internal staff can see this information. I usually store this kind of > information in a MSSQL table and use PHP to general a page that collects its > information from the database/MSSQL table. > > The way I want to do it, somehow store/update the data in the text file of > the AIX machine to the MSSQL table so that my php page would be able to get > the updated information for display. > > My problem is I haven't come up with a solution as to how I can pull this > text file out fo the AIX machine and transfer the data to the MSSQL table. > > Anyone have an ideas? IS there anything in PHP I can use to do this? > > Any help is appreicated, thanks! > > Kelvin > > -- > 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] timestamp to english
How do I convert the unix time stamp (the one I get by the time()) to a readable English language time I am getting data from mySQL by the "now()" function Please Help Thank You. Lord Loh. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] auto_increment $value
I'll have a look at that too. Thanks! What do you make of this: My browser is all snuffed up! It dodnint wwork aniwore! http://ccl.flsh.usherbrooke.ca/tools/ Choose Greid. Works ok. Choose JDaxell and the stops working after 184. Even with: Too much HTML or too much in one . I'll have to get my LIMIT x,y code out for my sql? Internet Exploder 5.5 & NS 4.8 all jammed up. > you can use mysql_insert_id() if you want the last value from a > connection you still have open. Alternatively you could select > max(whatever_colname) and use that. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What am i doing wrong? SQL Query in PHP
Hi, Thanks.. i went through your reply and certainly now i understand the mistake i was making. Quite logical actually, that i hadn't actually selected the "title" column. But i'm sure i wouldnt' have been able to figure this out myself. And surely, i too try to stay away from Numerical Indexes. Well thank you, this does enlighten quite a bit. Rahul S. Johari > In case you're wondering, your method is fine. You > can continue to use > this or what chris suggested. Either way, the > problem is that you need > an alias for your column that you selected. With the > above code, you > didn't select a column called "title" so you can't > use $row['title']. > You created a column called "substring_index(title, > ' ', 3)" so you'll > have to use $row["substring_index(title, ' ', 3)"]. > As you can probably > guess, there's an easier way to do it, though... > > If you use a query such as: > > SELECT SUBSTRING_INDEX(title, ' ', 3) AS f_title > FROM news ORDER BY id > LIMIT 4 > > You can then use $row['f_title'] to print the > result. Using "AS" in your > query will rename the column to "f_title" or > whatever you put there. > This is called assigning the column an alias. > > Of course, though all of this you could of just used > $row[0] to get the > value. I tend to stay away from using numerical > indexes though, as it > makes it harder for other people to follow your > code. When you see > $row['f_title'], it gives you a good idea of what > you're displaying. > When you see $row[0], you have no idea what it is > and you have to go > find the query that was run in order to determine > what column zero was. > > Hope that helps. > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP > Professionals. Get your copy > today. http://www.phparch.com/ > > __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] auto_increment $value
$news = mysql_query("SHOW TABLE STATUS FROM ".$db2." LIKE '$table2'"); while ($table_status = mysql_fetch_array($news)) { $autoindex = $table_status['Auto_increment']; } Got it. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] auto_increment $value
Hello, John Taylor-Johnston <[EMAIL PROTECTED]> wrote: > Anyone know how to get the auto_increment $value out of a mysql > table. > I'm thinking it is in mysql_fetch_array but don't see how to > get it. What do you exactly mean by "get the auto_increment $value"? Perhaps, you're looking for this? http://www.php.net/manual/en/function.mysql-insert-id.php - E __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Images out side the wwwroot
"Philip J. Newman" <[EMAIL PROTECTED]> wrote: > If i was to use PHP to call all my images from out side the > wwwroot, dose anyone have a method that they use? By using an absolute path? - E __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Displaying a file
Todd Cary <[EMAIL PROTECTED]> wrote: > OK! This makes sense. What is the syntax to do Hmm, did you read (and try) the article mentioned earlier? - E __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] auto_increment $value
Anyone know how to get the auto_increment $value out of a mysql table. I'm thinking it is in mysql_fetch_array but don't see how to get it. > $SQL = "SELECT * FROM table ORDER BY id asc LIMIT $autoindex -5 ,5;"; > > I would like to get the autoindex value of my table and use it in my SQL. Can I get > the autoindex? :) How? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Images out side the wwwroot
If i was to use PHP to call all my images from out side the wwwroot, dose anyone have a method that they use? -- Philip J. Newman. Head Developer [EMAIL PROTECTED] +64 (9) 576 9491 +64 021-048-3999 -- Friends are like stars You can't allways see them, but they are always there. -- Websites: PhilipNZ.com - Design. http://www.philipnz.com/ [EMAIL PROTECTED] Philip's Domain // Internet Project. http://www.philipsdomain.com/ [EMAIL PROTECTED] Vital Kiwi / NEWMAN.NET.NZ. http://www.newman.net.nz/ [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Displaying a file
OK! This makes sense. What is the syntax to do b) output an appropriate header for the file type c) pass through the actual file contents if I were doing an HTML file - if I were doing a PDF file? Todd Justin French wrote: Same way image.php would do simular things to what view.php does in the script below. Justin on 10/03/03 2:07 PM, Mark Tehara ([EMAIL PROTECTED]) wrote: On that note, how would i load an image from outside the document root? - Original Message - From: "Justin French" <[EMAIL PROTECTED]> To: "Todd Cary" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, March 10, 2003 4:06 PM Subject: Re: [PHP] Displaying a file Change your link to something like: ... view.php will NOT be a "HTML page" -- it will be responsible for: a) some conditional stuff, like checking for a logged in user b) output an appropriate header for the file type c) pass through the actual file contents You would actually want to store the target files outside the doc root, or forbid apache to serve them directly over http. There's a decent article here: http://www.zend.com/zend/trick/tricks-august-2001.php Justin French on 10/03/03 1:17 PM, Todd Cary ([EMAIL PROTECTED]) wrote: I want to display a file under program control in the same manner as one would with using an >a> tag e.g. Click here to open the Race Schedule In other words, if certain conditions are met, then I want to display the file. What is the best way to do that? Many thanks. Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Ariste Software, Petaluma, CA 94952 \n [EMAIL PROTECTED]
[PHP] MySQL or PHP question?
I don't know whether this is a MySQL or PHP quesiton. $SQL = "SELECT * FROM table ORDER BY id asc LIMIT $autoindex -5 ,5;"; I would like to get the autoindex value of my table and use it in my SQL. Can I get the autoindex? :) How? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can someone explain this? include problem.....?
On March 9, 2003 04:30 pm, Beauford.2002 wrote: > Sorry, the line I was actually referring to is the one below. I > forgot the hidden one was even there and serves no purpose and does > not resolve the problem by removing it. > > This works: > It also works if I just hardcode a value (value="Bob") > > This doesn't: > > They are both exactly the same other than the way they get their > values, so I don't see a reason why I'm losing part of the second > input line. Just to be clear, when I view the souce code I see > this: > > The value= has been > stripped from the code Look really hard at that second line.. Notice anything missing? I dont know why its stripped from your browser source but theres an obvious mistake. leo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Displaying a file
Same way image.php would do simular things to what view.php does in the script below. Justin on 10/03/03 2:07 PM, Mark Tehara ([EMAIL PROTECTED]) wrote: > On that note, how would i load an image from outside the document root? > > > > - Original Message - > From: "Justin French" <[EMAIL PROTECTED]> > To: "Todd Cary" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Monday, March 10, 2003 4:06 PM > Subject: Re: [PHP] Displaying a file > > >> Change your link to something like: >> >> ... >> >> view.php will NOT be a "HTML page" -- it will be responsible for: >> >> a) some conditional stuff, like checking for a logged in user >> b) output an appropriate header for the file type >> c) pass through the actual file contents >> >> >> You would actually want to store the target files outside the doc root, or >> forbid apache to serve them directly over http. >> >> There's a decent article here: >> http://www.zend.com/zend/trick/tricks-august-2001.php >> >> >> Justin French >> >> >> >> on 10/03/03 1:17 PM, Todd Cary ([EMAIL PROTECTED]) wrote: >> >>> I want to display a file under program control in the same manner as one >>> would with using an >a> tag e.g. >>> >>> Click >> Target="_blank">here to open the Race Schedule >>> >>> In other words, if certain conditions are met, then I want to display >>> the file. What is the best way to do that? >>> >>> Many thanks. >>> >>> Todd >> >> >> -- >> 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] Displaying a file
On that note, how would i load an image from outside the document root? - Original Message - From: "Justin French" <[EMAIL PROTECTED]> To: "Todd Cary" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, March 10, 2003 4:06 PM Subject: Re: [PHP] Displaying a file > Change your link to something like: > > ... > > view.php will NOT be a "HTML page" -- it will be responsible for: > > a) some conditional stuff, like checking for a logged in user > b) output an appropriate header for the file type > c) pass through the actual file contents > > > You would actually want to store the target files outside the doc root, or > forbid apache to serve them directly over http. > > There's a decent article here: > http://www.zend.com/zend/trick/tricks-august-2001.php > > > Justin French > > > > on 10/03/03 1:17 PM, Todd Cary ([EMAIL PROTECTED]) wrote: > > > I want to display a file under program control in the same manner as one > > would with using an >a> tag e.g. > > > > Click > Target="_blank">here to open the Race Schedule > > > > In other words, if certain conditions are met, then I want to display > > the file. What is the best way to do that? > > > > Many thanks. > > > > Todd > > > -- > 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] Displaying a file
Change your link to something like: ... view.php will NOT be a "HTML page" -- it will be responsible for: a) some conditional stuff, like checking for a logged in user b) output an appropriate header for the file type c) pass through the actual file contents You would actually want to store the target files outside the doc root, or forbid apache to serve them directly over http. There's a decent article here: http://www.zend.com/zend/trick/tricks-august-2001.php Justin French on 10/03/03 1:17 PM, Todd Cary ([EMAIL PROTECTED]) wrote: > I want to display a file under program control in the same manner as one > would with using an >a> tag e.g. > > Click Target="_blank">here to open the Race Schedule > > In other words, if certain conditions are met, then I want to display > the file. What is the best way to do that? > > Many thanks. > > Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fopen and file dump to a databace...
I would use something like this (assuming you're just going to read the entire file and bung it into the database). Be careful reading large files in, it can fill up PHP's allocated memory resource. I've used this with 4 meg files though, and its worked ok. $fp = file("yourfile.txt"); //This reads the file into an array, each element of the array is a line. Which you can then, test, manipulate, explode etc to put into the database. while (list($barry, $tbone) = each($fp)) { //barry is the index of the array element, $tbone is the value of that element in the array. echo"Index: $barry Value: $tbone "; //just insert into the database what you need to. } Best Regards Bob Irwin Server Admin & Web Programmer Planet Netcom - Original Message - From: "Mark Tehara" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, March 10, 2003 1:02 PM Subject: [PHP] fopen and file dump to a databace... > HI, I'm looking to take the data from a CSV file, then upload it into a > mysql databace. > > I figure i will need the following. > > To count the number of lines ... and cut up each line in its veriables then > entering it into the databace. > > I have: > > $file = fopen("pricelist-snippet.csv","r"); > $buffer = fread($file,1); > echo $buffer; > > This dumps the data to the screen ... > > where would i start to making cutting this data up by the line? > > / Mark > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > Scanned by PeNiCillin http://safe-t-net.pnc.com.au/ > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fopen and file dump to a databace...
hi mark! i import data all the dang time and this is what i use (more or less) Insert($query); // i use a class for my mysql connections } function csv_parse($data, $separator) { $quote = '"'; $values = array(); $toggle = 0; $len = strlen($data); $count = 1; for ($i = 0; $i < $len; $i++) { $tmp = substr ($data, $i, 1); if (strcmp($tmp, $quote) == 0) { $toggle = $toggle ^ 1; } $value = $value . $tmp; if (strcmp($tmp, $separator) == 0) { if (! $toggle) { # End of word $value = ereg_replace(",$", "", $value); $value = ereg_replace("^\"", "", $value); $value = ereg_replace("\"$", "", $value); $value = ereg_replace("\"+", "\"", $value); $num_of_elems = count($values); $values[$num_of_elems] = $value; $value = ""; } } } $value = ereg_replace("^\"", "", $value); $value = ereg_replace("\"$", "", $value); $value = ereg_replace("\"+", "\"", $value); $num_of_elems = count($values); $values[$num_of_elems] = $value; return ($values); } function make_safe($text) { $text = preg_replace("/(\cM)/", " ", $text); $text = preg_replace("/(\c])/", " ", $text); $text = str_replace("\r\n", " ", $text); $text = str_replace("\x0B", " ", $text); $text = str_replace('"', " ", $text); $text = explode("\n", $text); $text = implode(" ", $text); $text = addslashes(trim($text)); return($text); } On Sun, 2003-03-09 at 18:02, Mark Tehara wrote: > HI, I'm looking to take the data from a CSV file, then upload it into a > mysql databace. > > I figure i will need the following. > > To count the number of lines ... and cut up each line in its veriables then > entering it into the databace. > > I have: > > $file = fopen("pricelist-snippet.csv","r"); > $buffer = fread($file,1); > echo $buffer; > > This dumps the data to the screen ... > > where would i start to making cutting this data up by the line? > > / Mark > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Displaying a file
I want to display a file under program control in the same manner as one would with using an >a> tag e.g. Click here to open the Race Schedule In other words, if certain conditions are met, then I want to display the file. What is the best way to do that? Many thanks. Todd -- Ariste Software, Petaluma, CA 94952 \n [EMAIL PROTECTED]
Re: [PHP] fgetcsv quit working......
I thought about this possibility, but it turns out 4 different scripts on the same server accessing different files from different locations and using different methods are all failing. Chris At 07:53 PM 3/9/2003, Jason Sheets wrote: Check to make sure the file exists, you should probably through some debug code around the area that is failing. Jason On Sun, 2003-03-09 at 18:50, CDitty wrote: > I have a customer who's webhost upgraded their server recently and a script > that was working fine quit working. The error they are getting is this > "fgetcsv(): supplied argument is not a valid stream resource". I don't > know what they did with Apache, but as far as I know, nothing else changed. > > Can anyone offer any advice on troubleshooting this one? > > Chris -- Jason Sheets <[EMAIL PROTECTED]> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fopen and file dump to a databace...
HI, I'm looking to take the data from a CSV file, then upload it into a mysql databace. I figure i will need the following. To count the number of lines ... and cut up each line in its veriables then entering it into the databace. I have: $file = fopen("pricelist-snippet.csv","r"); $buffer = fread($file,1); echo $buffer; This dumps the data to the screen ... where would i start to making cutting this data up by the line? / Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fgetcsv quit working......
Check to make sure the file exists, you should probably through some debug code around the area that is failing. Jason On Sun, 2003-03-09 at 18:50, CDitty wrote: > I have a customer who's webhost upgraded their server recently and a script > that was working fine quit working. The error they are getting is this > "fgetcsv(): supplied argument is not a valid stream resource". I don't > know what they did with Apache, but as far as I know, nothing else changed. > > Can anyone offer any advice on troubleshooting this one? > > Chris -- Jason Sheets <[EMAIL PROTECTED]> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fgetcsv quit working......
I have a customer who's webhost upgraded their server recently and a script that was working fine quit working. The error they are getting is this "fgetcsv(): supplied argument is not a valid stream resource". I don't know what they did with Apache, but as far as I know, nothing else changed. Can anyone offer any advice on troubleshooting this one? Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Join
-- Philip J. Newman. Head Developer [EMAIL PROTECTED] +64 (9) 576 9491 +64 021-048-3999 -- Friends are like stars You can't allways see them, but they are always there. -- Websites: PhilipNZ.com - Design. http://www.philipnz.com/ [EMAIL PROTECTED] Philip's Domain // Internet Project. http://www.philipsdomain.com/ [EMAIL PROTECTED] Vital Kiwi / NEWMAN.NET.NZ. http://www.newman.net.nz/ [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strange behaviour with login page
In my case, it was a https website. However, in testing, it was happening on a normal http website as well. It was something I ruled out trying to find the problem. Best Regards Bob Irwin Server Admin & Web Programmer Planet Netcom - Original Message - From: "Andre Dubuc" <[EMAIL PROTECTED]> To: "php list" <[EMAIL PROTECTED]> Sent: Monday, March 10, 2003 10:44 AM Subject: Re: [PHP] strange behaviour with login page > Hi Steve, > > Just out of curiosity, when you mention "implement a user authentication > process where users can click on an external link to my site" are you using > the https protocol? > > I had similar bizarre behavior with IE using a "Confirmation Required' > script. Worked great at home (localhost), with apache, linux, et al, but with > IE sometimes it worked, most often not. > > I finally traced the route of my problem to the https protocol. I found this > quite by mistake -- AOL, Hotmail, and Yahoo users were not being redirected > to my site. Almost exactly the same problem occurred as you describe: if I > clicked the link twice, it sometimes worked. (Btw, I lost a lot of > registrants because of this problem. I finally dumped the whole thing, and > now, users once registered, go immediately to specified areas of the site. > Apparently, with AOL, Yahoo, Hotmail users the https protocol is 'optional' > or 'premium' or somesuch idiocy!) > > If you do find the root of your problem, would you be so kind as to drop me > an email with your resolution -- I'd like to get my little script to work. > > Hth, > Andre > > > On Sunday 09 March 2003 06:18 pm, you wrote: > > I have seen this as well. Try using netscape or an earlier version of IE > > and you will probably find it will work without issue. I posted about this > > many moons ago and unfortunately didn't get a solution. I can't recall the > > specifics of when it was doing it (and if I remember correctly, sometimes > > it would work and sometimes it wouldn't - in the context of a members area > > where sessions are used - some pages worked, others didn't - same sessions > > method), but on some servers, we had no issues (exactly the same versions > > of linux, php etc) and others this happens. There must have been some sort > > of variation at our end, but we couldn't see it. > > > > We upgraded to PHP Version 4.2.3, and this fixed it. > > > > Sorry I can't give you any more info. At the time I was having the > > problem, I was under a tight schedule and didn't have time to track down > > possible causes. As I said, the upgrade helped us (also fixed a few mysql > > query caching problems we were having too - caused a few GD ones though). > > My guess is that its some sort of cookies problem with windows IE 6 (as > > that was the only browser I saw the problem on). > > > > Best Regards > > Bob Irwin > > Server Admin & Web Programmer > > Planet Netcom > > > > If anyone has come across a similar problem to the one described below, and > > has a solution I'd be really grateful if you can help me out. > > > > I'm trying to implement a user authentication process where users can click > > on an external link to my site. If they're not logged in they get presented > > with a login dialog. Once they log in they're redirected onwards to the > > page they initially wanted to visit. > > > > The system I have in place at the moment handles authentication using > > sessions. The bizarre thing is, while everything seems to work on my home > > pc (windows & iis web server, php 4.2.1), on the host server (linux, > > apache, php 4.1.2) I get the login screen twice before I get redirected. My > > hunch is that it's something to do with when session variable become > > available after registering them. (I'm using the sesssion management > > functions built in to php 4). > > > > TIA > > > > Steve > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > Scanned by PeNiCillin http://safe-t-net.pnc.com.au/ > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can someone explain this? include problem.....?
Sorry, the line I was actually referring to is the one below. I forgot the hidden one was even there and serves no purpose and does not resolve the problem by removing it. This works: It also works if I just hardcode a value (value="Bob") This doesn't: They are both exactly the same other than the way they get their values, so I don't see a reason why I'm losing part of the second input line. Just to be clear, when I view the souce code I see this: The value= has been stripped from the code Thanks - Original Message - From: "Chris Hayes" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, March 09, 2003 4:32 PM Subject: Re: [PHP] Can someone explain this? include problem.? > At 22:15 9-3-2003, you wrote: > >Hi, > > > >I have a php script which does some stuff and at the end of the file I have > >it include a file which has a form in it. The problem I am having is that it > >is missing code. If you go down to the second input - it has a value="0" > >field - this does not show up when I view the source from my browser. The > >first input value= works fine. > have a closer look at it!! > > compare your first line: > > > to the failing line: > > > > I'm sure you can see it :) > > > -- > 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] strange behaviour with login page
On March 9, 2003 12:49 pm, Steve Pollard wrote: > If anyone has come across a similar problem to the one described > below, and has a solution I'd be really grateful if you can help me > out. > > I'm trying to implement a user authentication process where users > can click on an external link to my site. If they're not logged in > they get presented with a login dialog. Once they log in they're > redirected onwards to the page they initially wanted to visit. > > The system I have in place at the moment handles authentication > using sessions. The bizarre thing is, while everything seems to > work on my home pc (windows & iis web server, php 4.2.1), on the > host server (linux, apache, php 4.1.2) I get the login screen twice > before I get redirected. My hunch is that it's something to do with > when session variable become available after registering them. (I'm > using the sesssion management functions built in to php 4). > > TIA > > Steve Hm. I had a similar problem. In my login verification script I would run through a bunch of checks, verify the login/pass in the database and if it was correct I would start a session, register the variables and redirect the user. This wouldn't work most of the time in IE. For some reason it always took a few tries to login. Then I moved the call to session_start() to the beginning of the script and it worked fine. Not sure if this applies to your problem though... Leo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strange behaviour with login page
Hi Steve, Just out of curiosity, when you mention "implement a user authentication process where users can click on an external link to my site" are you using the https protocol? I had similar bizarre behavior with IE using a "Confirmation Required' script. Worked great at home (localhost), with apache, linux, et al, but with IE sometimes it worked, most often not. I finally traced the route of my problem to the https protocol. I found this quite by mistake -- AOL, Hotmail, and Yahoo users were not being redirected to my site. Almost exactly the same problem occurred as you describe: if I clicked the link twice, it sometimes worked. (Btw, I lost a lot of registrants because of this problem. I finally dumped the whole thing, and now, users once registered, go immediately to specified areas of the site. Apparently, with AOL, Yahoo, Hotmail users the https protocol is 'optional' or 'premium' or somesuch idiocy!) If you do find the root of your problem, would you be so kind as to drop me an email with your resolution -- I'd like to get my little script to work. Hth, Andre On Sunday 09 March 2003 06:18 pm, you wrote: > I have seen this as well. Try using netscape or an earlier version of IE > and you will probably find it will work without issue. I posted about this > many moons ago and unfortunately didn't get a solution. I can't recall the > specifics of when it was doing it (and if I remember correctly, sometimes > it would work and sometimes it wouldn't - in the context of a members area > where sessions are used - some pages worked, others didn't - same sessions > method), but on some servers, we had no issues (exactly the same versions > of linux, php etc) and others this happens. There must have been some sort > of variation at our end, but we couldn't see it. > > We upgraded to PHP Version 4.2.3, and this fixed it. > > Sorry I can't give you any more info. At the time I was having the > problem, I was under a tight schedule and didn't have time to track down > possible causes. As I said, the upgrade helped us (also fixed a few mysql > query caching problems we were having too - caused a few GD ones though). > My guess is that its some sort of cookies problem with windows IE 6 (as > that was the only browser I saw the problem on). > > Best Regards > Bob Irwin > Server Admin & Web Programmer > Planet Netcom > > If anyone has come across a similar problem to the one described below, and > has a solution I'd be really grateful if you can help me out. > > I'm trying to implement a user authentication process where users can click > on an external link to my site. If they're not logged in they get presented > with a login dialog. Once they log in they're redirected onwards to the > page they initially wanted to visit. > > The system I have in place at the moment handles authentication using > sessions. The bizarre thing is, while everything seems to work on my home > pc (windows & iis web server, php 4.2.1), on the host server (linux, > apache, php 4.1.2) I get the login screen twice before I get redirected. My > hunch is that it's something to do with when session variable become > available after registering them. (I'm using the sesssion management > functions built in to php 4). > > TIA > > Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strange behaviour with login page
I have seen this as well. Try using netscape or an earlier version of IE and you will probably find it will work without issue. I posted about this many moons ago and unfortunately didn't get a solution. I can't recall the specifics of when it was doing it (and if I remember correctly, sometimes it would work and sometimes it wouldn't - in the context of a members area where sessions are used - some pages worked, others didn't - same sessions method), but on some servers, we had no issues (exactly the same versions of linux, php etc) and others this happens. There must have been some sort of variation at our end, but we couldn't see it. We upgraded to PHP Version 4.2.3, and this fixed it. Sorry I can't give you any more info. At the time I was having the problem, I was under a tight schedule and didn't have time to track down possible causes. As I said, the upgrade helped us (also fixed a few mysql query caching problems we were having too - caused a few GD ones though). My guess is that its some sort of cookies problem with windows IE 6 (as that was the only browser I saw the problem on). Best Regards Bob Irwin Server Admin & Web Programmer Planet Netcom If anyone has come across a similar problem to the one described below, and has a solution I'd be really grateful if you can help me out. I'm trying to implement a user authentication process where users can click on an external link to my site. If they're not logged in they get presented with a login dialog. Once they log in they're redirected onwards to the page they initially wanted to visit. The system I have in place at the moment handles authentication using sessions. The bizarre thing is, while everything seems to work on my home pc (windows & iis web server, php 4.2.1), on the host server (linux, apache, php 4.1.2) I get the login screen twice before I get redirected. My hunch is that it's something to do with when session variable become available after registering them. (I'm using the sesssion management functions built in to php 4). TIA Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] strange behaviour with login page
If anyone has come across a similar problem to the one described below, and has a solution I'd be really grateful if you can help me out. I'm trying to implement a user authentication process where users can click on an external link to my site. If they're not logged in they get presented with a login dialog. Once they log in they're redirected onwards to the page they initially wanted to visit. The system I have in place at the moment handles authentication using sessions. The bizarre thing is, while everything seems to work on my home pc (windows & iis web server, php 4.2.1), on the host server (linux, apache, php 4.1.2) I get the login screen twice before I get redirected. My hunch is that it's something to do with when session variable become available after registering them. (I'm using the sesssion management functions built in to php 4). TIA Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] true, false
At 23:37 09.03.2003, Liam Gibbs said: [snip] >Why is it the following code produces nothing? > >$responsesubmitted = FALSE; >print($responsesubmitted); > >I have an if statement that says if($responsesubmitted), but it doesn't work. [snip] because $responsesubmitted is false :) A "false" value is "empty", while true is "1" in PHP-speech (contrary to languages like C where false is defined either being "!true" or "0". In case the execution block after your if-statement doesn't get executed this construction works just as it should. -- >O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] true, false
Why is it the following code produces nothing? $responsesubmitted = FALSE; print($responsesubmitted); I have an if statement that says if($responsesubmitted), but it doesn't work.
Re: [PHP] Can someone explain this? include problem.....?
At 22:15 9-3-2003, you wrote: Hi, I have a php script which does some stuff and at the end of the file I have it include a file which has a form in it. The problem I am having is that it is missing code. If you go down to the second input - it has a value="0" field - this does not show up when I view the source from my browser. The first input value= works fine. have a closer look at it!! compare your first line: to the failing line: I'm sure you can see it :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Easy Way.
At 22:23 9-3-2003, you wrote: You're looking for the str_pad function. http://www.php.net/str_pad $i = 3; $i = str_pad($i, 5, '0', STR_PAD_LEFT); echo $i; // outputs '3' Just keep in mind that it won't help you if your input is greater than 5 to begin with, you'll have to check that seperately. You can also have a look at http://nl.php.net/manual/en/function.sprintf.php Example 5. sprintf(): zero-padded integers $isodate = sprintf("%04d-%02d-%02d", $year, $month, $day); if it is only for output, have a look at http://nl.php.net/manual/en/function.printf.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Easy Way.
Jason Sheets wrote: Hello, Use str_pad, the manual page is available at http://www.php.net/str_pad, a short example would be: $i = 3; $i = str_pad($i, 5, "0", STR_PAD_LEFT); This function is described in the PHP manual in the string functions section, the manual is an excellent place to go first when questions such as this arise. Yes I know, but it's not so easy to find to right function I need there are so many... ;-) Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Easy Way.
You're looking for the str_pad function. http://www.php.net/str_pad $i = 3; $i = str_pad($i, 5, '0', STR_PAD_LEFT); echo $i; // outputs '3' Just keep in mind that it won't help you if your input is greater than 5 to begin with, you'll have to check that seperately. $j = 123456; $j = str_pad($j, 5, '0', STR_PAD_LEFT); echo $j; // outputs '123456' mh. On Sun, 9 Mar 2003, Vincent M. wrote: > Hello, > > Is there an easy way to change an integer to a 5 caracters string. > For example: > $i = 3 ; > $j = 110 ; > After having changed them: > $i = "3" ; > $j = "00110" ; > > Is there a php function to do so instead of doing this: >if( ($i>0)&&($i<10)) { > $i = "".$i ; >} else if( ($i>9)&&($i<100)) { > $i = "000".$i ; >} else if( ($i>99)&&($i<1000)) { > $i = "00".$i ; >} etc... > > Thanks :-) > > Vincent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Easy Way.
Hello, Use str_pad, the manual page is available at http://www.php.net/str_pad, a short example would be: $i = 3; $i = str_pad($i, 5, "0", STR_PAD_LEFT); This function is described in the PHP manual in the string functions section, the manual is an excellent place to go first when questions such as this arise. Jason On Sun, 2003-03-09 at 14:17, Vincent M. wrote: > Hello, > > Is there an easy way to change an integer to a 5 caracters string. > For example: > $i = 3 ; > $j = 110 ; > After having changed them: > $i = "3" ; > $j = "00110" ; > > Is there a php function to do so instead of doing this: >if( ($i>0)&&($i<10)) { > $i = "".$i ; >} else if( ($i>9)&&($i<100)) { > $i = "000".$i ; >} else if( ($i>99)&&($i<1000)) { > $i = "00".$i ; >} etc... > > Thanks :-) > > Vincent. -- Jason Sheets <[EMAIL PROTECTED]> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can someone explain this? include problem.....?
Hi, I have a php script which does some stuff and at the end of the file I have it include a file which has a form in it. The problem I am having is that it is missing code. If you go down to the second input - it has a value="0" field - this does not show up when I view the source from my browser. The first input value= works fine. Anyone have any ideas on this.TIA i.e. This is theform.inc.. Player: Goals: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Easy Way.
Hello, Is there an easy way to change an integer to a 5 caracters string. For example: $i = 3 ; $j = 110 ; After having changed them: $i = "3" ; $j = "00110" ; Is there a php function to do so instead of doing this: if( ($i>0)&&($i<10)) { $i = "".$i ; } else if( ($i>9)&&($i<100)) { $i = "000".$i ; } else if( ($i>99)&&($i<1000)) { $i = "00".$i ; } etc... Thanks :-) Vincent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help me out plzzzz
Today I collect information from several forms and store it in a javascript cookie: function formCookie() { var cookieValue = document.$formName.totalAns.value+'|'; cookieValue+=document.form1.correct.value+'$test[1]'+document.form1.question 1.value+document.form1.answer.value+'|'; cookieValue+=document.form2.correct.value+'$test[1]'+document.form2.question 2.value+document.form2.answer.value+'|'; document.cookie = '$ansCookie='+escape(cookieValue)+';expires='; } The problem is the cookie soon reaches the 4 kb limit, so I would like to achieve the same using session. The trouble is, I don't know how to do. I would appreciate any help that brings me closer to a solution on this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with session needed
On Sun, 9 Mar 2003 21:18:33 +0100 "Øystein Håland" <[EMAIL PROTECTED]> wrote: > The problem is the cookie soon reaches the 4 kb limit, so I would like to > achieve the same using session. The trouble is, I don't know how to do. I > would appreciate any help that brings me closer to a solution on this. have a look in the manual: http://www.php.net/manual/en/ref.session.php in the middle of that page are some examples, which may help you. bye -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with session needed
Today I collect information from several forms and store it in a cookie: function formCookie() { var cookieValue = document.$formName.totalAns.value+'|'; cookieValue +=document.form1.correct.value+'$test[1]'+document.form1.question1.value+doc ument.form1.answer.value+'|'; cookieValue +=document.form2.correct.value+'$test[1]'+document.form2.question2.value+doc ument.form2.answer.value+'|'; document.cookie = '$ansCookie='+escape(cookieValue)+';expires='; } The problem is the cookie soon reaches the 4 kb limit, so I would like to achieve the same using session. The trouble is, I don't know how to do. I would appreciate any help that brings me closer to a solution on this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php/mysql grouping output
On Sun, 9 Mar 2003 14:56:31 -0500 Kelly Meeks <[EMAIL PROTECTED]> wrote: > Order Num Order Date Product CodeProduct Name > --- > 1 2003-01-01 12345 product xyz > 2 2003-01-01 12345 product xyz > 3 2003-01-01 abcde product abc > 1 2003-01-01 abcde product abc > 5 2003-01-01 12345 product xyz > > If I wanted to have the output grouped on any of the fields, how would I go about > doing it? > append to your query: ... GROUP BY tablename.column_name -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Form input security
> When using forms, when do I have to worry about cleaning up user data? I > know to use escapeshellarg() when using system functions, but how about > when > using the user data for database inserts? Also, if I do not insert the > data > into the database or use any system commands, do I still need to clean the > data? If you're going to do anything with it, then you have to validate/clean it. This means using it in a query, writing it to a file, displaying it back to the user, using it in an email, etc. For you're very vague question, I'd have to say the very vague answer is that you have to clean EVERYTHING. ---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] php/mysql grouping output
I've got a multi-table query, (pulling from both an orders and an orders_products (line items) file), and I'd like to group the output to help reduce multiple appearances of of the product skus. The query: select orders.orders_id,orders.date_purchased,orders.customers_name,orders_products.products_name,orders_products.products_model,orders_products.products_quantity, orders_products.products_price from orders,orders_products where orders.date_purchased='2003-01-01' and orders.orders_id=orders_products.orders_id order by orders_products.products_model You get output like Order Num Order Date Product CodeProduct Name --- 1 2003-01-01 12345 product xyz 2 2003-01-01 12345 product xyz 3 2003-01-01 abcde product abc 1 2003-01-01 abcde product abc 5 2003-01-01 12345 product xyz If I wanted to have the output grouped on any of the fields, how would I go about doing it? TIA Kelly -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form input security
It all depends on what you will do with the data... The use will dictate the level of cleaning up. You MUST clean it up for DB entries as you mentioned, but if you are only going to e-mail the contents "as-is" to yourself etc, then cleaning up the data becomes of lesser importance. On Sun, 2003-03-09 at 21:18, Chris Cook wrote: > Hello all, > > When using forms, when do I have to worry about cleaning up user data? I > know to use escapeshellarg() when using system functions, but how about when > using the user data for database inserts? Also, if I do not insert the data > into the database or use any system commands, do I still need to clean the > data? > > Thanks, > Chris > > > > > _ > Add photos to your e-mail with MSN 8. Get 2 months FREE*. > http://join.msn.com/?page=features/featuredemail > > > -- > 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] Content Management Systems
I would really appreciate some advice from anyone who has worked with or developed their own content management system. This is my scenario, when i have finished creating a site, i want to be able to add in the CMS with a minimum amount of fuss. I want to be able to get the CMS to recognize all the tables and somehow allow me to set the tables and fields that the client can update safely (i.e. if it is an employment recruitment site then they will be able to add jobs but not job_id). This will save me so much time rather than having to handcode the CMS for every site. I think i have an answer to my problem, and would be interested to hear your opinion. When i install the CMS it will read the existing tables and create 2 new tables: CMS_TABLES cms_table_id(PK) cms_table_name cms_table_is_editable CMS_FIELDS cms_field_id(PK) cms_table_id(FK) cms_field_name cms_field_is_editable cms_field_type cms_field_size cms_field_is_primary_key As an administrator I will be able to set fields and tables which are editable. Now when i go to the database management page i can do 'SELECT * FROM CMS_FIELDS WHERE cms_table_id = '$_GET[table_id]' AND cms_field_editable = TRUE Also does anyone have any suggestions for editing static content? Any comments here would be greatly appreciated. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 9 Mar 2003 19:19:02 -0000 Issue 1928
php-general Digest 9 Mar 2003 19:19:02 - Issue 1928 Topics (messages 138838 through 138872): Re: stripslashes() 138838 by: Leif K-Brooks 138864 by: John W. Holmes A PHP UPDATE problem 138839 by: Terry Lau 138863 by: John W. Holmes Re: save to file 138840 by: Niels Andersen 138845 by: Edwin Boersma Re: no phun intended!!! 138841 by: Niels Andersen 138858 by: Richard Whitney pagination help 138842 by: Denis L. Menezes 138846 by: Kevin Waterson 138866 by: David Eisenhart Re: Php +Xml? 138843 by: Alexandru COSTIN 138844 by: Alexandru COSTIN Re: variable string names 138847 by: Edwin Boersma ob_start -- output buffer problem 138848 by: Alex Lance receiving data elements from Access 138849 by: Jan Bro Member function as error_handler 138850 by: Nik Makepeace 138867 by: David Eisenhart 138868 by: Nik Makepeace 138870 by: John W. Holmes Syntax query 138851 by: Nik Makepeace 138869 by: Ernest E Vogelsinger 138871 by: Nik Makepeace google-apis (was: error while reading google-search-results) 138852 by: Jens Lehmann What am i doing wrong? SQL Query in PHP 138853 by: Rahul.Brenda 138854 by: Chris Hayes 138855 by: Rahul.Brenda 138856 by: - Edwin 138857 by: Chris Hayes 138859 by: chris 138860 by: Rahul.Brenda 138862 by: John W. Holmes Re: What am i doing wrong? SQL Query in PHP [WORKS!!] 138861 by: Rahul.Brenda Cleaning up HTML table structure 138865 by: Jens Lehmann Form input security 138872 by: Chris Cook Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- --- Begin Message --- Try this (untestted): if(get_magic_quotes_gpc()){ foreach($_REQUEST as $vname => $value){ $$vname = stripslashes($vname); } } John Taylor-Johnston wrote: I need to stripslashes() practically every $value as I pass data from one submit to another. L\'apprentissage d\'une langue ... Instead of doing it to every $value, someone showed me once something I could add something to the beginning of my script. It was some type of code on a post_var that turned off the addslashes on every $value. Anyone have an idea of what I'm talking about? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. --- End Message --- --- Begin Message --- > I need to stripslashes() practically every $value as I pass data from one > submit to another. > > L\'apprentissage d\'une langue ... > > Instead of doing it to every $value, someone showed me once something I > could add something to the beginning of my script. It was some type of > code on a post_var that turned off the addslashes on every $value. Anyone > have an idea of what I'm talking about? Either turn off magic_quotes_gpc in php.ini or an .htaccess file or do something like this: Foreach($_GET as $key => $value) { $_GET[$key] = stripslashes($value); } and the same for $_POST, etc. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ --- End Message --- --- Begin Message --- Hello, I am creating a polling system. Its operation likes this: when the people vote the item, it updates the database by adding 1 for the item automatically. The part of code is showed here: $colname_rsAddVote = "1"; if (isset($HTTP_POST_VARS['Vote'])) { $colname_rsAddVote = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS['Vote'] : addslashes($HTTP_POST_VARS['Vote']); } mysql_select_db($database_cnTesting, $cnTesting); $query_rsAddVote = "UPDATE Testing SET GetVotes = GetVotes + 1 WHERE VoteID = %s", $colname_rsAddVote); $rsAddVote = mysql_query($query_rsAddVote, $cnTesting) or die(mysql_error()); ?> In fact, I use Dreamweaver MX to create the page. But When I run the page, it shows an error. I don't how to reform it. Thanks!! Terry _ ¤µ¤é¬P®y http://www.msn.com.hk/fortune/west/ ¹Bµ{ --- End Message --- --- Begin Message --- > I am creating a polling system. Its operation likes this: > when the people vote the item, it updates the database by adding 1 for the > item automatically. > The part of code is showed here: > > $colname_rsAddVote = "1"; > if (isset($HTTP_POST_VARS['Vote'])) { > $colname_rsAddVote = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS['Vote'] : > addslashes($HTTP_POST_VARS['Vote']); > } > mysql_select_db($database_cnTesting, $cnTesting); > $query_rsAddVote = "UPDATE Tes
[PHP] Form input security
Hello all, When using forms, when do I have to worry about cleaning up user data? I know to use escapeshellarg() when using system functions, but how about when using the user data for database inserts? Also, if I do not insert the data into the database or use any system commands, do I still need to clean the data? Thanks, Chris _ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Syntax query
On Mon, 2003-03-10 at 03:01, Ernest E Vogelsinger wrote: > At 13:38 09.03.2003, Nik Makepeace said: > [snip] > >Can anyone tell me why this doesn't work: > > > >$db_object = pg_fetch_object($this->getLastResult()); > > pg_fetch_object() returns an object with properties that correspond to the > fetched row. It returns FALSE if there are no more rows or error. Yes, the error was indeed between the chair and keyboard. In fact I had (while curious) lazily wrapped all queries in "begin" and "commit" and this was causing the problem - the last result was the result of the commit, not the select. Thanks anyway. Nik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Member function as error_handler
> > I'd recommend that you consider using the set_error_handler function > > Of course, this is what I am doing. My question is can I use a member > function of an object as an error handler? I don't seem to be able to, > but I might have overlooked something. Read the user notes on the manual page, there are a few suggestions on how you can do this. http://www.php.net/manual/en/function.set-error-handler.php ---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
Re: [PHP] Syntax query
At 13:38 09.03.2003, Nik Makepeace said: [snip] >Can anyone tell me why this doesn't work: > >$db_object = pg_fetch_object($this->getLastResult()); > >In imaginary interactive mode, it works like this: > >ME > echo $this->getLastResult(); >PHP> Resource id #67 >ME > echo $this->mr_lastResult; >PHP> Resource id #67 >ME > echo pg_fetch_object($this->getLastResult()); >PHP> >ME > echo pg_fetch_object($this->mr_lastResult); >PHP> > >Any ideas? [snip] From the docs: pg_fetch_object() returns an object with properties that correspond to the fetched row. It returns FALSE if there are no more rows or error. The behaviour of your code is expected if you looped either past the returned records, or there are no records returned by the previous query. -- >O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Member function as error_handler
On Mon, 2003-03-10 at 02:40, David Eisenhart wrote: > I'd recommend that you consider using the set_error_handler function Of course, this is what I am doing. My question is can I use a member function of an object as an error handler? I don't seem to be able to, but I might have overlooked something. Nik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Member function as error_handler
I'd recommend that you consider using the set_error_handler function. This'll let you create and use your own custom error handler function (which is fired for errors of the E_ERROR, E_WARNING and E_NOTICE type and also those errors that you deliberately trigger using trigger_error()) - very handy indeed! Of course rather than doing this on every page place such code in a single file and include this file (using the include construct or variation on this) within all your site pages. Hope this helps. David Eisenhart "Nik Makepeace" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Query One: Can I use a member function of an object as an error_handler? > > I currently declare a function for error handling with every page, but I > would like to put it in an object which lives in the session anyway. The > problem is I can't seem to do it; when I try to set the error handler to > a method, it defaults to PHP's usual methods. Is it me or PHP? > > MTIA, > Nik > -- > http://travelog.uberblog.com/ > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: pagination help
This is a good article on pagination: http://www.phpfreaks.com/tutorials/43/0.php David Eisenhart "Denis L. Menezes" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hello friends. My records on one page are bout 200. So I wish to paginate them and show only about 20 records per page with the page numbers at the bottom of the records table and also the "previous" and "next" links. I mean, something line Google's searcg results page numbering system. Can someone give me a link to some help files? Thanks Denis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cleaning up HTML table structure
The following problem seems to be hard to solve: A PHP-Script reads in an HTML-File and removes linebreaks, tabs and not needed spaces. After that the script should reconstruct the table-structure this way (example): ... ... The next thing is that lines longer than for instance 80 chars ($maxlength) should be split up into several lines. Is there any good way to solve this? Regular expressions seem to be of limited use because the recursion of tables can be infinitely deep and the lines between must not not be longer than $maxlength and should have the appropriate number of spaces before it. Stepping through the string (the whole file is a string) with simple String-functions is very complicated either. I hope you can give me some hints how to find a (simple) solution for this problem. Jens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] stripslashes()
> I need to stripslashes() practically every $value as I pass data from one > submit to another. > > L\'apprentissage d\'une langue ... > > Instead of doing it to every $value, someone showed me once something I > could add something to the beginning of my script. It was some type of > code on a post_var that turned off the addslashes on every $value. Anyone > have an idea of what I'm talking about? Either turn off magic_quotes_gpc in php.ini or an .htaccess file or do something like this: Foreach($_GET as $key => $value) { $_GET[$key] = stripslashes($value); } and the same for $_POST, etc. ---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
RE: [PHP] A PHP UPDATE problem
> I am creating a polling system. Its operation likes this: > when the people vote the item, it updates the database by adding 1 for the > item automatically. > The part of code is showed here: > > $colname_rsAddVote = "1"; > if (isset($HTTP_POST_VARS['Vote'])) { > $colname_rsAddVote = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS['Vote'] : > addslashes($HTTP_POST_VARS['Vote']); > } > mysql_select_db($database_cnTesting, $cnTesting); > $query_rsAddVote = "UPDATE Testing SET GetVotes = GetVotes + 1 WHERE > VoteID > = %s", $colname_rsAddVote); The above line is probably causing an error. You have $var = "string", $var); What are you trying to do? > $rsAddVote = mysql_query($query_rsAddVote, $cnTesting) or > die(mysql_error()); > ?> > In fact, I use Dreamweaver MX to create the page. > But When I run the page, it shows an error. I don't how to reform it. WHAT'S THE ERROR? It helps us tremendously if you actually tell us what the error is, what line it's on, and then show the relevant line with 5 or so lines before it also. ---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
RE: [PHP] What am i doing wrong? SQL Query in PHP
> I want to display the first 3 words of my record in > the my table and following is the code i'm using. > When i use the SQL Query in mySQL.. it works great.. > but when i try to implement it in my php page.. i'm > not getting anything.. no error, no display, no > result.. just blank.. why? > > > $db = mysql_connect("localhost","user","pass"); > mysql_select_db("mydb",$db); > > $result = mysql_query("SELECT substring_index(title, ' > ', 3) from news order by ID desc limit 4",$db); > if ($myrow = mysql_fetch_array($result)) { > do { > echo(" $myrow[title] "); > } while ($myrow = mysql_fetch_array($result)); > } > ?> In case you're wondering, your method is fine. You can continue to use this or what chris suggested. Either way, the problem is that you need an alias for your column that you selected. With the above code, you didn't select a column called "title" so you can't use $row['title']. You created a column called "substring_index(title, ' ', 3)" so you'll have to use $row["substring_index(title, ' ', 3)"]. As you can probably guess, there's an easier way to do it, though... If you use a query such as: SELECT SUBSTRING_INDEX(title, ' ', 3) AS f_title FROM news ORDER BY id LIMIT 4 You can then use $row['f_title'] to print the result. Using "AS" in your query will rename the column to "f_title" or whatever you put there. This is called assigning the column an alias. Of course, though all of this you could of just used $row[0] to get the value. I tend to stay away from using numerical indexes though, as it makes it harder for other people to follow your code. When you see $row['f_title'], it gives you a good idea of what you're displaying. When you see $row[0], you have no idea what it is and you have to go find the query that was run in order to determine what column zero was. Hope that helps. ---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
Re: [PHP] What am i doing wrong? SQL Query in PHP [WORKS!!]
Chris, Thanks a lot.. THIS WORKS! Works brilliantly. All other methods were just failing. Thanks man. > // fetch row is faster than fetch_assoc, which is > faster than fetch_array > // fetch_result might even be a better choice here, > though, with only one > item... > if (!mysql_num_rows($result)) { > print 'no results'; > } else { > while (list($title) = mysql_fetch_row($result)) { > print $title; // don't quote variables if you only > want to print them by > themselves > } > } Rahul S. Johari __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What am i doing wrong? SQL Query in PHP
Hi, > So, you still have a "blank" page? Yes i do actually, and blank in HTML Source too. > do you have "display_errors = On" in your php.ini? Ahan.. yes i do. > to this: > > echo $myrow["title"]; > > makes any difference. No actually it didnt. :0( Rahul S. Johari __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What am i doing wrong? SQL Query in PHP
On Sun, 9 Mar 2003 04:37:47 -0800 (PST), Rahul.Brenda <[EMAIL PROTECTED]> wrote: I want to display the first 3 words of my record in the my table and following is the code i'm using. When i use the SQL Query in mySQL.. it works great.. but when i try to implement it in my php page.. i'm not getting anything.. no error, no display, no result.. just blank.. why? $db = mysql_connect("localhost","user","pass"); mysql_select_db("mydb",$db); $result = mysql_query("SELECT substring_index(title, ' ', 3) from news order by ID desc limit 4",$db); if ($myrow = mysql_fetch_array($result)) { do { echo(" $myrow[title] "); } while ($myrow = mysql_fetch_array($result)); } ?> Rahul S. Johari Why not do it like this? // fetch row is faster than fetch_assoc, which is faster than fetch_array // fetch_result might even be a better choice here, though, with only one item... if (!mysql_num_rows($result)) { print 'no results'; } else { while (list($title) = mysql_fetch_row($result)) { print $title; // don't quote variables if you only want to print them by themselves } } -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] no phun intended!!!
BRAVO!!! Quoting Niels Andersen <[EMAIL PROTECTED]>: ### LOL ### ### I like PHP, but I also like wet girlies. But the two are not ### interchangable, ### which is a pitty, becouse sometimes I really could use a wet girl, and I ### only have PHP ### ### ### ### "Khalid El-Kary" <[EMAIL PROTECTED]> wrote in message ### news:[EMAIL PROTECTED] ### > sorry, but if PHP (a great piece of knowledge) worths a wet girl for ### you, ### so ### > you don't know how to appreciate knowledge. ### > ### > "Both PHP and mod_perl are knowledge, science that's more honourful than ### a ### > wet girl" ### > ### > Regards, ### > Khalid Al-Kary ### > http://creaturesx.ma.cx/kxparse/ ### > ### > >http://www.fingers.co.za/arb/mod_perl.jpg ### > > ### > >If this starts a flame war, I'm going to be rather disappointed at ### people ### > >that's not able to take a joke :P ### > > ### > >I think it's hilarious though... ### > > ### > >-- ### > >me ### > > ### > > ### > >-- ### > >PHP General Mailing List (http://www.php.net/) ### > >To unsubscribe, visit: http://www.php.net/unsub.php ### > ### > ### > _ ### > MSN 8 with e-mail virus protection service: 2 months FREE* ### > http://join.msn.com/?page=features/virus ### > ### ### ### ### -- ### PHP General Mailing List (http://www.php.net/) ### To unsubscribe, visit: http://www.php.net/unsub.php ### ### -- Richard Whitney * Transcend Development Producing the next phase of your internet presence. [EMAIL PROTECTED] * http://xend.net* 602-971-2791 * * * * * *__** _/ \___ * * / *\** */ * * \ **/\_ |\ / \_ / \ / \/\ / \ /\ / \ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What am i doing wrong? SQL Query in PHP
At 13:37 9-3-2003, you wrote: if ($myrow = mysql_fetch_array($result)) { do { echo(" $myrow[title] "); } while ($myrow = mysql_fetch_array($result)); } PS same result with while ($myrow = mysql_fetch_array($result)); { echo $myrow['title']; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What am i doing wrong? SQL Query in PHP
Hello, "Rahul.Brenda" <[EMAIL PROTECTED]> wrote: > Ok i tried this.. and i didn't get any error listed.. > so it seems that the mySQL Query is not failing in > syntax or logic.. but it's not picking up any rows. > Which is really stupid because i used my phpmyadmin > and i ran this SQL Query there and even then i got my > results.. So, you still have a "blank" page? Check the resulting html source code and see how it looks like. Also, do you have "display_errors = On" in your php.ini? Btw, see if changing this: > > > echo(" $myrow[title] "); to this: echo $myrow["title"]; makes any difference. Just my 2 cents... - E __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What am i doing wrong? SQL Query in PHP
Ok i tried this.. and i didn't get any error listed.. so it seems that the mySQL Query is not failing in syntax or logic.. but it's not picking up any rows. Which is really stupid because i used my phpmyadmin and i ran this SQL Query there and even then i got my results.. --- Chris Hayes <[EMAIL PROTECTED]> wrote: > At 13:37 9-3-2003, you wrote: > >I want to display the first 3 words of my record in > >the my table and following is the code i'm using. > >When i use the SQL Query in mySQL.. it works > great.. > >but when i try to implement it in my php page.. i'm > >not getting anything.. no error, no display, no > >result.. just blank.. why? > > i don't know what's wrog but you could do some quick > debugging > by echoing mysql_error() when the query fails. > ($result=mysql_query(.) or die ('Query > failed at'.__FILE__.' line > '.__LINE__.' and mysql says:'.mysql_error()); > > > > > >$db = mysql_connect("localhost","user","pass"); > >mysql_select_db("mydb",$db); > > > >$result = mysql_query("SELECT > substring_index(title, ' > >', 3) from news order by ID desc limit 4",$db); > >if ($myrow = mysql_fetch_array($result)) { > > do { > check whether there are some results walked through > by doing something > silly like echo '*'; here. > > > > echo(" $myrow[title] "); > > } while ($myrow = mysql_fetch_array($result)); > >} > >?> > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What am i doing wrong? SQL Query in PHP
At 13:37 9-3-2003, you wrote: I want to display the first 3 words of my record in the my table and following is the code i'm using. When i use the SQL Query in mySQL.. it works great.. but when i try to implement it in my php page.. i'm not getting anything.. no error, no display, no result.. just blank.. why? i don't know what's wrog but you could do some quick debugging by echoing mysql_error() when the query fails. ($result=mysql_query(.) or die ('Query failed at'.__FILE__.' line '.__LINE__.' and mysql says:'.mysql_error()); $db = mysql_connect("localhost","user","pass"); mysql_select_db("mydb",$db); $result = mysql_query("SELECT substring_index(title, ' ', 3) from news order by ID desc limit 4",$db); if ($myrow = mysql_fetch_array($result)) { do { check whether there are some results walked through by doing something silly like echo '*'; here. echo(" $myrow[title] "); } while ($myrow = mysql_fetch_array($result)); } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What am i doing wrong? SQL Query in PHP
I want to display the first 3 words of my record in the my table and following is the code i'm using. When i use the SQL Query in mySQL.. it works great.. but when i try to implement it in my php page.. i'm not getting anything.. no error, no display, no result.. just blank.. why? Rahul S. Johari __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] google-apis (was: error while reading google-search-results)
James wrote: LWP is a perl thing. Curl is probably the best thing to use. Have you tried using googles php api which they provide free? http://www.google.com/apis/ I had a look at the API, but I'm not sure if it's appropriate and easy to use with PHP. It's still beta and might change again (or maybe I've to pay for every query soon). Has anyone already used the api? Is it simple to (for instance) find out all listed pages of www.foo.com which are in the Top 1000? Jens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Syntax query
Can anyone tell me why this doesn't work: $db_object = pg_fetch_object($this->getLastResult()); In imaginary interactive mode, it works like this: ME > echo $this->getLastResult(); PHP> Resource id #67 ME > echo $this->mr_lastResult; PHP> Resource id #67 ME > echo pg_fetch_object($this->getLastResult()); PHP> ME > echo pg_fetch_object($this->mr_lastResult); PHP> Any ideas? Nik -- http://travelog.uberblog.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Member function as error_handler
Query One: Can I use a member function of an object as an error_handler? I currently declare a function for error handling with every page, but I would like to put it in an object which lives in the session anyway. The problem is I can't seem to do it; when I try to set the error handler to a method, it defaults to PHP's usual methods. Is it me or PHP? MTIA, Nik -- http://travelog.uberblog.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] receiving data elements from Access
I've got the following code: $datum_beginn="2002-12-12"; $datensatz=odbc_exec($db_connection,"select * from Termin where Datumsfeld >'#$datum_beginn#'"); I get an error message that data in creteria doesn't match. (free translation) The error def. lays in Datumsfeld >'#$datum_beginn#'. How do I get a list of all entries with a date that lay behind a certain date? I'd prefer to let the database do the job for me, rather than pulling everything out and get the relevant data with php. thx Jan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ob_start -- output buffer problem
Hi all, to quote from http://www.php.net/manual/en/function.ob-start.php > void ob_start ( [string output_callback]) > > An optional output_callback function may be specified. This function > takes a string as a parameter and should return a string. The function > will be called when ob_end_flush() is called, or when the output > buffer is flushed to the browser at the end of the request. My callback function does not get called unless I manually call ob_end_flush(). I'm not interested in calling ob_end_flush() at all, I want my callback function to be called "when the output buffer is flushed to the browser at the end of the request" so the question is why isn't this happening? here's my example: msg("got to initialize"); } function finish($page) { $this->msg("GOT TO FINISH!!!"); return $page; } function msg ($msg) { $msg = "\n" . exec("date") ." ::: ". $msg; $fp = fopen($this->msg_file, "a") or die ("cannot open ".$this->msg_file); fputs ($fp, $msg, strlen($msg)) or die ("cannot write to ".$this->msg_file); fclose($fp); } } ?> But if ob_end_flush() IS called then the error log WILL have the "GOT TO FINISH" message. Any ideas on why the output is not being flushed automatically? thanks Alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] variable string names
John's solution is the better one. But if you really wish to stick to your own, try and use eval() to complile $where$i. Edwin John W. Holmes wrote: I have: if ($where1 != '') { $whereArray = array_push($whereArray, $where1); } and I want to repeat for $where1 up to $where8 but rather than write it out 8 times, I'd rather use a loop for ($i=1; $i<=8 i++) { if ($where1 != '') { $whereArray = array_push($whereArray, $where1); } } but how can I change $where1 to $where2, $where3 etc using $i. nothing I try seems to work. Do I use eval? Yes, you can use variable variables, like others have suggested, but why not just use an array? Almost every implementation of variable-variables seems to be a work around that's used instead of arrays. Where are all of your $where variables coming from? If they are from a form, just name them as "where[]", then simply loop through them using foreach($_POST['where']) and check them all. This makes your code more dynamic as you can add/subtract "where[]" elements and your "processing" code doesn't change. With a variable-variable solution, you have to change the number of loops you run each time to change the number of "where" elements you have. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pagination help
This one time, at band camp, "Denis L. Menezes" <[EMAIL PROTECTED]> wrote: > Hello friends. > Can someone give me a link to some help files? http://www.phpbuilder.com/columns/rod20001214.php3 Kevin -- __ (_ \ _) ) | / / _ ) / _ | / ___) / _ ) | | ( (/ / ( ( | |( (___ ( (/ / |_| \) \_||_| \) \) Kevin Waterson Port Macquarie, Australia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: save to file
Enough answers, I think? If you want EACH value of $_POST on a new line, then why not implode with \n instead of \t? Now you get only one big line, because you only WRITE one \n. Edwin Ryan Holowaychuk wrote: I am trying to save to a text file. And I have managed to do that part now, but what happens is when I save to the file, all the lines get put into one big line in the file. I am creating a roster input that I adding to our website: No, name grade . The roster will contain 15 players So right now the implode puts everything on one line in the text file!!! So I am no sure if anybody can shed some light on this one. Thanks again Ryan //create a new file $fp = fopen("/place/on/server/" . $HTTP_POST_VARS['team'] , "w"); $file_data = implode("\t\", $_POST); //this would return values spit by tabs //write to the open file handle fwrite($fp, $file_data . "\r\n"); //close the file fclose($fp); ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Php +Xml?
Hello James, Your vision is very similar to ours. You should take the Krysalis platform (LGPL) and give it a try. It's a mature solution (similar to cocoon) for XML/XSL publishing, and allows you to define the way requests are served, define the way dynamic XML trees are created and then define how to add the presentation layer to them. Alexandru -- Alexandru COSTIN Chief Operating Officer http://www.interakt.ro/ +4021 411 2610 "James" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > There are distinct differences to parsing XML into your program and > producing XML from your program. > > We use the following method's which are enabling us to create scalable > systems with independent design from code. > One of the clear reasons for using XML/XSLT is the seperation of data and > design. If you imagine that your ecommerce application is working very well > and doesnt need changing but you have a new client who wants the system in > thier design. Usually, there will come a point where you have to change > hardcoded design elements within your ecommerce application - and if the > design is radically different you will need to do conditional statements to > determine which design to use - a real pain. More importantly your playing > with your engine (code) when in fact all you really wanted to do was put on > some new alloys! :-) It's boring, time consuming and often results in * > up code. > > If you take the XML and XSLT path you instantly change your method. Your > ecommerce application only EVER spews out XML. That's it's purpose in > life - it has it's business rules and it's resulting output and design is > never a factor. The XSLT style sheets are used to implement the XML into a > valid document usable by humans. In essence you can now have a 1000 > independent designs which never require a single code change in your main > commerce app. Taking it further you can employ your xsl sheets to spew out > WML, CSV, XML etc etc. Simply, your have reached a true data and design > independence. > > Added to this you can offer third parties an industry standard form of data > exchange. You can use multiple languages and know with confidence that none > of them have to understand each other. We are using this method very > shortly to create a win32 application using the XML feed from our commerce > engine. Eventually it will be used by our customer service team. > > >php are > > insanely tedious to replicate in xsl :| > > > > I totally disagree. Take the following: > > for ($i=0;$i<=10;$i++){ > echo "Hello"; > } > > > Take the following in XSLT: > > > > > > They may be about the same in number of lines but the php app must be > modified to create a different table type. It is true however that unless > you need to something on a large scale these methods may be to much. > > > James. > > > > > > > > "Daniel" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > wot exactly does the xml parse do over sablot ? and what benfit do u get > > xml'ing an entire site , where some processes which come easy to do in php > are > > insanely tedious to replicate in xsl :| > > > > >= Original Message From "James" <[EMAIL PROTECTED]> = > > >There is nothing to install. > > > > > >By default php usually comes with XML parser methods - however if you > want > > >to invest time in running XSLT/XPATH styles against XML you need to > install > > >server side software such as Sablotron or Saxon. We run Sablotron and > it's > > >very good. We've also invested in Stylus Studio which is a good xml/xslt > > >development tool. > > > > > >I'm not really sure what you want to do so it's difficult to help you > > >further.If you give a small idea of what it is you want to achieve > then > > >it might be easier to help you on your way. > > > > > >Jim. > > > > > > > > >"Dhaval Desai" <[EMAIL PROTECTED]> wrote in message > > >news:[EMAIL PROTECTED] > > >> Hello people, > > >> > > >> I want to start using Xml with php. How do I install xml on Apache with > > >Php? > > >> I am running redhat 7.2,Apache 1.3.12 and php latest version. > > >> > > >> How do I install xml? I am totally new to Xmland want to start > > >> somewhere... > > >> > > >> -Dhaval > > >> > > >> > > >> > > >> > > >> > > >> _ > > >> MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. > > >> http://join.msn.com/?page=features/virus > > >> > > > > > > > > > > > >-- > > >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: Php +Xml?
Hello, DomXML is a large improvement over Sablot. If you take a close look at XML, you'll see that XML is used effectively with some technologies : SAX (Simple Api for XML), DOM (Document Object Modelling), XSL (Extensible styleshhet language). The DOMxml php extension (http://www.php.net/manual/en/ref.domxml.php) is a wrapper for PHP usage of the libxml2 (xmlsoft.org) and libxslt1 (xmlsoft.org/XSLT) that helps you load XML files into DOM trees, manipulate them using standard DOM API and transform them using XSL (with a blazing speed, also). You should compile your PHP version with DOM support (we have some RPMS created for PHP with DOMXML support for Redhat 8.0, but they are not released yet to the public as they are experimental). I hope you have a better start now. Alexandru -- Alexandru COSTIN Chief Operating Officer http://www.interakt.ro/ +4021 411 2610 "Daniel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > what is domxml ? is it similar to sablot ? > >= Original Message From "Alexandru COSTIN" <[EMAIL PROTECTED]> = > >Hello, > > > >> Hello people, > >> > >> I want to start using Xml with php. How do I install xml on Apache with > >Php? > >> I am running redhat 7.2,Apache 1.3.12 and php latest version. > >If you want to use SAX, you should already have it installed if you have > >compiled PHP with '--with-xml'. (BTW, have you compiled PHP yourself? - do > >you know how to compile PHP?). > > > >First of all you should upgrade to a newer apache, as as far as I know > >Apache 1.3.12 had some problem when ran with Sablotron (this would be needed > >if you will want to use XML with XSL transformations) > > > >Then you should use the domxml extension (add '--with-dom' > >'--with-dom-xslt' '--with-dom-exslt' to your configure patch when you are > >compiling PHP). After you compile PHP, you should have support for SAX, DOM > >and XSL transformations. > > > >And if you want a bootstrap to start using XMLs for content publishing, > >you should also look at Krysalis at > >http://www.interakt.ro/products/Krysalis/ > > > >Alexandru > > > >> > >> How do I install xml? I am totally new to Xmland want to start > >> somewhere... > >> > >> -Dhaval > >> > >> > >> > >> > >> > >> _ > >> MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. > >> http://join.msn.com/?page=features/virus > >> > > > > > > > > > >-- > >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] pagination help
Hello friends. My records on one page are bout 200. So I wish to paginate them and show only about 20 records per page with the page numbers at the bottom of the records table and also the "previous" and "next" links. I mean, something line Google's searcg results page numbering system. Can someone give me a link to some help files? Thanks Denis
Re: [PHP] no phun intended!!!
LOL I like PHP, but I also like wet girlies. But the two are not interchangable, which is a pitty, becouse sometimes I really could use a wet girl, and I only have PHP "Khalid El-Kary" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > sorry, but if PHP (a great piece of knowledge) worths a wet girl for you, so > you don't know how to appreciate knowledge. > > "Both PHP and mod_perl are knowledge, science that's more honourful than a > wet girl" > > Regards, > Khalid Al-Kary > http://creaturesx.ma.cx/kxparse/ > > >http://www.fingers.co.za/arb/mod_perl.jpg > > > >If this starts a flame war, I'm going to be rather disappointed at people > >that's not able to take a joke :P > > > >I think it's hilarious though... > > > >-- > >me > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php > > > _ > MSN 8 with e-mail virus protection service: 2 months FREE* > http://join.msn.com/?page=features/virus > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: save to file
You want to add a new line every time your form is submittet, am I right? Then you should open the file for appending, using fopen(filename, "a") instead of "w" "Ryan Holowaychuk" <[EMAIL PROTECTED]> wrote in message news:!~!UENERkVCMDkAAQACABgAu5ugyx6+hUW5gsOu6grgVMKA AAAQGYzyr/XD3kWb/[EMAIL PROTECTED] > I am trying to save to a text file. And I have managed to do that part > now, but what happens is when I save to the file, all the lines get put > into one big line in the file. > > I am creating a roster input that I adding to our website: No, name > grade . > > The roster will contain 15 players > > So right now the implode puts everything on one line in the text file!!! > > So I am no sure if anybody can shed some light on this one. > > Thanks again > Ryan > > //create a new file >$fp = fopen("/place/on/server/" . $HTTP_POST_VARS['team'] , "w"); > >$file_data = implode("\t\", $_POST); > //this would return values spit by tabs > //write to the open file handle > fwrite($fp, $file_data . "\r\n"); > //close the file > fclose($fp); > > ?> > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php