php-general Digest 11 Aug 2002 21:04:41 -0000 Issue 1519
Topics (messages 112001 through 112049): need help 112001 by: Reymond 112017 by: B.C. Lance 112018 by: Matt 112021 by: B.C. Lance 112022 by: Matt Advice 112002 by: Steve Jackson 112003 by: Justin French IP and Language 112004 by: Christian Ista 112013 by: Peter passing an array in a link 112005 by: David T-G 112006 by: Bas Jobsen 112007 by: David T-G 112019 by: B.C. Lance 112020 by: B.C. Lance problem solving 112008 by: Justin French Re: cgi error 112009 by: JJ Harrison script parsing in img src tag 112010 by: Sascha Braun subtracting 2 time strings 112011 by: Christopher Molnar 112015 by: Matt 112033 by: Christopher Molnar Posting news via php 112012 by: Andy Re: passing an array in a form element 112014 by: David T-G Re: records in db 112016 by: Chris Kay Good Damn 112023 by: Sascha Braun 112025 by: Bas Jobsen 112026 by: Matt 112037 by: B.C. Lance Problem with $PHP_SELF on PWS 112024 by: John Brooks 112027 by: Bas Jobsen 112029 by: Matt Problem with echo 112028 by: Kristoffer Strom 112030 by: Bas Jobsen 112031 by: Matt 112032 by: Kristoffer Strom Re: Pictures and sound in MySQL and access via PHP 112034 by: Rodolfo Gonzalez why true? 112035 by: Bas Jobsen 112036 by: Rasmus Lerdorf Re: Cookie array 112038 by: B.C. Lance 112045 by: Jan - CWIZO Re: Newbie question about UNIX command-line directives 112039 by: Al 112040 by: Al 112042 by: Rasmus Lerdorf 112043 by: Analysis & Solutions Best way to read file 112041 by: César Aracena Re: Win PHP Editor... 112044 by: Saci Re: [PHP-INST] RedHat 7.3 apache is running but where is PHP support 112046 by: php . banana 112047 by: Jan - CWIZO creating files in OS X 112048 by: David Rice imlib2 problems 112049 by: Gareth Ardron 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 am newbie in php scripting, I am used to using asp scripting I get the result of my page but with no error message But Operator like * , + , or / the result is not valid result Variable $rat on my page it’s not work ………. My database sample _______________________________ Id gid kabupaten etc.. ----------------------------------------------------- 1 0 x x 2 1 x x 3 0 etc 4 1 5 2 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <?php require('pagedresults.php'); $user="root"; $host="localhost"; $password=""; $db="test"; $cnx = @mysql_connect($host,$user,$password); if(!$cnx) echo "ndak nyambung"; $jadi=mysql_select_db($db,$cnx); $sqlcombo = "select distinct material from distribusi"; $hasil = mysql_query($sqlcombo); $x=1; $rs = new MySQLPagedResultSet("Select * from distribusi where material like '%$cari%' or kabupaten like '%$cari%' or jumlahpend like '%$cari%' or produksi like '%$cari%' or kebutuhan like '%$cari%' order by kabupaten",8,$cnx); ?> <html> <head> <title> </title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#2A508F"> <center> <?php while ($row = $rs->fetchArray()): if($row['gid']=0) { $rat = 110; // from this operator displayed with not valid result } elseif($row['gid']=1) { $rat = 9.5; // from this operator displayed with not valid result } else { $rat = 6.6; // from this operator displayed with not valid result } ?> <tr bgcolor=white> <td align=center bgcolor=white><a href="confdelete.php?id=<?=$row['id']?>"><img src="images/del_topic.gif" border="0" alt="Delete This Field"></a></td> <td align=center bgcolor=white><a href="edit-distribusi.php?id=<?=$row['id']?>"><img src="images/edit.gif" border="0" alt="Edit This Field"></a></td> <td align=center bgcolor=white><font color=black face=verdana size=1px><?=$x++?></font></td> <td align=center bgcolor=white><font color=black face=verdana size=1px><?= $row['material']?></font></td> <td bgcolor=white><font color=black face=verdana size=1px><?=$row['kabupaten']?></font></td> <td bgcolor=white><font color=black face=verdana size=1px><?=$row['jumlahpend']?></font></td> <td bgcolor=white><font color=black face=verdana size=1px><?=$row['produksi']?></font></td> <td bgcolor=white><font color=black face=verdana size=1px><?=$kebutuhannye =((($row['jumlahpend'])* $rat ) / 1000 );?></font></td> <----- here I print , I get an error value <td bgcolor=white><font color=black face=verdana size=1px><?=$rationye = ($row['produksi']/$kebutuhannye)?></font></td> </tr> <?php endwhile; ?> <tr bgcolor=white> <td colspan=9 align=right bgcolor=white><a href="add-data.php"><img src="images/add.gif" border="0" alt="Add Data"></a></td> </tr> </table> <p> <font color=white face=verdana size="1"><?=$rs->getPageNav("id=$id")?></font></p> <div align="left"> </div> </center> </body> </html>--- End Message ---
--- Begin Message ---to do a comparison between two values / variables, you have to use == instead of = = is an assignment while == is a comparison operator if($row['gid'] == 0) { $rat = 110; } elseif($row['gid'] == 1) { $rat = 9.5; } else { $rat = 6.6; }--- End Message ---
--- Begin Message ---> From: "B.C. Lance" <[EMAIL PROTECTED]> > Sent: Sunday, August 11, 2002 9:53 AM > Subject: [PHP] Re: need help > to do a comparison between two values / variables, you have to use == > instead of = > = is an assignment while == is a comparison operator > > if($row['gid'] == 0) I write these this way so that the php parser nags me about it if I forget the other equal sign: if(0 == $row['gid'])--- End Message ---
--- Begin Message ---ahhh. let the parser do the check. works great if you are not comparing with 2 variables :) in fact, another way to avoid this kinda pitfall, switch is another alternative. but of course, switch has its pitfall too. <break> ;) <snip> Matt wrote: > if(0 == $row['gid']) > > > </snip>--- End Message ---
--- Begin Message ---> From: "B.C. Lance" <[EMAIL PROTECTED]> > Sent: Sunday, August 11, 2002 10:17 AM > Subject: Re: [PHP] Re: need help > <snip> > Matt wrote: > > if(0 == $row['gid']) > </snip> > ahhh. let the parser do the check. works great if you are not comparing > with 2 variables :) > > in fact, another way to avoid this kinda pitfall, switch is another > alternative. but of course, switch has its pitfall too. <break> ;) Yeah, it doesn't always work, but it adds to the reliablity of the code. In my code, it's more often used then not. It's hard to think that way though, as it's backwards logic, at least to me. I always think it first the other way ($val == constant), and type it backwards :)--- End Message ---
--- Begin Message ---Hello all, I need some advice on which version of PHP & server to go with, as I am completely new to PHP. The website I am doing research for would need to be able to access a database in order to make the site interactive. Similar to the Microsoft Knowledge base at MSDN but for something totally different. Also the site would need to be able to process orders possibly with in built secure facilities that can process credit card numbers. I may outsource that side of the project but if I do it needs to seamlessly integrate with the website I am developing. Later I may need Java servelets as well so the server is going to have to be able to allow me to install support for them or have that already built in. Is PHP 4 established enough to develop this kind of project or should I look at PHP 3 instead? Any advice on a good server that would enable the points I suggested? Thanks. Steve Jackson Phone +358503435159 Email [EMAIL PROTECTED] Web http://www.webpage.co.uk/--- End Message ---
--- Begin Message ---PHP releases a stable version (currently 4.2.2) which is suitable and stable for a production environment. My advice would ALLWAYS be to install the latest stable version. If you install an earlier version, or PHP3, you will always be missing out on something (eg PHP3 doesn't have sessions). Personally I'd install on *nix with the latest stable version of Apache and MySQL (not >= 4), and compile PHP with the mcrypt options for encrypting cc's, the enable_trans_sid option to make sessions a little easier, and a few other goodies. Of course you can recompile whenever you like. Note: I've never done anything with Java servelets, so I can't answer you on that stuff. Justin French on 11/08/02 7:23 PM, Steve Jackson ([EMAIL PROTECTED]) wrote: > Hello all, > > I need some advice on which version of PHP & server to go with, as I am > completely new to PHP. > > The website I am doing research for would need to be able to access a > database in order to make the site interactive. Similar to the Microsoft > Knowledge base at MSDN but for something totally different. > > Also the site would need to be able to process orders possibly with in built > secure facilities that can process credit card numbers. I may outsource that > side of the project but if I do it needs to seamlessly integrate with the > website I am developing. Later I may need Java servelets as well so the > server is going to have to be able to allow me to install support for them > or have that already built in. > > Is PHP 4 established enough to develop this kind of project or should I look > at PHP 3 instead? > > Any advice on a good server that would enable the points I suggested? > Thanks. > Steve Jackson > Phone +358503435159 > Email [EMAIL PROTECTED] > Web http://www.webpage.co.uk/ >--- End Message ---
--- Begin Message ---Hello, I'd like to know if it's possible to redirect a visitor of my website to the page index.php if he comes from Belgium, France, Luxembourg, Switzerland and all the others redirect to index_uk.php Possible ? Thanks, Christian,--- End Message ---
--- Begin Message ---It's going to be difficult to detech 'where' the user is coming from but you can find out what their default language is. I think it's one of the sever variables. If you are using Apache though, there is an autoselection feature which allows you to have several copies of your pages in different languages e.g. you can have index.php.en, index.php.de, index.php.be etc and Apache automatically chooses the right one based on the user's language settings. In httpd.conf you can specify the priority order for each language which is used if a user can read more than one language and if there isn't an appropriate language available, Apache can ask the user to choose which one they require. You can change your default language in IE by going to tools > internet options and click on languages. For a good example go to www.google.com. Then change to another language and go to www.google.com again and hopefully the google page will be in another language. Unfortunately I don't know the language codes for Klingon or Elmer Fudd (http://services.google.com/tcbin/tc.py?cmd=status) "Christian Ista" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello, > > I'd like to know if it's possible to redirect a visitor of my website to the > page index.php if he comes from Belgium, France, Luxembourg, Switzerland and > all the others redirect to index_uk.php > > Possible ? > > Thanks, > > Christian, > >--- End Message ---
--- Begin Message ---Hi, all -- I collect field keys in an array that looks like $keylist = array('comment','job','spaced out key name','foo',...) ; and would like to pass the array to myself in a call like print "<a href=\"/myscript.php?keylist=$keylist\">link</a>" ; but when it's actually run it of course says ...keylist=Array... which is quite bad. I'd use a simple scalar $keylist = "comment job spaced out key name foo ..." ; but, of course, those darned fields which have spaces embedded in the names will really mess that up. How can I pass myself an array -- and recognize it on the receiving end? TIA & HAND :-D -- David T-G * It's easier to fight for one's principles (play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie (work) [EMAIL PROTECTED] http://www.justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!--- End Message ---
msg75000/pgp00000.pgp
Description: PGP signature
--- Begin Message ---print "<a href=\"/myscript.php?keylist=".str_replace(" ","+",implode("+",$keylist))."\">link</a>" ;--- End Message ---
--- Begin Message ---Bas, et al -- ...and then Bas Jobsen said... % % print "<a href=\"/myscript.php?keylist=".str_replace(" % ","+",implode("+",$keylist))."\">link</a>" ; I tried this and my link the looks like Click <a href="testme.php?a+b b b+c">here</a> to go round again<br> (that is, not only have I not taken care of the spaces but I now also lose the fact that these are part of $keylist). The entire little script is attached. You can see various means of printing the array. I *have* found that I can construct a link like testme.php?keylist[]=a&keylist[]=b& ... so that takes care of walking the array but now I need to protect myself from the spaces. I've looked at htmlentities() but it doesn't seem to convert spaces... Thanks again & HAND :-D -- David T-G * It's easier to fight for one's principles (play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie (work) [EMAIL PROTECTED] http://www.justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!<html> <head> <title> Test page </title> </head> <body> <?php if ( ! $keylist ) { print "No \$keylist; starting from scratch<br>\n" ; # $keylist = array('a','b','c') ; # works (of course) # $keylist = array('a','b%20b%20b','c') ; # works; is 'b b b' on 2nd pass $keylist = array('a','b b b','c') ; # doesn't work; spaces are bad print "\$keylist is $keylist<br>\n" ; foreach ($keylist as $k) { print "\$k is .$k.<br>\n" ; } # print "Click <a href=\"/testme.php?keylist=$keylist\">here</a> to go round again<br>\n" ; print "Click <a href=\"testme.php?" ; # foreach ( $keylist as $k ) { print "keylist[]=$k&" ; } print str_replace("","+",implode("+",$keylist)) ; print "\">here</a> to go round again<br>\n" ; } else { print "I have a \$keylist. It is .$keylist.<br>\n" ; foreach ( $keylist as $k ) { print "\$k is .$k.<br>\n" ; } } print "<br>\n<br>\n" ; ?> </body> </html>--- End Message ---
msg75000/pgp00001.pgp
Description: PGP signature
--- Begin Message ---you could try this: transmitting end: <?php foreach ($keylist as $key => $value) { $searchArg .= "keylist[]=".htmlentities($value)."&"; } ?> <a href="myphp.php?<?php echo $searchArg?>">array from search argument</a> receiving end: foreach($_GET["keylist"] as $key => $value) { echo "{$value}<br>"; } David T-G wrote: > Hi, all -- > > I collect field keys in an array that looks like > > $keylist = array('comment','job','spaced out key name','foo',...) ; > > and would like to pass the array to myself in a call like > > print "<a href=\"/myscript.php?keylist=$keylist\">link</a>" ; > > but when it's actually run it of course says > > ...keylist=Array... > > which is quite bad. I'd use a simple scalar > > $keylist = "comment job spaced out key name foo ..." ; > > but, of course, those darned fields which have spaces embedded in the > names will really mess that up. > > How can I pass myself an array -- and recognize it on the receiving end? > > > TIA & HAND > > :-D--- End Message ---
--- Begin Message ---from my experience, you don't really have to worry much on the space issue. & is the delimiter to determine that the string terminates and a new argument begins next. and very often, the browser will do an auto conversion from space to %20 when you click on the link. David T-G wrote: <snip> > > so that takes care of walking the array but now I need to protect myself > from the spaces. I've looked at htmlentities() but it doesn't seem to > convert spaces... </snip>--- End Message ---
--- Begin Message ---HI all, I have the following tables: artist id,name songs id,artist_id,title,writers cds id, title songs_to_cds cd_id, song_id, track_no The idea being that since a song can appear on more than one CD by a given artist, the table songs_to_cds relates them. Anyhoo, on the form where the user enters in a new CD, I'm presenting 20 select boxes with all songs related to the current artist. In the case of 1 artist, they have 120+ songs. Needless to say, 120 songs x an average of maybe 30 characters in the title x 20 drop-down selects with all the HTML code around them == one really overweight HTML page -- 100k currently!!! In the case of a user having to enter in all the tracks for 60 CDs, we're talking about a lot of waiting around for pages to come down the modem and render. I guess what i'm after is some suggestions on how I can allow a user to relate up to 20 songs IN TRACK# ORDER to a CD via a HTML page... Any suggestions welcome :) Justin French--- End Message ---
--- Begin Message ---If U are using ISS the file doesn't exist. You need to check a box in the iss options somewhere and it will check for the file first. The PHP CGI is basicly handed a non-existant file. This means that php won't return anything which means ISS will return an error. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- Please reply on the list/newsgroup unless the reply it OT. "Radio X" <[EMAIL PROTECTED]> wrote in message 003101c240ad$4cab4d90$0801a8c0@xenon">news:003101c240ad$4cab4d90$0801a8c0@xenon... I receive this when I try to send an e-mail. All works fine until yesterday and my script is the same. Could u tell what is the problem? CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:--- End Message ---
--- Begin Message ---Why doesn't parse my computer php scripts in img src tags? echo "<img border=\"0\" src=\"include/thumb.inc.php?pic=".$file."&zoom=25&ext=jpg\"> Always when I call the page where the image resides there is no image, but the full URL to the script with parsed vars like this: <img border="0" src="include/thumb.inc.php?pic=images/tennis/ls080501stg.jpg&zoom=25&ext=jpg"> Please help me. Sascha PS.:I try to get an image to thumb library working. I Did put the script in the Attachment.--- End Message ---
--- Begin Message ---Help! I can't find reference to it in the manuals but I need to subtract to time strings. ex: time_in = 11:00 time_out = 13:45 job_time = 2:45 I have stored these times into mysql as a TIME type column (yeh... I know really dumb - but to much data at this point to loose). Does anyone have any thoughts on how I could do this? Thanks, -Chris--- End Message ---
--- Begin Message ---> From: "Christopher Molnar" <[EMAIL PROTECTED]> > Sent: Saturday, August 10, 2002 11:37 AM > Subject: [PHP] subtracting 2 time strings > Help! > > I can't find reference to it in the manuals but I need to subtract to > time strings. > > ex: > > time_in = 11:00 > time_out = 13:45 > > job_time = 2:45 Something like: <?php $time_in = "11:00"; $time_out = "13:45" ; $start = strtotime($time_in); $finish = strtotime($time_out); $elapsed = $finish - $start; echo 'Elapsed time was ' . gmdate('H:i:s',$elapsed) . "<br>\n"; ?>--- End Message ---
--- Begin Message ---Thanks! Worked perfectly! -Chris On Sunday, August 11, 2002, at 09:27 AM, Matt wrote: >> From: "Christopher Molnar" <[EMAIL PROTECTED]> >> Sent: Saturday, August 10, 2002 11:37 AM >> Subject: [PHP] subtracting 2 time strings > > >> Help! >> >> I can't find reference to it in the manuals but I need to subtract to >> time strings. >> >> ex: >> >> time_in = 11:00 >> time_out = 13:45 >> >> job_time = 2:45 > > Something like: > <?php > $time_in = "11:00"; > $time_out = "13:45" ; > $start = strtotime($time_in); > $finish = strtotime($time_out); > $elapsed = $finish - $start; > echo 'Elapsed time was ' . gmdate('H:i:s',$elapsed) . "<br>\n"; > ?> >--- End Message ---
--- Begin Message ---Sorry for reposting, but I am still having this problem and the post is back to far that someone looks at it. Thank you for any help on this. I appreciate it. Andy Hi there, I am trying to write a script which is posting news to a newsserver. Unfortunatelly I do get a 535 error back which is not reported in: http://www.faqs.org/rfcs/rfc977.html Section 3.10.2 Maybe someone of you guys has a clue of an idea what is going wrong. connecting works, so I did not include the connect code. The code for posting is underneath. Thanx for any help on that. Andy $cfgServer = "news.php.net"; $cfgNewsGroup = "php.general"; $subject='Test'; $header=' Newsgroups: '.$cfgNewsGroup.' Path: '.$cfgServer.' Relay-Version: version B 2.10 2/13/83; site cbosgd.UUCP Posting-Version: version B 2.10 2/13/83; site eagle.UUCP From: [EMAIL PROTECTED] (Jerry Schwarz) Subject: '.$subject.' Message-ID: <[EMAIL PROTECTED]> Date: Friday, 10-Aug-2002 16:14:55 EST Followup-To: '.$cfgNewsGroup.' Expires: Saturday, 1-Jan-2003 00:00:00 EST Date-Received: Friday, 10-Aug-2002 16:59:30 EST Organization: Bell Labs, Murray Hill '; $body='\n This is a test. '; $message=$header.$body; $put = fputs($usenet_handle, "POST $message\n"); echo $put; ----- End Message ---
--- Begin Message ---Hi again -- ...and then David T-G said... % ... % How can I pass myself an array -- and recognize it on the receiving end? I had been spending all of my time digging into htmlentities() and the like when, in fact, all I had to do was a simple preg_replace on each component :-) Now how can I pass an array as a form element? The trick, it seems, will be recognizing all of the keys unless I can have a form element that has them all stretched out... TIA & HAND :-D -- David T-G * It's easier to fight for one's principles (play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie (work) [EMAIL PROTECTED] http://www.justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!--- End Message ---
msg75000/pgp00002.pgp
Description: PGP signature
--- Begin Message ---// untested $data = mysql_fetch_array(mysql_query("SELECT count(answer_col) as total FROM answers_table WHERE answer_col='{$answer}'")); echo $data[total]; Put this in a while/foreach statement Regards Chris Kay > -----Original Message----- > From: Justin French [mailto:[EMAIL PROTECTED]] > Sent: Sunday, 11 August 2002 12:09 PM > To: Tyler Durdin; [EMAIL PROTECTED] > Subject: Re: [PHP] records in db > > > on 11/08/02 3:52 AM, Tyler Durdin ([EMAIL PROTECTED]) wrote: > > > If I have a field in my DB that can have 4 different > answers, lets say > > a,b,c and d. How can I count the number of each in that > field. So if > > there are 4 a's 1 b 0 c's and 12 d's how can I get php to > count this? > > I'm pretty certain there's a way to do this with just one > MySQL query, but here's a PHP version that does 4 queries: > > <? // UNTESTED CODE > $answers = array('a','b','c','d'); > foreach($answers as $key => $answer) > { > $sql = "SELECT * FROM answers_table WHERE answer_col='{$answer}'"; > $result = mysql_query($sql); > if($result) > { > $count = mysql_num_rows($result); > } > else > { > $count = "0"; > } > echo "{$count} people selected answer {$answer}<br />"; > } > ?> > > Should print out something like: > > 4 people selected answer a > 1 people selected answer b > 0 people selected answer c > 12 people selected answer d > > > hack it to suit your needs, > > Justin > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >--- End Message ---
--- Begin Message ---$Query = "SELECT * FROM basket_db WHERE session_id = '$PHPSESSID'"; $Result = mysql_query($Query, $connect); if ($Result) { while ($arrResult = mysql_fetch_array($Result, MYSQL_ASSOC)) { echo '<tr bgcolor="#fffdd7" class="text01">'; echo '<td>'.$arrResult['image_id'].'</td>'; echo '<td>'.$arrResult['name'].'</td>'; echo '<td><a class="text01" href="'.$PHP_SELF.'?action=delete&id='.$arrResult['id'].'">delete</a></td>'; echo '<td> Hier Preis'.$arrResult[''].'</td>'; echo '<td> hier gesamt'.$arrResult[''].'</td>'; echo '</tr>'; } } else { echo '<tr bgcolor="#fffdd7" class="text01">'; echo '<td colspan="5">There are no Artikles in Cart.</td>'; echo '</tr>'; } This script is not doing what I want it too! Ich want to see : There are no Artikles in Cart when there are no Artikels in Cart But it good damn doesn't work! Please tell me why--- End Message ---
--- Begin Message ---> if ($Result) { if(mysql_num_rows($Result)>0) Op zondag 11 augustus 2002 16:32, schreef Sascha Braun: > $Query = "SELECT * FROM basket_db WHERE session_id = '$PHPSESSID'"; > $Result = mysql_query($Query, $connect); > if ($Result) { > while ($arrResult = mysql_fetch_array($Result, MYSQL_ASSOC)) { > echo '<tr bgcolor="#fffdd7" class="text01">'; > echo '<td>'.$arrResult['image_id'].'</td>'; > echo '<td>'.$arrResult['name'].'</td>'; > echo '<td><a class="text01" > href="'.$PHP_SELF.'?action=delete&id='.$arrResult['id'].'">delete</a></td>' >; echo '<td> Hier Preis'.$arrResult[''].'</td>'; > echo '<td> hier gesamt'.$arrResult[''].'</td>'; > echo '</tr>'; > } > } else { > echo '<tr bgcolor="#fffdd7" class="text01">'; > echo '<td colspan="5">There are no Artikles in Cart.</td>'; > echo '</tr>'; > } > > This script is not doing what I want it too! > > Ich want to see : There are no Artikles in Cart > > when there are no Artikels in Cart > > But it good damn doesn't work! > > Please tell me why--- End Message ---
--- Begin Message ---> From: "Sascha Braun" <[EMAIL PROTECTED]> >Sent: Sunday, August 11, 2002 10:32 AM >Subject: [PHP] Good Damn >$Query = "SELECT * FROM basket_db WHERE session_id = '$PHPSESSID'"; try: $Query = "SELECT * FROM basket_db WHERE session_id = '$PHPSESSID'" or die(mysql_error());--- End Message ---
--- Begin Message ---you might wanna use this instead: $result = mysql....; if (mysql_num_rows($result) { while .... } else { echo 'no articles'; } $result will always hold an int value if the query does not contain any error. so doing a num_rows on it will be more accurate in telling you if records are been retrieved. Sascha Braun wrote: > $Query = "SELECT * FROM basket_db WHERE session_id = '$PHPSESSID'"; > $Result = mysql_query($Query, $connect); > if ($Result) { > while ($arrResult = mysql_fetch_array($Result, MYSQL_ASSOC)) { > echo '<tr bgcolor="#fffdd7" class="text01">'; > echo '<td>'.$arrResult['image_id'].'</td>'; > echo '<td>'.$arrResult['name'].'</td>'; > echo '<td><a class="text01" >href="'.$PHP_SELF.'?action=delete&id='.$arrResult['id'].'">delete</a></td>'; > echo '<td> Hier Preis'.$arrResult[''].'</td>'; > echo '<td> hier gesamt'.$arrResult[''].'</td>'; > echo '</tr>'; > } > } else { > echo '<tr bgcolor="#fffdd7" class="text01">'; > echo '<td colspan="5">There are no Artikles in Cart.</td>'; > echo '</tr>'; > } > > This script is not doing what I want it too! > > Ich want to see : There are no Artikles in Cart > > when there are no Artikels in Cart > > But it good damn doesn't work! > > Please tell me why >--- End Message ---
--- Begin Message ---Hello All, I have PHP installed on PWS running on a Windows 98SE m/c. When I invoke <form action="action.php" method="POST"> everything is fine and the form data is extracted correctly. When I try to embed the same script in the body of the form using <form action="<?php $PHP_SELF; ?>" method="POST"> I get "HTTP Error 405 Method not allowed. The method specified in the request line is not allowed for the resource identified by the request. Please ensure that you have the proper MIME type set up for the resource you are requesting." I'm sorry if this is a "newbie" problem, but I can't for the life of me see what the difference is between having the method embedded or separate. Thanks in advance, John Brooks.--- End Message ---
--- Begin Message ---> <form action="<?php $PHP_SELF; ?>" <form action="<?=$PHP_SELF?>" or <form action="<?php echo $PHP_SELF; ?>"--- End Message ---
--- Begin Message --->From: "John Brooks" <[EMAIL PROTECTED]> >Sent: Sunday, August 11, 2002 10:21 AM >Subject: [PHP] Problem with $PHP_SELF on PWS > I have PHP installed on PWS running on a Windows 98SE m/c. > When I invoke <form action="action.php" method="POST"> everything is fine and the form data is > extracted correctly. > When I try to embed the same script in the body of the form using > <form action="<?php $PHP_SELF; ?>" method="POST"> I get "HTTP Error 405 Method not allowed. If you view source from the browser you'll see the action is empty. Use: <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">--- End Message ---
--- Begin Message ---Got a problem when echo:ing a variable containing alot of text. When echoing it backslashes ("\") every apostrophe ("'") and quote ("). This I don't like. And I can't use HTMLSPECIALCHARS or HTMLENTITIES since the text has alot of html tags that I want to keep intact. /Kris--- End Message ---
--- Begin Message ---Op zondag 11 augustus 2002 16:42, schreef Kristoffer Strom: > Got a problem when echo:ing a variable containing alot of text. > When echoing it backslashes ("\") every apostrophe ("'") and quote ("). > This I don't like. > And I can't use HTMLSPECIALCHARS or HTMLENTITIES since the text has alot of > html tags that I want to keep intact. > > /Kris echo stripslaches($var);--- End Message ---
--- Begin Message --->From: "Kristoffer Strom" <[EMAIL PROTECTED]> >Sent: Sunday, August 11, 2002 10:42 AM >Subject: [PHP] Problem with echo > Got a problem when echo:ing a variable containing alot of text. > When echoing it backslashes ("\") every apostrophe ("'") and quote ("). > This I don't like. > And I can't use HTMLSPECIALCHARS or HTMLENTITIES since the text has alot of > html tags that I want to keep intact. Turn off magic_quotes_gpc in php.ini or .htaccess or use stripslashes() on the fields. The quotes are there for easy database updates/inserts but cause trouble if you have to re-echo the data out. If you insert these fields into a db, and have turned of magic_quotes_gpc, you'll need to use addslashes on each field. Otherwise you get new problems.--- End Message ---
--- Begin Message ---Works like a charm, thx /Kris "Bas Jobsen" <[EMAIL PROTECTED]> wrote in message 02081115573503.02483@bjobsen">news:02081115573503.02483@bjobsen... > Op zondag 11 augustus 2002 16:42, schreef Kristoffer Strom: > > Got a problem when echo:ing a variable containing alot of text. > > When echoing it backslashes ("\") every apostrophe ("'") and quote ("). > > This I don't like. > > And I can't use HTMLSPECIALCHARS or HTMLENTITIES since the text has alot of > > html tags that I want to keep intact. > > > > /Kris > > echo stripslaches($var);--- End Message ---
--- Begin Message ---On Sat, 10 Aug 2002, lallous wrote: > > I'm making a on-line dictionary. I use PHP and a MySQL Database. > > Now I want to add audio-streaming (MP3) and pictures (JPG) to the database > > and retrieve it true PHP. Can sombody help me out with a little If the files are not "secret" or "for members only", you should better store them somewhere under your http document tree, and store *only* their filenames in the database, then you could provide a link to the file. I think this would be the faster. Or if you want to "protect" the files, you could place them outside your document tree, and then use fileread or something similar to read them. But I'd suggest you to keep only the filenames on the database, and store the files in the filesystem, it'd better for the performance and integrity of the files. Good luck.--- End Message ---
--- Begin Message ---echo ('test'==0); gives 1 why? Thanks, Bas--- End Message ---
--- Begin Message ---Because you are comparing a string to a number. PHP has to choose to either compare the two as strings or as numbers. The numerical value of the string 'test' is 0 which means it works out to 0 == 0 which is true. If you want to force a string comparison, you can use strcmp() or, if you want to force a comparison on both value and type, use === instead of == -Rasmus On Sun, 11 Aug 2002, Bas Jobsen wrote: > > echo ('test'==0); > gives 1 why? > > Thanks, > > Bas > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >--- End Message ---
--- Begin Message ---to store: setcookie ("TestCookie[0]", "zero", time() + 3600); setcookie ("TestCookie[1]", "one", time() + 3600); setcookie ("TestCookie[2]", "two", time() + 3600); or setcookie ("TestCookie[one]", "1", time() + 3600); setcookie ("TestCookie[two]", "2", time() + 3600); setcookie ("TestCookie[three]", "3", time() + 3600); to retrieve: foreach($_COOKIE["TestCookie"] as $key => $value) { echo "{$value}<br>"; } or echo $_COOKIE["TestCookie"]["one"]; echo $_COOKIE["TestCookie"][1]; Jan - Cwizo wrote: > Hi ! > > How can I stoor array in to a cookie ? > > Do I just define an array and stoore it in a cookie ? > How do I access the data in the array then ? > >--- End Message ---
--- Begin Message ---Thanx ! Dne nedelja 11. avgust 2002 18:10 je B.C. Lance napisal(a): > to store: > > setcookie ("TestCookie[0]", "zero", time() + 3600); > setcookie ("TestCookie[1]", "one", time() + 3600); > setcookie ("TestCookie[2]", "two", time() + 3600); > > or > > setcookie ("TestCookie[one]", "1", time() + 3600); > setcookie ("TestCookie[two]", "2", time() + 3600); > setcookie ("TestCookie[three]", "3", time() + 3600); > > > to retrieve: > > foreach($_COOKIE["TestCookie"] as $key => $value) { > echo "{$value}<br>"; > } > > or > > echo $_COOKIE["TestCookie"]["one"]; > echo $_COOKIE["TestCookie"][1]; > > Jan - Cwizo wrote: > > Hi ! > > > > How can I stoor array in to a cookie ? > > > > Do I just define an array and stoore it in a cookie ? > > How do I access the data in the array then ? -- LP CWIZO www.3delavnica.com www.ks-con.si www.WetSoftware.com--- End Message ---
--- Begin Message ---Appreciate the feedback, but..... The .htaccess approach appears to fit my situation best; but, I've not been able to get it to work. I have a folder with a php script and that folder has several sub-folders each with a small configuration script. I'd like the entry point to be a subfolder and main script [in the parent folder] to be "symbolically" executed. I'm familiar with the DirectorIndex and use it often, but only for defining the default file for the particular folder. Could I be doing something wrong? Or is there another htaccess directive that may work? Thanks......... Analysis & Solutions wrote: > On Sat, Aug 10, 2002 at 01:12:38PM -0400, Al wrote: > >>I'm on a virtual host without a shell account and need execute a UNIX >>command. >> >>ln -s ../afile.php index.php > > > In a PHP script, you can do this -- if permissions are favorable: > > exec('ln -s ../afile.php index.php'); > > > >>Is there some way to do this [e.g., with a htaccess file]? > > > In an .htaccess file, you can put this > > DirectoryIndex afile.php > > > >>What happens when you execute UNIX commands like the one above? Does it >>make a file, change the config? > > > It makes a link in the file system. -s makes the link symbolic. > http://www.tac.eu.org/cgi-bin/man-cgi?ln++NetBSD-current > > --Dan >--- End Message ---
--- Begin Message ---Appreciate the feedback, but..... The .htaccess approach appears to fit my situation best; but, I've not been able to get it to work. I have a folder with a php script and that folder has several sub-folders each with a small configuration script. I'd like the entry point to be a subfolder and main script [in the parent folder] to be "symbolically" executed. I'm familiar with the DirectorIndex and use it often, but only for defining the default file for the particular folder. Could I be doing something wrong? Or is there another htaccess directive that may work? Thanks......... Analysis & Solutions wrote: > On Sat, Aug 10, 2002 at 01:12:38PM -0400, Al wrote: > >>I'm on a virtual host without a shell account and need execute a UNIX >>command. >> >>ln -s ../afile.php index.php > > > In a PHP script, you can do this -- if permissions are favorable: > > exec('ln -s ../afile.php index.php'); > > > >>Is there some way to do this [e.g., with a htaccess file]? > > > In an .htaccess file, you can put this > > DirectoryIndex afile.php > > > >>What happens when you execute UNIX commands like the one above? Does it >>make a file, change the config? > > > It makes a link in the file system. -s makes the link symbolic. > http://www.tac.eu.org/cgi-bin/man-cgi?ln++NetBSD-current > > --Dan >--- End Message ---
--- Begin Message ---Does your AllowOverride include "Indexes"? If it doesn't, you can't put DirectoryIndex in a .htaccess. httpd -L is your friend. -Rasmus On Sun, 11 Aug 2002, Al wrote: > Appreciate the feedback, but..... > > The .htaccess approach appears to fit my situation best; but, I've not > been able to get it to work. > > I have a folder with a php script and that folder has several > sub-folders each with a small configuration script. I'd like the entry > point to be a subfolder and main script [in the parent folder] to be > "symbolically" executed. > > I'm familiar with the DirectorIndex and use it often, but only for > defining the default file for the particular folder. > > Could I be doing something wrong? Or is there another htaccess directive > that may work? > > Thanks......... > > Analysis & Solutions wrote: > > On Sat, Aug 10, 2002 at 01:12:38PM -0400, Al wrote: > > > >>I'm on a virtual host without a shell account and need execute a UNIX > >>command. > >> > >>ln -s ../afile.php index.php > > > > > > In a PHP script, you can do this -- if permissions are favorable: > > > > exec('ln -s ../afile.php index.php'); > > > > > > > >>Is there some way to do this [e.g., with a htaccess file]? > > > > > > In an .htaccess file, you can put this > > > > DirectoryIndex afile.php > > > > > > > >>What happens when you execute UNIX commands like the one above? Does it > >>make a file, change the config? > > > > > > It makes a link in the file system. -s makes the link symbolic. > > http://www.tac.eu.org/cgi-bin/man-cgi?ln++NetBSD-current > > > > --Dan > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >--- End Message ---
--- Begin Message ---On Sun, Aug 11, 2002 at 12:33:55PM -0400, Al wrote: > > The .htaccess approach appears to fit my situation best; but, I've not > been able to get it to work. I wondered about the DirectoryIndex directive's ability to utilize files in other directories, so did a little test, which is what you indicated you tried in your initial email: DirectoryIndex ../index.htm Worked fine. Apache 1.3.26. Windows NT. So, your problem could be a web server configuration thing, as Rasmus hinted at. Beyond the things already discussed, I'm at a loss. Good luck, --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409--- End Message ---
--- Begin Message ---Hi all. I am using readfile() to read and print the entire content of a .txt file into a site, but need to use </p> tags to break down the lines. I intend to be able, as an Administrator, to edit these text files later. What is the best way to accomplish this? Should I keep using readfile() or should I use any ther better way of doing this? Thanks in advance, Cesar Aracena CE / MCSE+I Neuquen, Argentina +54.299.6356688 +54.299.4466621--- End Message ---
--- Begin Message ---Try this one 1st http://www.phpedit.com And you will know by yourself..... "Maxim Maletsky" <[EMAIL PROTECTED]> escreveu na mensagem 000001c2401a$fce3cc70$1113fe17@dominanta">news:000001c2401a$fce3cc70$1113fe17@dominanta... > > But why not use notepad. > > Because it reduces your production speed and time is money. So, what > costs you more? > > Maxim Maletsky > [EMAIL PROTECTED] >--- End Message ---
--- Begin Message ---remove dependent modules, to find out dependencies: rpm -q --whatrequires php the list should have some php/mysql stuff, dump it all, R> >Hi > > >If i type rpm -e apache I get an error that that would destory some >dependinces ... > >In replay to Erik : > >I have downloaded the source code for PHP 4.2.2 >I can download the source code for apache and mysql to if you wish ! > >So basicly I need to have support for mysql and for tracking varibles sended >over forms (get, post). > >Nothing exsotic no extra libraries. > >O I need support for sessions if that is an extra feautre... > > >So how do I remove all apache all php all mysql from my computer, so I can >start from the beginning ? > >And please be clear with what you write :) > > > >LP >CWIZO >www.3delavnica.com >www.ks-con.si >www.WetSoftware.com > >Dne nedelja 11. avgust 2002 16:56 ste napisali: >> hey, when I started with 7.3 and Linux, I found that the best way was to >> get rid of all the installed crap and then start again. >> >> rpm -e apache for example will dump apache from your disk, I did that >> also with php and mysql client and server, >> >> then I grabbed the newest versions from rpmfind.net and installed apache >> then mysql then php 4.X with mysql support >> >> word of caution though, you can get the same rpms from the Valhalla Cd's >> but I found that for expample RPMs o mysql didn;t work (php did) , while >> the one from their site worked like a charm >> >> R> >> >> oh yeah, invoke php -v (I believe) for the version and to see if it even >> runs, also chance has it that your apache configuration will not process >> .html with embedded php but .php only, >> >> R> >> >> >Hi ! >> > >> > >> >I just installeted RedHat 7.3 >> > >> >I started apache with : >> > >> >/etc/httpd start >> > >> >I opend the browser and typed localhost. >> >The welcome page displayed. >> >Then I have created a PHP script file with this in it : >> > >> ><? >> > >> > >> >phpinof(); >> > >> >?> >> > >> >opend it and I diden't get the result but the source (the fule is in the >> >root >> >folder of apache ( /var/www/html/ ) ) >> > >> >How do I enable PHP ?? >> >And I know that in RedHat 7.3 there is PHP 4.1.2 how do I setu up the PHP >> >4.2.2 ?? >> > >> > >> >And please I am a total beginner in linux so be clear with what you write >> > :) >> > >> > >> >PS : Excuse my spelling, English is not my native language >> > >> > >> >-- >> >LP >> >CWIZO >> >www.3delavnica.com >> >www.ks-con.si >> >www.WetSoftware.com >> > >> >-- >> >PHP Install Mailing List (http://www.php.net/) >> >To unsubscribe, visit: http://www.php.net/unsub.php >> >> ________________________--__-______-______________ >> eat pasta >> type fasta > > > >-- >PHP Install Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php > ________________________--__-______-______________ eat pasta type fasta--- End Message ---
--- Begin Message ---Did that. Removed all stuff from apache, php & mysql. Now what ? I will download the source code for apache and mysql now. LP Dne nedelja 11. avgust 2002 20:56 je [EMAIL PROTECTED] napisal(a): > remove dependent modules, > to find out dependencies: > > rpm -q --whatrequires php > > the list should have some php/mysql stuff, dump it all, > > R> > > >Hi > > > > > >If i type rpm -e apache I get an error that that would destory some > >dependinces ... > > > >In replay to Erik : > > > >I have downloaded the source code for PHP 4.2.2 > >I can download the source code for apache and mysql to if you wish ! > > > >So basicly I need to have support for mysql and for tracking varibles > > sended over forms (get, post). > > > >Nothing exsotic no extra libraries. > > > >O I need support for sessions if that is an extra feautre... > > > > > >So how do I remove all apache all php all mysql from my computer, so I can > >start from the beginning ? > > > >And please be clear with what you write :) > > > > > > > >LP > >CWIZO > >www.3delavnica.com > >www.ks-con.si > >www.WetSoftware.com > > > >Dne nedelja 11. avgust 2002 16:56 ste napisali: > >> hey, when I started with 7.3 and Linux, I found that the best way was to > >> get rid of all the installed crap and then start again. > >> > >> rpm -e apache for example will dump apache from your disk, I did that > >> also with php and mysql client and server, > >> > >> then I grabbed the newest versions from rpmfind.net and installed apache > >> then mysql then php 4.X with mysql support > >> > >> word of caution though, you can get the same rpms from the Valhalla Cd's > >> but I found that for expample RPMs o mysql didn;t work (php did) , while > >> the one from their site worked like a charm > >> > >> R> > >> > >> oh yeah, invoke php -v (I believe) for the version and to see if it even > >> runs, also chance has it that your apache configuration will not process > >> .html with embedded php but .php only, > >> > >> R> > >> > >> >Hi ! > >> > > >> > > >> >I just installeted RedHat 7.3 > >> > > >> >I started apache with : > >> > > >> >/etc/httpd start > >> > > >> >I opend the browser and typed localhost. > >> >The welcome page displayed. > >> >Then I have created a PHP script file with this in it : > >> > > >> ><? > >> > > >> > > >> >phpinof(); > >> > > >> >?> > >> > > >> >opend it and I diden't get the result but the source (the fule is in > >> > the root > >> >folder of apache ( /var/www/html/ ) ) > >> > > >> >How do I enable PHP ?? > >> >And I know that in RedHat 7.3 there is PHP 4.1.2 how do I setu up the > >> > PHP 4.2.2 ?? > >> > > >> > > >> >And please I am a total beginner in linux so be clear with what you > >> > write > >> > > >> > :) > >> > > >> >PS : Excuse my spelling, English is not my native language > >> > > >> > > >> >-- > >> >LP > >> >CWIZO > >> >www.3delavnica.com > >> >www.ks-con.si > >> >www.WetSoftware.com > >> > > >> >-- > >> >PHP Install Mailing List (http://www.php.net/) > >> >To unsubscribe, visit: http://www.php.net/unsub.php > >> > >> ________________________--__-______-______________ > >> eat pasta > >> type fasta > > > >-- > >PHP Install Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php > > ________________________--__-______-______________ > eat pasta > type fasta -- LP CWIZO www.3delavnica.com www.ks-con.si www.WetSoftware.com--- End Message ---
--- Begin Message ---Hi: I'm new to PHP. I'm running Apache/PHP/MySQL on Mac OS X 10.1.5 (PHP 4.1.2) and everything is working well except that I cannot create a file through PHP. If I create a file I can subsequently read/write from PHP, but only after I change its file permissions to read/write for everyone. When I run the code: if (!file_exists($filename)) { if (touch ($filename)) { print "$filename created"; } else { die( "Sorry Could Not create $filename"); } } I get the following: Warning: unable to create file test.text because Permission denied in /Library/WebServer/Documents/dev/testcreate.php on line 10 It's obviously a permissions problem but do not know what exactly to change nor where/how to change it. Thanks for any help. David--- End Message ---
--- Begin Message ---ok, had a look through the archives but couldn't find anything, so I'm sorry if I'm asking questions answered long ago. basically i'm trying to install imlib2 as a module for php rather than compiled into it as that was giving errors. when I run phpize, I get this: root@snipe:/home/gaz/imlib# phpize aclocal: macro `AC_ADD_LIBPATH' defined in acinclude.m4 but never used aclocal: macro `AC_ADD_LIBRARY_WITH_PATH' defined in acinclude.m4 but never used aclocal: macro `AC_ADD_LIBRARY' defined in acinclude.m4 but never used aclocal: macro `AC_ADD_INCLUDE' defined in acinclude.m4 but never used autoheader: config.h.in is unchanged You should update your `aclocal.m4' by running aclocal. so then I run aclocal which gives me basically the same: root@snipe:/home/gaz/imlib# aclocal aclocal: macro `AC_ADD_LIBPATH' defined in acinclude.m4 but never used aclocal: macro `AC_ADD_LIBRARY_WITH_PATH' defined in acinclude.m4 but never used aclocal: macro `AC_ADD_LIBRARY' defined in acinclude.m4 but never used aclocal: macro `AC_ADD_INCLUDE' defined in acinclude.m4 but never used Now it will actually let me ./configure --with-imlib=shared;make;make install; but whenever I try to use the module I get the following: warning: invalid library (maybe not a PHP library) 'imlib.so' in /home/gaz/public_html/upload.php on line 6 which suggests to me that although make worked, it didn't work right because of this aclocal stuff. anybody any ideas on how to fix this? btw, this is on a i386 slackware 8.0 box, automake 1.4, autoconf 2.5 (as i'm thinking it could be down to one of these atm)--- End Message ---