Re: [PHP] my paging task with PHP does not work. It uses cookie.
Hi Arvid, thank you very much for your remark. It is useful for me. === On Fri, 14 Sep 2007 12:01:40 +0300 Arvids Godjuks [EMAIL PROTECTED] wrote: Don't use SQL_CALC_FOUND ROWS on simple queries, when you have to run a simple query on one or two (with join) tables with a simple WHERE. Especialy if tables are big. I found out that single SELECT COUNT(id) FROM table is far more faster when query has simple WHERE conditions. I use SQL_CALC_FOUND_ROWS only with a rather complex queries - that SQL_CALC_FOUND_ROWS doesn't affect query execution at all (well, it affects ofcourse, but affect is so small, you can't see it). -- Patrik Hasibuan [EMAIL PROTECTED] Junior Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] my paging task with PHP does not work. It uses cookie.
Dear Brian, My problem is solved. thank you very much for your help. === On Wed, 12 Sep 2007 14:04:11 -0400 brian [EMAIL PROTECTED] wrote: Patrik Hasibuan wrote: Dear my friends... I am trying to display the content of a table. Each page must content only 5 records maximum. Each page has Previous and Next buttons (made from anchor). I dump the primary of the working table and keep it in a cookie. So than the paging task work with the index of cookie array. But the $curguruescomidiklan stays 0 each time I click Next button. Patrick, i can't say what the problem is, but i recommend using the PEAR Pager package for this if you have PEAR available. It takes care of a lot of the heavy lifting and is very configurable. http://pear.php.net/package/Pager This does not require setting any cookies. brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Patrik Hasibuan [EMAIL PROTECTED] Junior Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] my paging task with PHP does not work. It uses cookie.
Dear mike, your thread solved my problem. I really appreciate your help. Thank you very much. On Thu, 13 Sep 2007 14:49:29 -0700 mike [EMAIL PROTECTED] wrote: warning: this is VERY UGLY CODE. i wrote it 3-4 years ago now i think and it just keeps working. you call it this way: # pagination. if(isset($_GET['pg'])) { $page = intval($_GET['pg']); } else { $page = 1; } $page = sprintf(%02d,$page); $query = Array( 'query' = SELECT foo FROM bar, 'itemsperpage' = 50, 'maxdisplay'= 20, 'linkprefix'= $_SERVER[PHP_SELF]?f=$forum_idpg= ); list($pages,$numpages,$items,$threads) = paginate_sql($page,$query); $pages is the html formatted links $numpages is the total number of pages i dont actually use $items much but i think it just tells you how many items (which is the same as itemsperpage... i believe) $threads is the mysql rows resource (you can use mysql_fetch_rows on it) function paginate_sql($thispage,$options) { $offset = $options['itemsperpage'] * ($thispage - 1); if(isset($options['server'])) { $results = db_query(eregi_replace(^SELECT,SELECT SQL_CALC_FOUND_ROWS,$options['query']).LIMIT $offset,$options[itemsperpage],$options['server']); $rows = db_query(SELECT FOUND_ROWS(),$options['server']); } else { $results = db_query(eregi_replace(^SELECT,SELECT SQL_CALC_FOUND_ROWS,$options['query']).LIMIT $offset,$options[itemsperpage]); $rows = db_query(SELECT FOUND_ROWS()); } list($totalitems) = db_rows($rows); db_free($rows); $html = ; $numpages = ceil($totalitems / $options['itemsperpage']); if(isset($options['maxpages']) $numpages $options['maxpages']) { $numpages = $options['maxpages']; } if($thispage 1 || $totalitems $options['itemsperpage']) { $thispage = sprintf(%02d,1); } if($thispage $numpages $numpages 0) { header(sprintf(Location: %s01, str_replace(amp;,,$options['linkprefix']))); exit(); } $start = (ceil($thispage / $options['maxdisplay'])-1) * $options['maxdisplay'] + 1; if($start == 1) { $html .= laquo;; } else { $html .= sprintf(a href=\%s%02d\laquo;/a, $options['linkprefix'], $start-1); } if(isset($options['maxdisplay']) $options['maxdisplay'] != 0 $numpages $options['maxdisplay']) { $numlist = $options['maxdisplay'] + $start - 1; } else { $numlist = $numpages + $start - 1; } if($numlist $numpages) { $numlist = $numpages; } for($x=$start; $x=$numlist; $x++) { if($x == $thispage) { $html .= sprintf( %02d, $x); } else { $html .= sprintf( a href=\%s%02d\%02d/a, $options['linkprefix'], $x, $x); } } if($numlist == $numpages) { $html .= raquo;; } else { $html .= sprintf( a href=\%s%02d\raquo;/a, $options['linkprefix'], $numlist+1); } if($totalitems = $options['itemsperpage']) { $html = ; } return Array($html,sprintf(%02d,$numpages),$totalitems,$results); } On 9/13/07, Patrik Hasibuan [EMAIL PROTECTED] wrote: Hi Mike, I am intrested for the solution you gave me. But I am confused of the way in implementing select FOUND_ROWS(). I wrote another very simple codes as the first step for understanding this threat: ?php $konek=mysql_connect(127.0.0.1,root,mypassword); if ($konek){ for ($i=0;$i2;$i++){ $sqlku=select SQL_CALC_FOUND_ROWS id_iklan from lowongan limit 5;; $sqlkupage=select FOUND_ROWS(); $mybd=mysql_select_db(headhunter,$konek); $kueri=mysql_query($sqlku,$konek) or die('MYSQL QUERY ERROR ['.mysql_errno($konek).'] '.mysql_error($konek)); $kueri=mysql_query($sqlkupage,$konek) or die('MYSQL QUERY ERROR ['.mysql_errno($konek).'] '.mysql_error($konek)); while($brs=mysql_fetch_row($kueri)){ list($idiklan)=$brs; echo FirstItem a href=\showit.php?id=$idiklan\$idiklan/abr; } } }else{ echo I can't talk to the serverbr; exit(); } ? I've put nine records into the table of lowongan, idiklan 1 to 9. Look I get of course only one record, namely the: '9'. This is the output of my codes in my internet browser. === FirstItem 9 FirstItem 9 === The output what I am expecting suppose to be: on the $i=0 FirstItem 1 FirstItem 2 FirstItem 3 FirstItem 4 FirstItem 5 and on the $i=1 FirstItem 6 FirstItem 7 FirstItem 8 FirstItem 9 FirstItem 9 I read on the documentation of MySQL but I couldn't find any code of sample also in the
Re: [PHP] my paging task with PHP does not work. It uses cookie.
Don't use SQL_CALC_FOUND ROWS on simple queries, when you have to run a simple query on one or two (with join) tables with a simple WHERE. Especialy if tables are big. I found out that single SELECT COUNT(id) FROM table is far more faster when query has simple WHERE conditions. I use SQL_CALC_FOUND_ROWS only with a rather complex queries - that SQL_CALC_FOUND_ROWS doesn't affect query execution at all (well, it affects ofcourse, but affect is so small, you can't see it).
Re: [PHP] my paging task with PHP does not work. It uses cookie.
except i think innodb does not have a full row count stored. anyway the design was meant for a simple one function call. it's worked great for small and data loads. On 9/14/07, Arvids Godjuks [EMAIL PROTECTED] wrote: Don't use SQL_CALC_FOUND ROWS on simple queries, when you have to run a simple query on one or two (with join) tables with a simple WHERE. Especialy if tables are big. I found out that single SELECT COUNT(id) FROM table is far more faster when query has simple WHERE conditions. I use SQL_CALC_FOUND_ROWS only with a rather complex queries - that SQL_CALC_FOUND_ROWS doesn't affect query execution at all (well, it affects ofcourse, but affect is so small, you can't see it). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] my paging task with PHP does not work. It uses cookie.
2007. 09. 14, péntek keltezéssel 10.50-kor mike ezt írta: except i think innodb does not have a full row count stored. of course not, but SQL_CALC_FOUND_ROWS does not use that. it is working like it selects the rows and counts them. and in the case of complex queries (where you use more than one table) you could not make use of that stored value anyway. greets Zoltán Németh anyway the design was meant for a simple one function call. it's worked great for small and data loads. On 9/14/07, Arvids Godjuks [EMAIL PROTECTED] wrote: Don't use SQL_CALC_FOUND ROWS on simple queries, when you have to run a simple query on one or two (with join) tables with a simple WHERE. Especialy if tables are big. I found out that single SELECT COUNT(id) FROM table is far more faster when query has simple WHERE conditions. I use SQL_CALC_FOUND_ROWS only with a rather complex queries - that SQL_CALC_FOUND_ROWS doesn't affect query execution at all (well, it affects ofcourse, but affect is so small, you can't see it). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] my paging task with PHP does not work. It uses cookie.
Hi Mike, I am intrested for the solution you gave me. But I am confused of the way in implementing select FOUND_ROWS(). I wrote another very simple codes as the first step for understanding this threat: ?php $konek=mysql_connect(127.0.0.1,root,mypassword); if ($konek){ for ($i=0;$i2;$i++){ $sqlku=select SQL_CALC_FOUND_ROWS id_iklan from lowongan limit 5;; $sqlkupage=select FOUND_ROWS(); $mybd=mysql_select_db(headhunter,$konek); $kueri=mysql_query($sqlku,$konek) or die('MYSQL QUERY ERROR ['.mysql_errno($konek).'] '.mysql_error($konek)); $kueri=mysql_query($sqlkupage,$konek) or die('MYSQL QUERY ERROR ['.mysql_errno($konek).'] '.mysql_error($konek)); while($brs=mysql_fetch_row($kueri)){ list($idiklan)=$brs; echo FirstItem a href=\showit.php?id=$idiklan\$idiklan/abr; } } }else{ echo I can't talk to the serverbr; exit(); } ? I've put nine records into the table of lowongan, idiklan 1 to 9. Look I get of course only one record, namely the: '9'. This is the output of my codes in my internet browser. === FirstItem 9 FirstItem 9 === The output what I am expecting suppose to be: on the $i=0 FirstItem 1 FirstItem 2 FirstItem 3 FirstItem 4 FirstItem 5 and on the $i=1 FirstItem 6 FirstItem 7 FirstItem 8 FirstItem 9 FirstItem 9 I read on the documentation of MySQL but I couldn't find any code of sample also in the php.net. Would be so kind to give me a very simple code of sample? Thank you very much in advance. On Wed, 12 Sep 2007 11:58:04 -0700 mike [EMAIL PROTECTED] wrote: On 9/12/07, Patrik Hasibuan [EMAIL PROTECTED] wrote: Dear my friends... I am trying to display the content of a table. Each page must content only 5 records maximum. Each page has Previous and Next buttons (made from anchor). I dump the primary of the working table and keep it in a cookie. So than the paging task work with the index of cookie array. But the $curguruescomidiklan stays 0 each time I click Next button. yeah there is no reason to be using cookies for this. just using query string parameters should work. for pagination you need to know: total number of items number of items per page after that you know how many pages (numitems / itemsperpage) and work out the links appropriately (i.e. page1 has no previous, $maxpage has no next) and you can put the number of pages down how you want (if you want to do prev 3 4 5 next, or next 1 2 3 4 5 6 7 8 9 prev, there's a ton of strategies to print out what pages to show, and next, previous, jump to end, jump to beginning, etc) i've never used the PEAR class or anything else, i made a function a long time ago that actually works in conjunction with mysql's SELECT FOUND_ROWS() and uses a LIMIT offset,number to save the overhead of fetching every row from the database to only show the ones for that page. it's actually worked well for 4 years now without a single change... at some point perhaps i'll clean it up and post it somewhere, and someone might be able to make it even better. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Patrik Hasibuan [EMAIL PROTECTED] Junior Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] my paging task with PHP does not work. It uses cookie.
warning: this is VERY UGLY CODE. i wrote it 3-4 years ago now i think and it just keeps working. you call it this way: # pagination. if(isset($_GET['pg'])) { $page = intval($_GET['pg']); } else { $page = 1; } $page = sprintf(%02d,$page); $query = Array( 'query' = SELECT foo FROM bar, 'itemsperpage' = 50, 'maxdisplay'= 20, 'linkprefix'= $_SERVER[PHP_SELF]?f=$forum_idpg= ); list($pages,$numpages,$items,$threads) = paginate_sql($page,$query); $pages is the html formatted links $numpages is the total number of pages i dont actually use $items much but i think it just tells you how many items (which is the same as itemsperpage... i believe) $threads is the mysql rows resource (you can use mysql_fetch_rows on it) function paginate_sql($thispage,$options) { $offset = $options['itemsperpage'] * ($thispage - 1); if(isset($options['server'])) { $results = db_query(eregi_replace(^SELECT,SELECT SQL_CALC_FOUND_ROWS,$options['query']).LIMIT $offset,$options[itemsperpage],$options['server']); $rows = db_query(SELECT FOUND_ROWS(),$options['server']); } else { $results = db_query(eregi_replace(^SELECT,SELECT SQL_CALC_FOUND_ROWS,$options['query']).LIMIT $offset,$options[itemsperpage]); $rows = db_query(SELECT FOUND_ROWS()); } list($totalitems) = db_rows($rows); db_free($rows); $html = ; $numpages = ceil($totalitems / $options['itemsperpage']); if(isset($options['maxpages']) $numpages $options['maxpages']) { $numpages = $options['maxpages']; } if($thispage 1 || $totalitems $options['itemsperpage']) { $thispage = sprintf(%02d,1); } if($thispage $numpages $numpages 0) { header(sprintf(Location: %s01, str_replace(amp;,,$options['linkprefix']))); exit(); } $start = (ceil($thispage / $options['maxdisplay'])-1) * $options['maxdisplay'] + 1; if($start == 1) { $html .= laquo;; } else { $html .= sprintf(a href=\%s%02d\laquo;/a, $options['linkprefix'], $start-1); } if(isset($options['maxdisplay']) $options['maxdisplay'] != 0 $numpages $options['maxdisplay']) { $numlist = $options['maxdisplay'] + $start - 1; } else { $numlist = $numpages + $start - 1; } if($numlist $numpages) { $numlist = $numpages; } for($x=$start; $x=$numlist; $x++) { if($x == $thispage) { $html .= sprintf( %02d, $x); } else { $html .= sprintf( a href=\%s%02d\%02d/a, $options['linkprefix'], $x, $x); } } if($numlist == $numpages) { $html .= raquo;; } else { $html .= sprintf( a href=\%s%02d\raquo;/a, $options['linkprefix'], $numlist+1); } if($totalitems = $options['itemsperpage']) { $html = ; } return Array($html,sprintf(%02d,$numpages),$totalitems,$results); } On 9/13/07, Patrik Hasibuan [EMAIL PROTECTED] wrote: Hi Mike, I am intrested for the solution you gave me. But I am confused of the way in implementing select FOUND_ROWS(). I wrote another very simple codes as the first step for understanding this threat: ?php $konek=mysql_connect(127.0.0.1,root,mypassword); if ($konek){ for ($i=0;$i2;$i++){ $sqlku=select SQL_CALC_FOUND_ROWS id_iklan from lowongan limit 5;; $sqlkupage=select FOUND_ROWS(); $mybd=mysql_select_db(headhunter,$konek); $kueri=mysql_query($sqlku,$konek) or die('MYSQL QUERY ERROR ['.mysql_errno($konek).'] '.mysql_error($konek)); $kueri=mysql_query($sqlkupage,$konek) or die('MYSQL QUERY ERROR ['.mysql_errno($konek).'] '.mysql_error($konek)); while($brs=mysql_fetch_row($kueri)){ list($idiklan)=$brs; echo FirstItem a href=\showit.php?id=$idiklan\$idiklan/abr; } } }else{ echo I can't talk to the serverbr; exit(); } ? I've put nine records into the table of lowongan, idiklan 1 to 9. Look I get of course only one record, namely the: '9'. This is the output of my codes in my internet browser. === FirstItem 9 FirstItem 9 === The output what I am expecting suppose to be: on the $i=0 FirstItem 1 FirstItem 2 FirstItem 3 FirstItem 4 FirstItem 5 and on the $i=1 FirstItem 6 FirstItem 7 FirstItem 8 FirstItem 9 FirstItem 9 I read on the documentation of MySQL but I couldn't find any code of sample also in the php.net. Would be so kind to give me a very simple code of sample? Thank you very much in advance. On Wed, 12 Sep 2007 11:58:04 -0700 mike [EMAIL PROTECTED] wrote: On 9/12/07, Patrik Hasibuan [EMAIL PROTECTED] wrote: Dear my friends... I am trying to display the content of a table. Each page must
[PHP] my paging task with PHP does not work. It uses cookie.
Dear my friends... I am trying to display the content of a table. Each page must content only 5 records maximum. Each page has Previous and Next buttons (made from anchor). I dump the primary of the working table and keep it in a cookie. So than the paging task work with the index of cookie array. But the $curguruescomidiklan stays 0 each time I click Next button. The main part of doing the paging task is this lines: for ($it=$curguruescomidiklan;$it$itot;$it++){ $idad=$guruescomidiklan[$it]; echo idad= $idadbr; echo it: $itbr; bukaiklan($idad); } . Please tell me why PHP does not work as I expect. Thank you very much in advance. = html ?php session_start(); session_register(tiket); setcookie(curguruescomidiklan); setcookie(guruescomidiklan,); setcookie(jmli); $tiket=session_id(); $pageamount = 5; ? table align=center tr !--Bagian Pencari Kerja-- td valign=top background=gambar/gbkiri.gif table align=right border=0 cellpadding=0 cellspacing=0 width=300 tr td align=left table border=1 cellpadding=0 cellspacing=0 ?php if ($curguruescomidiklan0){ echo trtda href=\index.php?p=t\ style=\text-decoration:none;\Previous/a/td/tr; } ? /table /td td/td td align=right table border=1 cellpadding=0 cellspacing=0 trtd ?php if (($jmli % $curguruescomidiklan)1 or $curguruescomidiklan==0){ echo a href=\index.php?p=n\ style=\text-decoration:none;\Next/a/td/tr; } ? /td/tr /table /td /tr trtd ?php echo trth colspan=12Lowongan Kerja/th/tr; include_once koneksi.php; $sqlnya= select l.id_iklan from perusahaan as p right join lowongan as l on l.id_account=p.id_account where l.lama_tayang = (current_date-l.mulai_tayang) order by bid desc ; $kelas=new koneksi(); $klas=$kelas-getkoneksi(headhunter,$sqlnya); $jmli=mysql_num_rows($klas); if ( $jmli 0 ) { $i=0; while(list($idiklan)=mysql_fetch_row($klas)) { // echo ID Iklannya: $idiklanbr; setcookie(guruescomidiklan[$i],$idiklan); $i++; } } else { echo No Ad of job vacancy currently in our databasebr; } if (empty($curguruescomidiklan)){ $curguruescomidiklan=0; } //echo pa: $pageamountbr; if (isset($p)){ $nt=$_GET['p']; } //I meant this part should direct the page content to be the next array contents if ($jmli=$pageamount){ echo curguruescomidiklan --$curguruescomidiklanbr; if ($nt=='t'){ $itot=$_COOKIE['curguruescomidiklan']-$pageamount; }else{ $itot=$_COOKIE['curguruescomidiklan']+$pageamount; echo lewat sini $curguruescomidiklan $pageamountbr; } echo itot 1 --$itotbr; }else{ $itot=$jmltot; echo itot 2 --$itotbr; } for ($it=$curguruescomidiklan;$it$itot;$it++){ $idad=$guruescomidiklan[$it]; echo idad= $idadbr; echo it: $itbr; bukaiklan($idad); } $itot=$itot+$pageamount; setcookie(curguruescomidiklan,$itot); echo curguruescomidiklan-- $curguruescomidiklanbr; function bukaiklan($myid){ //echo myid=$myidbr; $sqlnya= select p.company_fullname, p.company_address, p.city, p.country, p.postcode, p.phone, p.fax, p.url, p.company_description, l.iklan, l.id_iklan from perusahaan as p right join lowongan as l on l.id_account=p.id_account where l.lama_tayang = (current_date-l.mulai_tayang) and l.id_iklan='$myid' order by bid desc ; $kelassqlbukaiklan=new koneksi(); $klassqlbukaiklan=$kelassqlbukaiklan-getkoneksi(headhunter,$sqlnya); if ( mysql_num_rows($klassqlbukaiklan) 0 ) { while(list($namaprsh, $alamat, $kota, $negara, $kodepos, $telfon, $faks, $url, $comdesc, $iklan, $idiklan)=mysql_fetch_row($klassqlbukaiklan)) { echo trtd valign=\top\Employer/tdtd valign=\top\:/tdtd valign=\top\ colspan=10$namaprsh/td/tr; echo trtd valign=\top\Address/tdtd valign=\top\:/tdtd valign=\top\ colspan=10$alamat/td/tr; echo trtd valign=\top\City/tdtd valign=\top\:/tdtd valign=\top\ colspan=10$kota/td/tr; echo trtd valign=\top\Country/tdtd valign=\top\:/tdtd valign=\top\ colspan=10$negara/td/tr; echo trtd valign=\top\Postcode/tdtd valign=\top\:/tdtd colspan=10 valign=\top\$kodepos/td/tr; echo trtd valign=\top\Fax/tdtd valign=\top\:/tdtd valign=\top\ colspan=10$faks/td/tr; echo trtd valign=\top\Website/tdtd valign=\top\:/tdtd colspan=10 valign=\top\$url/td/tr; echo trtd valign=\top\Business Field/tdtd valign=\bottom\:/tdtd valign=\bottom\ colspan=10$comdesc/td/tr; echo trtd colspan=12$iklan/td/tr; echo trtd colspan=12 height=16/td/tr; } } else { echo No Ad of job vacancy currently in our database, possibly ads-id wrong.br; } } ? /td/tr/table /td !--Bagian Toko Buku Guru-- td valign=top /td !--Bagian Employer-- td valign=top /td /tr /table /body /html -- Patrik
Re: [PHP] my paging task with PHP does not work. It uses cookie.
Patrik Hasibuan wrote: Dear my friends... I am trying to display the content of a table. Each page must content only 5 records maximum. Each page has Previous and Next buttons (made from anchor). I dump the primary of the working table and keep it in a cookie. So than the paging task work with the index of cookie array. But the $curguruescomidiklan stays 0 each time I click Next button. Patrick, i can't say what the problem is, but i recommend using the PEAR Pager package for this if you have PEAR available. It takes care of a lot of the heavy lifting and is very configurable. http://pear.php.net/package/Pager This does not require setting any cookies. brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] my paging task with PHP does not work. It uses cookie.
On 9/12/07, Patrik Hasibuan [EMAIL PROTECTED] wrote: Dear my friends... I am trying to display the content of a table. Each page must content only 5 records maximum. Each page has Previous and Next buttons (made from anchor). I dump the primary of the working table and keep it in a cookie. So than the paging task work with the index of cookie array. But the $curguruescomidiklan stays 0 each time I click Next button. yeah there is no reason to be using cookies for this. just using query string parameters should work. for pagination you need to know: total number of items number of items per page after that you know how many pages (numitems / itemsperpage) and work out the links appropriately (i.e. page1 has no previous, $maxpage has no next) and you can put the number of pages down how you want (if you want to do prev 3 4 5 next, or next 1 2 3 4 5 6 7 8 9 prev, there's a ton of strategies to print out what pages to show, and next, previous, jump to end, jump to beginning, etc) i've never used the PEAR class or anything else, i made a function a long time ago that actually works in conjunction with mysql's SELECT FOUND_ROWS() and uses a LIMIT offset,number to save the overhead of fetching every row from the database to only show the ones for that page. it's actually worked well for 4 years now without a single change... at some point perhaps i'll clean it up and post it somewhere, and someone might be able to make it even better. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Does not work
ðÒÉ×ÅÔ! Saci wrote: Who cares about privacy on my own company Intranet ? Anyone not willing to show where they has been surfing on the net to any unexperienced bycomer. Youu may read the history, but you just have *no* warranty that it will not be cleared at runtime. Since you have control on the machines (which you should have said at the beginning to have people help you) you'd be better off by having them configured to actually give the HTTP_referer string to Apache. It would be much more solid. Besides, there *are* international laws concerning privacy at work, so I am not sure a determined employee could not getting your company into trouble because of your watching what he is doing. ÐÏËÁ áÌØÂÅÒÔÏ ëÉÅ× -_=}{=_-@-_=}{=_--_=}{=_-@-_=}{=_--_=}{=_-@-_=}{=_--_=}{=_- LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu? lOrD i'M sHiNiNg... YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE tHe TeSt, YeS iT iS ThE tEsT, yEs It Is tHe TeSt, YeS iT iS ThE tEsT, yEs It Is... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Does not work
I tried this simple code html body Page refered by ?php echo $HTTP_REFERER.'br'; echo $_SERVER['HTTP_REFERER'].'br'; ? /body /html and I receive blank reply even if referenced from a link from other site. What am i doing wrong ? Or perhaps my server does not have referer enabled? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Does not work
from PHP documentation: http://www.php.net/manual/en/reserved.variables.php 'HTTP_REFERER' The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted. -Original Message- From: Saci [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 14, 2002 2:11 PM To: [EMAIL PROTECTED] Subject: [PHP] Does not work I tried this simple code html body Page refered by ?php echo $HTTP_REFERER.'br'; echo $_SERVER['HTTP_REFERER'].'br'; ? /body /html and I receive blank reply even if referenced from a link from other site. What am i doing wrong ? Or perhaps my server does not have referer enabled? -- 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] Does not work
// HTTP_REFERER as a feature. In short, it cannot really be trusted. Anybody know how to do that using JAva history with PHP together , or any other methode that works and can be trusted. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Does not work
ðÒÉ×ÅÔ! Saci wrote: // HTTP_REFERER as a feature. In short, it cannot really be trusted. Anybody know how to do that using JAva history with PHP together , or any other methode that works and can be trusted. Thank god no method can be trusted :) History even less the the referrer. Just think of the frequency at which people in their offices clear it to avoid bosses seeing where they surfed while they were supposed to work... You'll never get a secure method, and if you do I'll personally report you to the authority for protection of privacy :) Marketing dotcoms would just love to do it, but fortunately it cannot be done :) Relax, you can live without knowing where some of the guys came from. Most won't mind telling you. But I just cleared my history immediately after reading your msg :) Pavlovian reaction ;) ÐÏËÁ áÌØÂÅÒÔÏ ëÉÅ× -_=}{=_-@-_=}{=_--_=}{=_-@-_=}{=_--_=}{=_-@-_=}{=_--_=}{=_- LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu? lOrD i'M sHiNiNg... YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE tHe TeSt, YeS iT iS ThE tEsT, yEs It Is tHe TeSt, YeS iT iS ThE tEsT, yEs It Is... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Does not work
Pffft you can't trust Java, JavaScript or anything on the server side at all. Since it's set by the browser (client) itself, the best you can do is test for it, and provide a fall back option. For the bulk of users, this will be okay, because they're on IE. What you need to be carefull of is what effect your fall back has on the unknown browsers. Or design/program without the need to know what they're using :D Justin French on 15/07/02 5:34 AM, Saci ([EMAIL PROTECTED]) wrote: // HTTP_REFERER as a feature. In short, it cannot really be trusted. Anybody know how to do that using JAva history with PHP together , or any other methode that works and can be trusted. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Does not work
To say the minumum yor reply does not help in nothing. Who cares about privacy on my own company Intranet ? Alberto Serra [EMAIL PROTECTED] escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... ðÒÉ×ÅÔ! Saci wrote: // HTTP_REFERER as a feature. In short, it cannot really be trusted. Anybody know how to do that using JAva history with PHP together , or any other methode that works and can be trusted. Thank god no method can be trusted :) History even less the the referrer. Just think of the frequency at which people in their offices clear it to avoid bosses seeing where they surfed while they were supposed to work... You'll never get a secure method, and if you do I'll personally report you to the authority for protection of privacy :) Marketing dotcoms would just love to do it, but fortunately it cannot be done :) Relax, you can live without knowing where some of the guys came from. Most won't mind telling you. But I just cleared my history immediately after reading your msg :) Pavlovian reaction ;) ÐÏËÁ áÌØÂÅÒÔÏ ëÉÅ× @-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@ LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu? lOrD i'M sHiNiNg... YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE tHe TeSt, YeS iT iS ThE tEsT, yEs It Is tHe TeSt, YeS iT iS ThE tEsT, yEs It Is... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Does not work
-Original Message- From: Saci [mailto:[EMAIL PROTECTED]] Sent: Monday, 15 July 2002 12:51 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Does not work To say the minumum yor reply does not help in nothing. Who cares about privacy on my own company Intranet ? u the bosses.. the employees tring to hide where they been from the bosses... the network admin... the list goes on and on and on and on and on and on and on ...
Re: [PHP] Does not work
I agree, I made a mistake on my last reply , and I apologize for that. Thank you also for you for your coments, but my main question still open without any related reply. To say the minumum yor reply does not help in nothing. Who cares about privacy on my own company Intranet ? 1. I don't believe you specified this was a company intranet, but you may have. 2. Generally it's a good idea to get things right the first time, rather than assuming that something will always remain in it's current state. I tend to copy-and-paste a lot of code from one project to another, or assemble libraries of code. It might be okay for you to say this code works for a limited environment, and i'm happy with that, but will you remember this when: a) you copy it across to another project b) the status of the project changes or is extended c) the project is no longer in your control If you insist on sticking with this limitation, do yourself and your co-workers a favour, and ensure you: a) comment your code well, pointing out the limitation b) do some minimal (at least) error handling to deal with the fact that it may not be there 3. The reply WAS helpful, raised some important issues, and IMHO you should have thanked the poster for being kind enough to point out issues you may not have thought of. You could have easily replied with thanks for those pointers, but I'm less concerned with privacy, since this is a corporate intranet. I'm not sure I'd ever help you again, if I'd received a reply such as yours. Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Does not work
This works for me, PHP 4.1.1 Upon first loading the page, I get nothing, but when I click on go, I get both referrer address' echoed. refer.php: --- html body A HREF=refer.phpgo/aBRBR Page refered by ?php echo $HTTP_REFERER.'br'; echo $_SERVER['HTTP_REFERER'].'br'; ? /body /html --- It's already been said but: 1. are you sure php is working (with other files, and with simple echo hello world!; type stuff)? 2. use this file (phpinfo.php) to test for the existence of HTTP_REFERER: refer.php: --- html body A HREF=refer.phpgo/aBRBR Page refered by ?php echo $HTTP_REFERER.'br'; echo $_SERVER['HTTP_REFERER'].'br'; ? /body /html --- Upon first loading, it will not be set, but when you click go, you have a referer, and it is set. For me, it's listed under the Apache Environment heading. If you still can't get a referrer var after all that, then there's an issue with your server (are you using apache) or perhaps the client (browser). because it *should* be simple. Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP does not work??
I forgot to point out another disadvantage of turning on register_globals apart from that of security is that when you are sending a page with a form to the same page, e.g: form name=whatever action=$PHP_SELF method=post there is a tendency to lose info.. E.g. If you are sending text separated by spaces you only manage to send the first word this can be overcome by using the htmlspecialchars('value') method to evaluate value... turning on globals is to make the coding easier but has a good deal of disadvantages... register_globals on or off is completely irrelevant to using urlencode (GET) or htmlentities (POST) to send properly formatted strings to the browser. If you want to delude yourself the register_globals off significantly increases security, go ahead, but don't claim that it somehow fixes badly-encoded HTML. It doesn't. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP does not work??
Not a problem, I can make some code modification. Sometime it is better to do it now and not have so much headache later on when more features are being added. Scott Kondwani Spike Mkandawire [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I forgot to point out another disadvantage of turning on register_globals apart from that of security is that when you are sending a page with a form to the same page, e.g: form name=whatever action=$PHP_SELF method=post there is a tendency to lose info.. E.g. If you are sending text separated by spaces you only manage to send the first word this can be overcome by using the htmlspecialchars('value') method to evaluate value... turning on globals is to make the coding easier but has a good deal of disadvantages... Spike... Scott Fletcher [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Um, alright, I'll just leave the code in the hyperlink the way it is. It is not possible to use the form or post of some sort for the hyperlink. form will work with the submit button where we can use post or hidden. Hyperlink meant words or sentences that have underline underneath it, when clicked will go to a different webpage. Thanks, Scott Erik Price [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Wednesday, June 26, 2002, at 02:56 PM, Scott Fletcher wrote: I tried that and it worked. I have one question, what about the hyperlink? People will see the option in the hyperlink. You know. Is there a way around it to hid that in the hyperlink? If by hyperlink you mean the URL in the URL bar of their browser, correct -- people will see it. That GET data is part of the URL, sort of. Most browsers will not display POST data to their users (easily) but it's never truly hidden from view. Any data that your users are sending to you, whether it's GET, POST, or COOKIE, is data that they can see. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP does not work??
Not a problem! I can make some adjustment to the $user_detail[''] (session_id()) to make it work as $_SESSION['']. Scott Erik Price [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Wednesday, June 26, 2002, at 02:37 PM, Scott Fletcher wrote: I didn't know that. Thanks for the info. I think it would be best that I not use php.ini. On the contrary, I think it would be best if you read through it and read about it at http://www.php.net/manual/en/configuration.php . Putting it off will only cause you trouble in the long run. I can write the script to register the variable. What would be a demo script that would work? I'm having a little trouble understanding that on the php.net website. Most of the script that use global variables came from hyperlinks. I have no form method like post or get. If it doesn't have post or get, then your data is probably in the $_GET array. But you should always use the method attribute of the form tag. I have one website that use session. Like session_start(), session_register(), etc. How would this be affected and what is the work around to this one. You now refer to a session variable as $_SESSION['variablename']. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP does not work??
I forgot to point out another disadvantage of turning on register_globals apart from that of security is that when you are sending a page with a form to the same page, e.g: form name=whatever action=$PHP_SELF method=post there is a tendency to lose info.. E.g. If you are sending text separated by spaces you only manage to send the first word this can be overcome by using the htmlspecialchars('value') method to evaluate value... turning on globals is to make the coding easier but has a good deal of disadvantages... Spike... Scott Fletcher [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Um, alright, I'll just leave the code in the hyperlink the way it is. It is not possible to use the form or post of some sort for the hyperlink. form will work with the submit button where we can use post or hidden. Hyperlink meant words or sentences that have underline underneath it, when clicked will go to a different webpage. Thanks, Scott Erik Price [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Wednesday, June 26, 2002, at 02:56 PM, Scott Fletcher wrote: I tried that and it worked. I have one question, what about the hyperlink? People will see the option in the hyperlink. You know. Is there a way around it to hid that in the hyperlink? If by hyperlink you mean the URL in the URL bar of their browser, correct -- people will see it. That GET data is part of the URL, sort of. Most browsers will not display POST data to their users (easily) but it's never truly hidden from view. Any data that your users are sending to you, whether it's GET, POST, or COOKIE, is data that they can see. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP does not work??
Hi! I downloaded the newer version of PHP and compiled it. The php is working great! But there is one problem. When I use the hyperlink, test.php?data=yes and I go to this page, test.php but there is no data in this variable, $data. So, the web page I have, most of them are all thrown off becuase of this. I use PHP version 4.2.1. Is there a bug in this PHP version??? Or some changes in PHP that I'm not aware of? Let me know! Thanks, Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP does not work??
On Wednesday, June 26, 2002, at 01:20 PM, Scott Fletcher wrote: When I use the hyperlink, test.php?data=yes and I go to this page, test.php but there is no data in this variable, $data. So, the web page I have, most of them are all thrown off becuase of this. I use PHP version 4.2.1. Is there a bug in this PHP version??? Or some changes in PHP that I'm not aware of? Let me know! Use $_GET['data'], not $data. Or turn register_globals = on in your php.ini. Get to know your php.ini, and read the release notes for any software you upgrade -- this is mentioned in the PHP 4.1.x release notes if you want to read them for yourself. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP does not work??
[snip] When I use the hyperlink, test.php?data=yes and I go to this page, test.php but there is no data in this variable, $data. So, the web page I have, most of them are all thrown off becuase of this. I use PHP version 4.2.1. Is there a bug in this PHP version??? Or some changes in PHP that I'm not aware of? Let me know! [/snip] Did you RTF release notes? Did you search the list archives? Did you check to make sure that register_globals is 'ON'? Accck ;-( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP does not work??
I'm using UNIX, not windows, so there is no php.ini in UNIX. I only use the ./configure command which is -- snip -- ./configure --with-apache=../apache_1.3.26 --with-ibm-db2=/usr/lpp/db2_06_01 --with-openssl=../openssl-0.9.6d --with-mcrypt=../../lib --without-mysql --with-config-file-path=/etc --enable-track-vars --with-curl=../../lib --with-xml --snip-- Then I went on to compile the PHP, then Apache, etc. Since from recent post, there was some talk about register_globals. I'm not familiar with that so I will find out what that is, and what that is use for. If anyone know, can anyone tell me what it does? Thanks. Scott Scott Fletcher [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi! I downloaded the newer version of PHP and compiled it. The php is working great! But there is one problem. When I use the hyperlink, test.php?data=yes and I go to this page, test.php but there is no data in this variable, $data. So, the web page I have, most of them are all thrown off becuase of this. I use PHP version 4.2.1. Is there a bug in this PHP version??? Or some changes in PHP that I'm not aware of? Let me know! Thanks, Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: PHP does not work??
[snip] I'm using UNIX, not windows, so there is no php.ini in UNIX. [/snip] Look here /etc/apache/php.ini-dist or /etc/apache/php.ini. There is an ini file for PHP, and you may have to rename php.ini-dist to php.ini. Once done, look for ; You should do your best to write your scripts so that they do not require ; register_globals to be on; Using form variables as globals can easily lead ; to possible security problems, if the code is not very well thought of. register_globals = Off Setting Off to On will let your scripts continue to work, once you have restarted your server of course. You really should, due to security considerations leave this set of Off and reconfigure your variables as stated in other e-mails. Since this will probably take some time you can leave register_globals on until you're finished with that project. HTH! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP does not work??
On Wednesday, June 26, 2002, at 02:13 PM, Scott Fletcher wrote: I'm using UNIX, not windows, so there is no php.ini in UNIX. Sorry, don't take offense if I ask if you've been living under a rock -- I only use Linux, and there is definitely a php.ini file that you use. I put mine in /usr/local/lib/ . If you follow the source install instructions, you will see that the last step is: $ cp php.ini-dist /usr/local/lib/php.ini Yep, that means you're supposed to copy php.ini-dist to a dir on your server. This is your configuration file, where register_globals and a million other configuration directives are decided... ? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP does not work??
I didn't know that. Thanks for the info. I think it would be best that I not use php.ini. I can write the script to register the variable. What would be a demo script that would work? I'm having a little trouble understanding that on the php.net website. Most of the script that use global variables came from hyperlinks. I have no form method like post or get. I have one website that use session. Like session_start(), session_register(), etc. How would this be affected and what is the work around to this one. Thanks, Scott Jay Blanchard [EMAIL PROTECTED] wrote in message 002901c21d3e$0bba45d0$8102a8c0@niigziuo4ohhdt">news:002901c21d3e$0bba45d0$8102a8c0@niigziuo4ohhdt... [snip] I'm using UNIX, not windows, so there is no php.ini in UNIX. [/snip] Look here /etc/apache/php.ini-dist or /etc/apache/php.ini. There is an ini file for PHP, and you may have to rename php.ini-dist to php.ini. Once done, look for ; You should do your best to write your scripts so that they do not require ; register_globals to be on; Using form variables as globals can easily lead ; to possible security problems, if the code is not very well thought of. register_globals = Off Setting Off to On will let your scripts continue to work, once you have restarted your server of course. You really should, due to security considerations leave this set of Off and reconfigure your variables as stated in other e-mails. Since this will probably take some time you can leave register_globals on until you're finished with that project. HTH! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP does not work??
Hi Erik! This is my 2nd posting, not sure what happened to my first one. Sorry about not seeing your previous posting before. Windows crashed on me. My fault. I didn't know we can use php.ini in UNIX or Linux. Cool! Haven't been using it on UNIX for a long time. I think I can leave it out for now and make some changes to the scripts instead. When I saw the php.ini on Windows, I couldn't believe of so many configuration. So, I think it will be helpful to make some changes to teh website and keep it simple for someone who will take my place as webmaster. Saw your comments about _GET['data']. I tried that and it worked. I have one question, what about the hyperlink? People will see the option in the hyperlink. You know. Is there a way around it to hid that in the hyperlink? Just curious. Thanks, Scott Erik Price [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Wednesday, June 26, 2002, at 02:13 PM, Scott Fletcher wrote: I'm using UNIX, not windows, so there is no php.ini in UNIX. Sorry, don't take offense if I ask if you've been living under a rock -- I only use Linux, and there is definitely a php.ini file that you use. I put mine in /usr/local/lib/ . If you follow the source install instructions, you will see that the last step is: $ cp php.ini-dist /usr/local/lib/php.ini Yep, that means you're supposed to copy php.ini-dist to a dir on your server. This is your configuration file, where register_globals and a million other configuration directives are decided... ? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP does not work??
There is no feasable way to hide data being submitted to your website. Anything that a user's browser can send, the user can telnet to port 80 of your server and spoof. You can try POSTing data, which will not appear in the URL, but dont even waste time trying to hide submitted data, rather, build a stronger backend. -- Scott Hurring Systems Programmer EAC Corporation scott (*) eac.com -- Scott Fletcher [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi Erik! This is my 2nd posting, not sure what happened to my first one. Sorry about not seeing your previous posting before. Windows crashed on me. My fault. I didn't know we can use php.ini in UNIX or Linux. Cool! Haven't been using it on UNIX for a long time. I think I can leave it out for now and make some changes to the scripts instead. When I saw the php.ini on Windows, I couldn't believe of so many configuration. So, I think it will be helpful to make some changes to teh website and keep it simple for someone who will take my place as webmaster. Saw your comments about _GET['data']. I tried that and it worked. I have one question, what about the hyperlink? People will see the option in the hyperlink. You know. Is there a way around it to hid that in the hyperlink? Just curious. Thanks, Scott Erik Price [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Wednesday, June 26, 2002, at 02:13 PM, Scott Fletcher wrote: I'm using UNIX, not windows, so there is no php.ini in UNIX. Sorry, don't take offense if I ask if you've been living under a rock -- I only use Linux, and there is definitely a php.ini file that you use. I put mine in /usr/local/lib/ . If you follow the source install instructions, you will see that the last step is: $ cp php.ini-dist /usr/local/lib/php.ini Yep, that means you're supposed to copy php.ini-dist to a dir on your server. This is your configuration file, where register_globals and a million other configuration directives are decided... ? Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP does not work??
On Wednesday, June 26, 2002, at 02:56 PM, Scott Fletcher wrote: I tried that and it worked. I have one question, what about the hyperlink? People will see the option in the hyperlink. You know. Is there a way around it to hid that in the hyperlink? If by hyperlink you mean the URL in the URL bar of their browser, correct -- people will see it. That GET data is part of the URL, sort of. Most browsers will not display POST data to their users (easily) but it's never truly hidden from view. Any data that your users are sending to you, whether it's GET, POST, or COOKIE, is data that they can see. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP does not work??
On Wednesday, June 26, 2002, at 02:37 PM, Scott Fletcher wrote: I didn't know that. Thanks for the info. I think it would be best that I not use php.ini. On the contrary, I think it would be best if you read through it and read about it at http://www.php.net/manual/en/configuration.php . Putting it off will only cause you trouble in the long run. I can write the script to register the variable. What would be a demo script that would work? I'm having a little trouble understanding that on the php.net website. Most of the script that use global variables came from hyperlinks. I have no form method like post or get. If it doesn't have post or get, then your data is probably in the $_GET array. But you should always use the method attribute of the form tag. I have one website that use session. Like session_start(), session_register(), etc. How would this be affected and what is the work around to this one. You now refer to a session variable as $_SESSION['variablename']. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP does not work??
Um, alright, I'll just leave the code in the hyperlink the way it is. It is not possible to use the form or post of some sort for the hyperlink. form will work with the submit button where we can use post or hidden. Hyperlink meant words or sentences that have underline underneath it, when clicked will go to a different webpage. Thanks, Scott Erik Price [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Wednesday, June 26, 2002, at 02:56 PM, Scott Fletcher wrote: I tried that and it worked. I have one question, what about the hyperlink? People will see the option in the hyperlink. You know. Is there a way around it to hid that in the hyperlink? If by hyperlink you mean the URL in the URL bar of their browser, correct -- people will see it. That GET data is part of the URL, sort of. Most browsers will not display POST data to their users (easily) but it's never truly hidden from view. Any data that your users are sending to you, whether it's GET, POST, or COOKIE, is data that they can see. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Does $_SESSION work in any release?
Running Apache,linux,php4.1.2 and I can't get $_SESSION to work, creates the temp file but doesn't actually put anything in it. There appears to be a bug report saying it is broke but does anyone know what version (if any) $_SESSION actually works in? I'm trying 4.1.1 also and its doing the same thing. I am running the the code from the manual's session page: session_start(); if (!isset($_SESSION['count'])) { $_SESSION['count'] = 0; } else { $_SESSION['count']++; } print(SESSION : .$_SESSION['count']); and only get 0. Thanks. patrick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Does $_SESSION work in any release?
I am doing a session_start and am definately not using session_register (minus ? and ?, the exact code is in my original email). phpinfo reports register_globals is off. Is there something else in the php.ini file I need to turn on to 'enable' $_SESSION? I tried using the php.ini-recommended and it didn't work either. Any other ideas? On Sat, Apr 13, 2002 at 11:42:49AM -0600, Jason Sheets wrote: $_SESSION has worked for me on Unix since it was introduced. Make sure your PHP is properly configured. session_start() must be called before you can use $_SESSION. I've heard that if you use $_SESSION you may not use session_register. The reports I've seen are reporting it is broken on Windows, however it appears to be fixed on Windows in 4.2 RC2. Jason - Original Message - From: Patrick Aland [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, April 13, 2002 11:22 AM Subject: [PHP] Does $_SESSION work in any release? Running Apache,linux,php4.1.2 and I can't get $_SESSION to work, creates the temp file but doesn't actually put anything in it. There appears to be a bug report saying it is broke but does anyone know what version (if any) $_SESSION actually works in? I'm trying 4.1.1 also and its doing the same thing. I am running the the code from the manual's session page: session_start(); if (!isset($_SESSION['count'])) { $_SESSION['count'] = 0; } else { $_SESSION['count']++; } print(SESSION : .$_SESSION['count']); and only get 0. Thanks. patrick -- 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] does this work?
It seems that I have a parse error somewhere in the following code (since that's the only code in my script, it's a test script): // arraytest.php $tempsql = SELECT COUNT(*) AS count FROM divisions; $tempresult = mysql_query($tempsql, $db); $temprow = mysql_fetch_array($tempresult); echo $temprow[count]; Yet, it works fine in the mysql client. Thus, I am led to believe that PHP is not capable of constructing the same kinds of SQL statements that can be constructed in the mysql client. Is this the case? Erik PS: what I am -really- trying to do is dynamically fill in a select listbox with options that correspond to all of the records in a given table. Like so: form select ?php foreach ($record_id_and_record_name_pair_pulled_from_mysql_query) { print(option value=\${record_id}\${record_name}/option); } ? /select /form but I am unsure of how to grab multiple values from the mysql_query() and load them into an array. Has anyone done this before? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] does this work?
Hmm I believe that the mysql_query() function requires quotes around the query statement even it it is being passed as a variable.. mysql_query($tempsql, $db); -Kevin It seems that I have a parse error somewhere in the following code (since that's the only code in my script, it's a test script): // arraytest.php $tempsql = SELECT COUNT(*) AS count FROM divisions; $tempresult = mysql_query($tempsql, $db); $temprow = mysql_fetch_array($tempresult); echo $temprow[count]; Yet, it works fine in the mysql client. Thus, I am led to believe that PHP is not capable of constructing the same kinds of SQL statements that can be constructed in the mysql client. Is this the case? Erik PS: what I am -really- trying to do is dynamically fill in a select listbox with options that correspond to all of the records in a given table. Like so: form select ?php foreach ($record_id_and_record_name_pair_pulled_from_mysql_query) { print(option value=\${record_id}\${record_name}/option); } ? /select /form but I am unsure of how to grab multiple values from the mysql_query() and load them into an array. Has anyone done this before? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] does this work?
what eact parse error you are getting ? and what is that line ? Is it giving an error like undefined variable $temprow[count]; or some thing like that ? You may try to change the mysql_fetch_row line to the following $temprow = mysql_fetch_array($tempresult, MYSQL_ASSOC); - Original Message - From: Erik Price [EMAIL PROTECTED] To: PHP (E-mail) [EMAIL PROTECTED] Sent: Thursday, January 10, 2002 4:28 PM Subject: [PHP] does this work? It seems that I have a parse error somewhere in the following code (since that's the only code in my script, it's a test script): // arraytest.php $tempsql = SELECT COUNT(*) AS count FROM divisions; $tempresult = mysql_query($tempsql, $db); $temprow = mysql_fetch_array($tempresult); echo $temprow[count]; Yet, it works fine in the mysql client. Thus, I am led to believe that PHP is not capable of constructing the same kinds of SQL statements that can be constructed in the mysql client. Is this the case? Erik PS: what I am -really- trying to do is dynamically fill in a select listbox with options that correspond to all of the records in a given table. Like so: form select ?php foreach ($record_id_and_record_name_pair_pulled_from_mysql_query) { print(option value=\${record_id}\${record_name}/option); } ? /select /form but I am unsure of how to grab multiple values from the mysql_query() and load them into an array. Has anyone done this before? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] does this work?
I tried that... I get the same error (same line and everything). As a side note, I haven't ever had to quote the first argument in mysql_query() before... This is quite a conundrum, eh? Erik On Friday, January 11, 2002, at 04:25 AM, Kevin Stone wrote: Hmm I believe that the mysql_query() function requires quotes around the query statement even it it is being passed as a variable.. mysql_query($tempsql, $db); -Kevin It seems that I have a parse error somewhere in the following code (since that's the only code in my script, it's a test script): // arraytest.php $tempsql = SELECT COUNT(*) AS count FROM divisions; $tempresult = mysql_query($tempsql, $db); $temprow = mysql_fetch_array($tempresult); echo $temprow[count]; Yet, it works fine in the mysql client. Thus, I am led to believe that PHP is not capable of constructing the same kinds of SQL statements that can be constructed in the mysql client. Is this the case? Erik PS: what I am -really- trying to do is dynamically fill in a select listbox with options that correspond to all of the records in a given table. Like so: form select ?php foreach ($record_id_and_record_name_pair_pulled_from_mysql_query) { print(option value=\${record_id}\${record_name}/option); } ? /select /form but I am unsure of how to grab multiple values from the mysql_query() and load them into an array. Has anyone done this before? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: php-list- [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] does this work?
Show all your code. Did you open a connection to the MYSQL server? If so, show the code. -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 10, 2002 3:29 PM To: PHP Subject: [PHP] does this work? It seems that I have a parse error somewhere in the following code (since that's the only code in my script, it's a test script): // arraytest.php $tempsql = SELECT COUNT(*) AS count FROM divisions; $tempresult = mysql_query($tempsql, $db); $temprow = mysql_fetch_array($tempresult); echo $temprow[count]; Yet, it works fine in the mysql client. Thus, I am led to believe that PHP is not capable of constructing the same kinds of SQL statements that can be constructed in the mysql client. Is this the case? Erik PS: what I am -really- trying to do is dynamically fill in a select listbox with options that correspond to all of the records in a given table. Like so: form select ?php foreach ($record_id_and_record_name_pair_pulled_from_mysql_query) { print(option value=\${record_id}\${record_name}/option); } ? /select /form but I am unsure of how to grab multiple values from the mysql_query() and load them into an array. Has anyone done this before? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] does this work?
Show all your code. Did you open a connection to the MYSQL server? If so, show the code. What is the exact error that you get? -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 10, 2002 3:29 PM To: PHP Subject: [PHP] does this work? It seems that I have a parse error somewhere in the following code (since that's the only code in my script, it's a test script): // arraytest.php $tempsql = SELECT COUNT(*) AS count FROM divisions; $tempresult = mysql_query($tempsql, $db); $temprow = mysql_fetch_array($tempresult); echo $temprow[count]; Yet, it works fine in the mysql client. Thus, I am led to believe that PHP is not capable of constructing the same kinds of SQL statements that can be constructed in the mysql client. Is this the case? Erik PS: what I am -really- trying to do is dynamically fill in a select listbox with options that correspond to all of the records in a given table. Like so: form select ?php foreach ($record_id_and_record_name_pair_pulled_from_mysql_query) { print(option value=\${record_id}\${record_name}/option); } ? /select /form but I am unsure of how to grab multiple values from the mysql_query() and load them into an array. Has anyone done this before? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] does this work?
quotes are not needed -Original Message- From: Kevin Stone [mailto:[EMAIL PROTECTED]] Sent: Friday, January 11, 2002 3:26 AM To: Erik Price; PHP (E-mail) Subject: Re: [PHP] does this work? Hmm I believe that the mysql_query() function requires quotes around the query statement even it it is being passed as a variable.. mysql_query($tempsql, $db); -Kevin It seems that I have a parse error somewhere in the following code (since that's the only code in my script, it's a test script): // arraytest.php $tempsql = SELECT COUNT(*) AS count FROM divisions; $tempresult = mysql_query($tempsql, $db); $temprow = mysql_fetch_array($tempresult); echo $temprow[count]; Yet, it works fine in the mysql client. Thus, I am led to believe that PHP is not capable of constructing the same kinds of SQL statements that can be constructed in the mysql client. Is this the case? Erik PS: what I am -really- trying to do is dynamically fill in a select listbox with options that correspond to all of the records in a given table. Like so: form select ?php foreach ($record_id_and_record_name_pair_pulled_from_mysql_query) { print(option value=\${record_id}\${record_name}/option); } ? /select /form but I am unsure of how to grab multiple values from the mysql_query() and load them into an array. Has anyone done this before? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] does this work?
On Thursday, January 10, 2002, at 04:39 PM, Rick Emery wrote: Show all your code. Did you open a connection to the MYSQL server? If so, show the code. Okay, but I changed some personal info (that I know is definitely correct): ?php // arraytest.php $db = mysql_connect(hostname, username, password); mysql_select_db(database_name, $db); ? html head titleArray Test/title /head body $tempsql = SELECT COUNT(*) AS count FROM divisions; $tempresult = mysql_query($tempsql, $db); $temprow = mysql_fetch_array($tempresult); echo $temprow[count]; mysql_close($db); ? /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] does this work?
Wait, my bad. Typo... all my fault. I feel like an ass. Erik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] does this work?
you have a ?PHP tag missing between body and $tempsql. did you remove this for the purose of this posting or is this what's causing the problem?? Rick Emery [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Show all your code. Did you open a connection to the MYSQL server? If so, show the code. -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 10, 2002 3:29 PM To: PHP Subject: [PHP] does this work? It seems that I have a parse error somewhere in the following code (since that's the only code in my script, it's a test script): // arraytest.php $tempsql = SELECT COUNT(*) AS count FROM divisions; $tempresult = mysql_query($tempsql, $db); $temprow = mysql_fetch_array($tempresult); echo $temprow[count]; Yet, it works fine in the mysql client. Thus, I am led to believe that PHP is not capable of constructing the same kinds of SQL statements that can be constructed in the mysql client. Is this the case? Erik PS: what I am -really- trying to do is dynamically fill in a select listbox with options that correspond to all of the records in a given table. Like so: form select ?php foreach ($record_id_and_record_name_pair_pulled_from_mysql_query) { print(option value=\${record_id}\${record_name}/option); } ? /select /form but I am unsure of how to grab multiple values from the mysql_query() and load them into an array. Has anyone done this before? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] does this work?
is this valid in PHP?? (haven't tried it myself yet...) $tempsql = SELECT COUNT(*) AS count FROM divisions; maybe it needs to be on one line??? -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Friday, January 11, 2002 8:39 AM To: 'Erik Price'; PHP Subject: RE: [PHP] does this work? Show all your code. Did you open a connection to the MYSQL server? If so, show the code. -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 10, 2002 3:29 PM To: PHP Subject: [PHP] does this work? It seems that I have a parse error somewhere in the following code (since that's the only code in my script, it's a test script): // arraytest.php $tempsql = SELECT COUNT(*) AS count FROM divisions; $tempresult = mysql_query($tempsql, $db); $temprow = mysql_fetch_array($tempresult); echo $temprow[count]; Yet, it works fine in the mysql client. Thus, I am led to believe that PHP is not capable of constructing the same kinds of SQL statements that can be constructed in the mysql client. Is this the case? Erik PS: what I am -really- trying to do is dynamically fill in a select listbox with options that correspond to all of the records in a given table. Like so: form select ?php foreach ($record_id_and_record_name_pair_pulled_from_mysql_query) { print(option value=\${record_id}\${record_name}/option); } ? /select /form but I am unsure of how to grab multiple values from the mysql_query() and load them into an array. Has anyone done this before? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] does this work?
But as I was writing before, what I'm really trying to do with this isn't just echo the COUNT of records in a table. What do I need to separate the array $temprow into pieces so that I can get at the data: $tempsql = SELECT divisions.div_name, divisions.div_id FROM divisions; $tempresult = mysql_query($tempsql, $db); $temprow = mysql_fetch_array($tempresult); I wonder if I'm being too ambiguous in describing this. $temprow now contains the information extracted from $tempresult by mysql_fetch_array(), right? And $tempresult was the result of the SELECT query I posted above. So, how can I separate the information in $temprow into useable chunks or variables. I'm reading about explode(), but it isn't clear to me how I can use this in this instance. I would like to loop through the array $temprow and echo each record's contents (divisions.div_name and divisions.div_id) on each step. This is to populate a select box (listbox). Any advice, anybody? Thank you, Erik On Thursday, January 10, 2002, at 05:00 PM, Erik Price wrote: Wait, my bad. Typo... all my fault. I feel like an ass. Erik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] does this work?
I think it will really help if you post more of your code. It is obvious that the parse error is not contained within the lines of code that you pasted :) I think more of your code will reveal the answer rather quickly :) HTH Sam Masiello Software Quality Assurance Engineer Synacor (716) 853-1362 X289 [EMAIL PROTECTED] - Original Message - From: Erik Price [EMAIL PROTECTED] To: Kevin Stone [EMAIL PROTECTED] Cc: PHP (E-mail) [EMAIL PROTECTED] Sent: Thursday, January 10, 2002 4:43 PM Subject: Re: [PHP] does this work? I tried that... I get the same error (same line and everything). As a side note, I haven't ever had to quote the first argument in mysql_query() before... This is quite a conundrum, eh? Erik On Friday, January 11, 2002, at 04:25 AM, Kevin Stone wrote: Hmm I believe that the mysql_query() function requires quotes around the query statement even it it is being passed as a variable.. mysql_query($tempsql, $db); -Kevin It seems that I have a parse error somewhere in the following code (since that's the only code in my script, it's a test script): // arraytest.php $tempsql = SELECT COUNT(*) AS count FROM divisions; $tempresult = mysql_query($tempsql, $db); $temprow = mysql_fetch_array($tempresult); echo $temprow[count]; Yet, it works fine in the mysql client. Thus, I am led to believe that PHP is not capable of constructing the same kinds of SQL statements that can be constructed in the mysql client. Is this the case? Erik PS: what I am -really- trying to do is dynamically fill in a select listbox with options that correspond to all of the records in a given table. Like so: form select ?php foreach ($record_id_and_record_name_pair_pulled_from_mysql_query) { print(option value=\${record_id}\${record_name}/option); } ? /select /form but I am unsure of how to grab multiple values from the mysql_query() and load them into an array. Has anyone done this before? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: php-list- [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] does this work?
On Thursday, January 10, 2002, at 05:16 PM, Martin Towell wrote: is this valid in PHP?? (haven't tried it myself yet...) $tempsql = SELECT COUNT(*) AS count FROM divisions; maybe it needs to be on one line??? It turns out that my problem was a typo. I apologize for wasting everyone's time with that, I thought that I had checked thoroughly. To answer your question, the extra whitespace (the newline between count and FROM) doesn't matter here because structured query language doesn't recognize whitespace. Technically, that newline is in the SQL, not the PHP code itself. -- Erik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Fwd: RE: [PHP] does this work?
and it would be like using the statement $a = $a; very very useless! bvr. On Thu, 10 Jan 2002 15:39:27 -0600, Rick Emery wrote: quotes are not needed mysql_query($tempsql, $db); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] does this work?
At 4:28 PM -0500 1/10/02, Erik Price wrote: PS: what I am -really- trying to do is dynamically fill in a select listbox with options that correspond to all of the records in a given table. Like so: form select ?php foreach ($record_id_and_record_name_pair_pulled_from_mysql_query) { print(option value=\${record_id}\${record_name}/option); } ? /select /form but I am unsure of how to grab multiple values from the mysql_query() and load them into an array. Has anyone done this before? I've just recently done something very similar. The code is below. It looks a bit different because I like to include very little HTML in my PHP. But otherwise the concept should be the same. I should mention, that my code actually produces two pull down menu. My ultimate goal was to add a javascript to the sequence, so that when a user selects the item in the first pull down, it resubmits the query for the second pull down, and allows for pull down two to be dependent on pull down one. I haven't worked on the javascript as of yet. .. $staffID=$id; $results=mysql_query ( SELECT staff.staffID, teamMembers.accountID, accounts.clientID, clients.orgID, orgs.name AS client, accounts.description AS account FROMstaff, clients, orgs, accounts LEFT JOIN teamMembers ON teamMembers.accountID=accounts.accountID WHERE teamMembers.staffID=\$staffID\ AND teamMembers.accountID=accounts.accountID GROUP BYaccounts.description ORDER BYorgs.name) or die(I've failed! Woe is ME!); while ($row=mysql_fetch_array($results)){ $staffID= $row[staffID]; $accountID = $row[accountID]; $clientID = $row[clientID]; $orgID = $row[orgID]; $client = $row[client]; $account= $row[account]; // After the array is created, a small if elseif script is used to create the select menu. // Ideally the to menus will be separate scripts, I just want to test the theory first if($clientID != ){ $selectClient .= option value=\$clientID\ selected=\$client\$client/option\n; } else { $selectClient .= select id=\clientID\ name=\client\ option value=\\ selected=\ \nbsp;/option\n; } // Pull down list2, this displays the accounts pull down. if($accountID != ){ $selectAccount .= option value=\$accountID\ selected=\$account\$account/option\n; } else { $selectClient .= select id=\accountID\ name=\account\ option value=\\ selected=\ \nbsp;/option\n; } } ? !-- This Script is a Modification of Code Created By Joe Chellman to auto create pull down menus from enum (value lists). I've adjusted it to just pull field data -- pselect id=clientID name=client option value= selected= nbsp;/option ? echo$selectClient\n; ? /select/p p/p pselect id=accountID name=account option value= selected= nbsp;/option ? echo$selectAccount\n; ? /select/p ... -- . Alnisa Allgood Executive Director Nonprofit Tech (ph) 415.337.7412 (fx) 415.337.7927 (url) http://www.nonprofit-techworld.org (url) http://www.nonprofit-tech.org (url) http://www.tech-library.org . Nonprofit Tech E-Update mailto:[EMAIL PROTECTED] . transforming nonprofits through technology . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] does this work?
Erik, Two suggestions: 1 check out mysql_fetch_assoc(), and 2 make use of AS to 'set' the variable names (carried through from MySQL to PHP). Regards, =dn - Original Message - From: Erik Price [EMAIL PROTECTED] To: Rick Emery [EMAIL PROTECTED]; PHP [EMAIL PROTECTED] Sent: 10 January 2002 22:15 Subject: Re: [PHP] does this work? But as I was writing before, what I'm really trying to do with this isn't just echo the COUNT of records in a table. What do I need to separate the array $temprow into pieces so that I can get at the data: $tempsql = SELECT divisions.div_name, divisions.div_id FROM divisions; $tempresult = mysql_query($tempsql, $db); $temprow = mysql_fetch_array($tempresult); I wonder if I'm being too ambiguous in describing this. $temprow now contains the information extracted from $tempresult by mysql_fetch_array(), right? And $tempresult was the result of the SELECT query I posted above. So, how can I separate the information in $temprow into useable chunks or variables. I'm reading about explode(), but it isn't clear to me how I can use this in this instance. I would like to loop through the array $temprow and echo each record's contents (divisions.div_name and divisions.div_id) on each step. This is to populate a select box (listbox). Any advice, anybody? Thank you, Erik On Thursday, January 10, 2002, at 05:00 PM, Erik Price wrote: Wait, my bad. Typo... all my fault. I feel like an ass. Erik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] does this work?
Yes, the semi-colon is the command separator. Try it and echo $tempsql. Miles Thompson At 09:16 AM 1/11/2002 +1100, Martin Towell wrote: is this valid in PHP?? (haven't tried it myself yet...) $tempsql = SELECT COUNT(*) AS count FROM divisions; maybe it needs to be on one line??? -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Friday, January 11, 2002 8:39 AM To: 'Erik Price'; PHP Subject: RE: [PHP] does this work? Show all your code. Did you open a connection to the MYSQL server? If so, show the code. -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 10, 2002 3:29 PM To: PHP Subject: [PHP] does this work? It seems that I have a parse error somewhere in the following code (since that's the only code in my script, it's a test script): // arraytest.php $tempsql = SELECT COUNT(*) AS count FROM divisions; $tempresult = mysql_query($tempsql, $db); $temprow = mysql_fetch_array($tempresult); echo $temprow[count]; Yet, it works fine in the mysql client. Thus, I am led to believe that PHP is not capable of constructing the same kinds of SQL statements that can be constructed in the mysql client. Is this the case? Erik PS: what I am -really- trying to do is dynamically fill in a select listbox with options that correspond to all of the records in a given table. Like so: form select ?php foreach ($record_id_and_record_name_pair_pulled_from_mysql_query) { print(option value=\${record_id}\${record_name}/option); } ? /select /form but I am unsure of how to grab multiple values from the mysql_query() and load them into an array. Has anyone done this before? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Does PHP work with Sybase ASA?
Perhaps people expected you to check the docs or the code yourself. If you go to php.net/sybase you will find the functions you need. If you read the user comments on that page you will even find urls to tutorials/faqs on how to install and configure things for PHP to talk to Sybase ASA. eg. http://www.finebyte.com/docs/sybase/ASA-PHP-Linux.html http://help.webmedia.com.au/Linux-Apache-PHP-Sybase-HOWTO.txt -Rasmus On Fri, 7 Sep 2001, Davor Pleskina wrote: 2nd time, seem that last time nobody saw my question... I mean, is there in PHP support for Sybase Adaptive Server Anywhere, any version, like for MySQL and some other databases? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Does PHP work with Sybase ASA?
I suppose You have ASA 6.0 or later version installed on Your machine with Linux. If it is true, then You can install Open Client for ASE 11.0.3 (it is free) and You can communicate via Open Client to ASA. It works only with ASA 6.0 and higher. Then You need to compile PHP with Sybase Open Client. You have to look into guides how to do it on PHP side and Sybase side. I'm not expert about compiling PHP but it only one config file to bulid PHP, there should be section about Sybase Open Client interface, default this is commented. It is not very dificult. If You will have problem You can ask me I will try to help You. We (not only me) had recompiled PHP 3.0/4.0 with Open Client for ASA 11.0.3/11.9.2 (all the combinations). Krzysztof Kocjan Davor Pleskina wrote: I mean, is there in PHP support for Sybase Adaptive Server Anywhere, any version, like for MySQL and some other databases? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] --- KONKURS: Niedobre miejsca - 50 ksiazek W. Whartona do wygrania! http://szkola.interia.pl/wharton/strona.html?co=13 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Does PHP work with Sybase ASA?
2nd time, seem that last time nobody saw my question... I mean, is there in PHP support for Sybase Adaptive Server Anywhere, any version, like for MySQL and some other databases? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Does PHP work with Sybase ASA?
I mean, is there in PHP support for Sybase Adaptive Server Anywhere, any version, like for MySQL and some other databases? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Does anyone work with phpXML library from www.phpxml.org?
Hello all, If anyone works with phpXML library please explain me why add_node method doesn't work for me? It returns the full path for the new added node but there is no new node in the resulting XML!? For example: - $xml = new XML(some.xml); // some.xml is just root/ $nn = $xml-add_node(root, node); // $nn returns root/node[1] // output echo pre; echo $xml-get_file(); // this one shows original root/ WITHOUT the new node echo /pre; - Thank you, Serge. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Does $PHP_SELF work in templates?
Lets take the most simple of scripts and run it on a standalone page to prove it's working correctly before we import into a template file. http://www.yorkshire-search.co.uk/links/add_form.php4 Next step, lets change the tags ?php ? to php/php because that's what it says in the manual and put it into the add_form.html template and see if it runs now. http://www.yorkshire-search.co.uk/links/add.php3 Oh dear boys and girls, it doesn't work and poor old Phil is starting to cry. I know, let's play a game and see if we can cheer him up by finding out why the below code doesn't work and of course, you can play along at home too. php { $MetaTags = get_meta_tags($getmetafrompage/,1); { $description = $MetaTags[description]; } print FORM ACTION=\$PHP_SELF\ METHOD=post; print If your page already has META tags you may import and edit them.BR; print BURL:/B INPUT TYPE=text NAME=getmetafrompage SIZE=30 VALUE=\http://\;BR; print INPUT TYPE=submit VALUE=\Import META tags from page\/FORMHR; echo font face=\Arial\ size=\2\ color=\Red\%error_msg%/font; echo form action=\add.php3\ method=post; echo input type=hidden name=pflag value=add; echo textarea name=\description\ cols=\40\ rows=\10\ maxlength=\255\ wrap=\virtual\; echo $description; echo /textareap; echo input type=submit name=submit value=\Add\ class=\button\; echo /form; } /php This is my attempt at humour if anyone was wondering !! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]