Re: [PHP] Weird problem with is_file()
On 25 April 2010 22:14, Michelle Konzack linux4miche...@tamay-dogan.net wrote: Hi, I have a code sniplet which does not work and I do not know why: 8-- $isfile=shell_exec(ls /tmp/tdphp-vserver/SESSION_ . $_SERVER['REMOTE_ADDR'] . _ . $_COOKIE['VSERVER_AUTHUSER'] . _* |head -n1); if (is_file($isfile)) { snip 8-- nothing special, and the file is there, but the stuff with is_file($isfile) is not working... If I enter the file in place of $isfile, then it is working. Quoting of $isfile does not work too. What have a overseen? var_dump($isfile); Don't make assumptions of what the value is, just check it. Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird problem with is_file()
2010/4/25 Michelle Konzack linux4miche...@tamay-dogan.net: Hi, I have a code sniplet which does not work and I do not know why: 8-- $isfile=shell_exec(ls /tmp/tdphp-vserver/SESSION_ . $_SERVER['REMOTE_ADDR'] . _ . $_COOKIE['VSERVER_AUTHUSER'] . _* |head -n1); Hi Michelle, I would recommend not to let any user input to your shell. This piece of code is very insecure as any client may manipulate the shell command at will. You don't want people to take over your server that easily. See http://www.php.net/escapeshellcmd and alike. Regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Weird problem with is_file()
Hi, I have a code sniplet which does not work and I do not know why: 8-- $isfile=shell_exec(ls /tmp/tdphp-vserver/SESSION_ . $_SERVER['REMOTE_ADDR'] . _ . $_COOKIE['VSERVER_AUTHUSER'] . _* |head -n1); if (is_file($isfile)) { snip 8-- nothing special, and the file is there, but the stuff with is_file($isfile) is not working... If I enter the file in place of $isfile, then it is working. Quoting of $isfile does not work too. What have a overseen? Oh, if you think, it is an array, no it is not, because otherwise if (is_array($isfile)) { would work. Thanks, Greetings and nice Day/Evening Michelle Konzack signature.pgp Description: Digital signature
Re: [PHP] Weird problem with is_file()
Hi Michelle, Maybe try adding an error catch to see what you get. if(is_file($isFile)) or die(mysql_error()); On Apr 25, 2010, at 3:14 PM, Michelle Konzack wrote: if (is_file($isfile)) { Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird problem with is_file()
Oops, my apologies. That is a PHP MySQL solution. Wrong list. Please disregard that solution. Maybe find a way to get an error response from your session to see what the problem is. Karl On Apr 25, 2010, at 3:24 PM, Karl DeSaulniers wrote: Hi Michelle, Maybe try adding an error catch to see what you get. if(is_file($isFile)) or die(mysql_error()); On Apr 25, 2010, at 3:14 PM, Michelle Konzack wrote: if (is_file($isfile)) { Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird problem with T_gettext()
Michelle Konzack wrote: Now selecting de as prefered language is working, but if I select de_DE in Firefox, the second term About Us is something like Ãber Uns insteed Über Uns because the Website is UTF-8. Indeed. I'll venture a guess and say it's because your dictionary file is bad or not actually UTF8. This is realy weird, since the MO file is the same for both locale versions. Ah. Very weird, yes. Are you doing a setlocale() anywhere? Also it is weird, that php-gettext does not do a fallback, if I have only de and not de_DE. Fallback to what? I only have 'de' in my browser language preferences, and your site came up fine in German. /Per -- Per Jessen, Zürich (11.7°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Weird problem with T_gettext()
Hello, I need some help from german coders since I have a weird encoding problem. Currently I am coding the new website http://www.tdwave.net/ and if I do not select any languages in my Webbrowser, it show correctly english in the Siteindex (topmost block). Now selecting de as prefered language is working, but if I select de_DE in Firefox, the second term About Us is something like Ãber Uns insteed Über Uns because the Website is UTF-8. This is realy weird, since the MO file is the same for both locale versions. Any hints or ideas? Also it is weird, that php-gettext does not do a fallback, if I have only de and not de_DE. Thanks, Greetings and nice Day/Evening Michelle Konzack Systemadministrator 24V Electronic Engineer Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # http://www.tamay-dogan.net/ Michelle Konzack http://www.can4linux.org/ Apt. 917 http://www.flexray4linux.org/ 50, rue de Soultz Jabber linux4miche...@jabber.ccc.de 67100 Strasbourg/France IRC #Debian (irc.icq.com) Tel. DE: +49 177 9351947 ICQ #328449886Tel. FR: +33 6 61925193 signature.pgp Description: Digital signature
[PHP] Weird problem while reading in a file to an Array
Hello, currently I am coding a RSS feeder for the Emdebian buildd-log and for testing I use two files: http://www.emdebian.org/buildd/a/apt/trunk/apt-arm-1233120802.log http://www.emdebian.org/buildd/b/base-passwd/trunk/base-passwd-arm-1221459903.log and if you look into those Build-Logs, the structure is 100% identic. And now it comes: While the first file is working fine, the second fails processing... The generated RSS feed is here: http://devel.debian.tamay-dogan.net/rss.php?action=rsswhat=crush And you can see in the second item it is empty... :-( The script starts with: $HANDLE=curl_init(); curl_setopt($HANDLE, CURLOPT_URL, $_GET['name']); curl_setopt($HANDLE, CURLOPT_HEADER, 0); curl_setopt($HANDLE, CURLOPT_RETURNTRANSFER, 1); $BUILDLOG=curl_exec($HANDLE); if (curl_errno($HANDLE) != 0) { echo 'Curl error: ' . curl_error($HANDLE); exit(); } curl_close($HANDLE); /* Parsing the BUILDLOG */ exec(echo \$BUILDLOG\ |head -n 11, $TMP_DATA); and to see what happen to $BUILDLOG and array() I have included: echo pre\n; print_r($TMP_DATA); echo \n; echo ##\n; echo \n; echo $BUILDLOG; echo /pre\n; Now try to call: http://devel.debian.tamay-dogan.net/rss.php?action=catchwhat=crushname=http://www.emdebian.org/buildd/a/apt/trunk/apt-arm-1233120802.log which is working (see array() at the beginning) and: http://devel.debian.tamay-dogan.net/rss.php?action=catchwhat=crushname=http://www.emdebian.org/buildd/b/base-passwd/trunk/base-passwd-arm-1221459903.log which fales for array() but as you can see in the Web-Browser output, $BUILDLOG has gotten the file correctly from curl_exec(). So, whats going on here? Thanks, Greetings and nice Day/Evening Michelle Konzack Systemadministrator 24V Electronic Engineer Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # http://www.tamay-dogan.net/ http://www.can4linux.org/ Michelle Konzack Apt. 917 ICQ #328449886 +49/177/935194750, rue de Soultz MSN LinuxMichi +33/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
[PHP] Weird problem with HTML form and $_POST
Hello, I am generating a HTML form from a database and it looks (CSS striped) like: 8-- form method=POST href=/ input class=setupProjectAddSubmit type=submit value=Remove input class=setupProjectAddSubmit type=submit value=Modify input class=setupProjectAddInput name=name value=24V DC Modular ATX PSU input class=setupProjectAddInput name=serno value=1 readonly=readonly input class=setupProjectAddInput name=desc_short value=ATX PSU designed for 24V Photovoltaik-Systems and similars textarea class=setupProjectAddInput name=desc_long cols=80 rows=10 wrap=softFuzzy/textarea select class=setupProjectAddSelect name=sub_projects multiple=multiple size=10 option value=6 selectedATX 120/option option value=4ATX 60/option option value=5ATX 90/option option value=11Device 2/option option value=12Device 4/option option value=13Lowvoltage/option option value=7P4 Module/option option value=8SATA 2/option option value=9 selectedSATA 4/option option value=10 selectedSATA 8/option /select input class=setupProjectAddInput name=photos value=24V_DC_Modular_ATX_PSU.01.jpg /form 8-- and as you can see, there are three items taged... So, this part is working fine, but if I select an additional item and hit SUBMIT I get only: Array ( [name] = 24V DC Modular ATX PSU [serno] = 1 [desc_short] = ATX PSU designed for 24V Photovoltaik-Systems and similars [desc_long] = Fuzzy [sub_projects] = 10 [photos] = 24V_DC_Modular_ATX_PSU.01.jpg ) Hell, why is $_POST['sub_projects'] eating the other three items and take only the last one? Hmm, this form was already working but I have changed something and do not more know what... Any suggestions? Thanks, Greetings and nice Day/Evening Michelle Konzack Systemadministrator 24V Electronic Engineer Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # Michelle Konzack Apt. 917 ICQ #328449886 +49/177/935194750, rue de Soultz MSN LinuxMichi +33/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
Re: [PHP] Weird problem with HTML form and $_POST
On Wed, Nov 5, 2008 at 8:47 AM, Oscar Gosdinski [EMAIL PROTECTED] wrote: Name the select tag as sub_projects[], then in PHP you can read the $sub_project variable as an array. Oops, my error... you have to use the $_POST['sub_projects'] variable as an array. -- Saludos Oscar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird problem with HTML form and $_POST
On Sat, Nov 1, 2008 at 6:20 PM, Michelle Konzack [EMAIL PROTECTED] wrote: select class=setupProjectAddSelect name=sub_projects multiple=multiple size=10 option value=6 selectedATX 120/option option value=4ATX 60/option option value=5ATX 90/option option value=11Device 2/option option value=12Device 4/option option value=13Lowvoltage/option option value=7P4 Module/option option value=8SATA 2/option option value=9 selectedSATA 4/option option value=10 selectedSATA 8/option /select Hell, why is $_POST['sub_projects'] eating the other three items and take only the last one? Name the select tag as sub_projects[], then in PHP you can read the $sub_project variable as an array. -- Saludos Oscar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] weird problem in php
Hi all , I have using php 4.3.2 and mysql database. I have a form which have select tag which have the value for example -New York. When use submit the form , i need to find the first occurence of - , i use strpos function as shown below : $country = $_POST['country']; $findme = '-'; $pos = strpos($country, $findme); if ($pos === false) { $_logger-logdebug(starting searchChassisTblDB() not found); } else { $_logger-logdebug(starting searchChassisTblDB() found); } however it always give false . I did not know why. Then i did a testing , added below code in the php file without form submission, it give true value which what i wanted. Anybody have ideas or suggestion what happening ? Any difference when value submitted from form ? Thanks $mystring = '-New York'; $findme = '-'; $pos = strpos($mystring, $findme); if ($pos === false) { echo The string '$findme' was not found in the string '$mystring'; } else { echo The string '$findme' was found in the string '$mystring'; echo and exists at position $pos; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] weird problem in php
On 12/06/06, weetat [EMAIL PROTECTED] wrote: Hi all , I have using php 4.3.2 and mysql database. I have a form which have select tag which have the value for example -New York. When use submit the form , i need to find the first occurence of - , i use strpos function as shown below : $country = $_POST['country']; $findme = '-'; $pos = strpos($country, $findme); if ($pos === false) { $_logger-logdebug(starting searchChassisTblDB() not found); } else { $_logger-logdebug(starting searchChassisTblDB() found); } however it always give false . I did not know why. Then i did a testing , added below code in the php file without form submission, it give true value which what i wanted. Anybody have ideas or suggestion what happening ? Any difference when value submitted from form ? Thanks $mystring = '-New York'; $findme = '-'; $pos = strpos($mystring, $findme); if ($pos === false) { echo The string '$findme' was not found in the string '$mystring'; } else { echo The string '$findme' was found in the string '$mystring'; echo and exists at position $pos; } why don't you echo $_POST['country'] to see what you get? -- http://www.web-buddha.co.uk dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css) look out for project karma, our new venture, coming soon!
Re: [PHP] weird problem in php
On 6/12/06, weetat [EMAIL PROTECTED] wrote: I have a form which have select tag which have the value for example -New York. When use submit the form , i need to find the first occurence of - , i use strpos function as shown below : $country = $_POST['country']; $findme = '-'; $pos = strpos($country, $findme); if ($pos === false) { $_logger-logdebug(starting searchChassisTblDB() not found); } else { $_logger-logdebug(starting searchChassisTblDB() found); } however it always give false . I did not know why. Then i did a testing , added below code in the php file without form submission, it give true value which what i wanted. Anybody have ideas or suggestion what happening ? Perhaps there is a problem with the HTML for your select box. var_dump($_POST) in your PHP code to check if the value is being sent correctly. Rabin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] weird problem with index page
Hi, I am not sure if this is a PHP or Apache problem, but I am hoping someone can tellme what is wrong. When I go to www.domain.com on my server it shows the page as text instead of parsing the php code. If I go to www.domain.com/index.php (same page) it runs as it should. if I go to www.domain.com/subdir it sya s page not found even though there is a index.php file in that directory. I am at a loss as to what is wrong. index.php is listed inthe directoryindex for apache so I dont understand why it is doing all this. If anyone can help me it would be appreciated. Thanks Loll -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] weird problem with index page
loll wrote: Hi, I am not sure if this is a PHP or Apache problem, but I am hoping someone can tellme what is wrong. When I go to www.domain.com on my server it shows the page as text instead of parsing the php code. If I go to www.domain.com/index.php (same page) it runs as it should. if I go to www.domain.com/subdir it sya s page not found even though there is a index.php file in that directory. I am at a loss as to what is wrong. index.php is listed inthe directoryindex for apache so I dont understand why it is doing all this. Interesting. Do you use virtual hosts? How many DirectoryIndex directives in your configuration file? What are their contexts? Got any error in your log file? Best Bao If anyone can help me it would be appreciated. Thanks Loll -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] weird problem with index page
Well, I managed to part fix the problem, now I have a problem where there is a page that all it does is redirect to another page, it wont redirect unless I hit the refresh button. When I go to index.php it redirects to login.php, this is an old page that I just added a header(Location: blah); to so it would go to the new page. now it seems to jsut show a blank page instead of doing the second redirect, if I hit refresh on the blank page it will redirect correctly. I wondered if there was some restriction somewhere on only allowing 1 redirect where this page needs to be able to do more than one? is htis something that would be in the httpd.conf or php.ini file? Thanks! Loll -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird Problem with INPUT tag
Hello Ahbaid, Sunday, February 29, 2004, 6:33:45 AM, you wrote: AG this uses a FORM with INPUT tags, what is weird is that under IE6 some AG of the INPUT fields are showing up with yellow AG backgrounds Sounds to me like you have the Google toolbar installed with the AutoFill option enabled. See the preferences to turn the yellow background off. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Solved [PHP] Weird Problem with INPUT tag
Yep, that was indeed the problem. Many thanks for your help. I just could not see that at all regards Ahbaid Richard Davey wrote: Hello Ahbaid, Sunday, February 29, 2004, 6:33:45 AM, you wrote: AG this uses a FORM with INPUT tags, what is weird is that under IE6 some AG of the INPUT fields are showing up with yellow AG backgrounds Sounds to me like you have the Google toolbar installed with the AutoFill option enabled. See the preferences to turn the yellow background off. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Weird Problem with INPUT tag
I'm building a site using PHP for the navigation section of each page and to to do the general page layout. To this effect I have created php functions to structure the pages and I fill in the static text specific to each page. This all works. I have now got to the point where I am doing a page to send emails... this uses a FORM with INPUT tags, what is weird is that under IE6 some of the INPUT fields are showing up with yellow backgrounds They all use the same style sheet class, and simply varying the spelling of the field name and label from emil to ail fixes it!!! for example the code below is coorrect (no yellowing): tr height=1 td class=labelEmil/td tdnbsp/td td colspan=2 input type=text name=emil size=80 class=finput /td /tr but the following code is yellowed: tr height=1 td class=labelEmail/td tdnbsp/td td colspan=2 input type=text name=email size=80 class=finput /td /tr Now this goes away under Mozilla or Firebird browsers, so I know that this is specific to IE6 I'd really like to know why this is happening and how to correct this behaviour, and I cannot tell my client to not use IE. thanks for all your help the link below shows the problem in action, note the Email and Emil sections http://geosysllc.ilmtech.com/contact many thanks, Ahbaid -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] (WEIRD problem) Not following directories!!! (0t)
Hi, Heres a totally weird problem, I created some folders on our server (which we are accessing only via ip as the domain has not been resolved) but I get an error when i try to access the folder(s)! eg: (I created this folder) ryan and i try to access it like this: http://208.234.29.220/ryan/ and it gives me this error: You don't have permission to access /ryan/ on this server. Which is totally weird coz I have NOTHING in that folder right now...not even a .htaccess file What could be wrong? I have looked in my httpd.conf file and on google but cant seem to find anything...any ideas? Thanks, -Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] (WEIRD problem) Not following directories!!! (0t)
Hey Andrew, First, note that that is an apache problem, not PHP. Yep, thats why I put the Ot in the subject line but since you cant have PHP without a webserver and apache is the most popular on the list or the net...I was hopeing someone else had this problem and could guide me In httpd.conf add Option Indexes to the folder (root for whole site). That will produce a file list of the directory. Thanks, will try that right now. Or, put in a 'default' document (ie: index.html) that will produce the output when people browse to the directory. Will try that too. Directory browsing is normaly disabled in web servers (from experience, apache and IIS). See? didnt know that. Learned something new. HTH Sure did. Thanks. Cheers, -Ryan Andrew Hi, Heres a totally weird problem, I created some folders on our server (which we are accessing only via ip as the domain has not been resolved) but I get an error when i try to access the folder(s)! eg: (I created this folder) ryan and i try to access it like this: http://208.234.29.220/ryan/ and it gives me this error: You don't have permission to access /ryan/ on this server. Which is totally weird coz I have NOTHING in that folder right now... not even a .htaccess file What could be wrong? I have looked in my httpd.conf file and on google but cant seem to -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Weird problem with objects
hi, I have a shopping cart I'm having probs with. I have a cart class that starts like this: CODE require_once(class_database.php); // Database Class require_once(class_accessory.php); // Accessory Class require_once(class_order.php); // Order Class class cart { var $database; var $accessory; var $order; function cart() { $this-$database = new database(); $this-$accessory = new accessory(); $this-$order = new order(); } // end function cart /CODE and has a line like this: CODE $price = $this-$accessory-get_accessoryPrice($key); /CODE there is a get_accessoryPrice function in the accessory class, but it won't work unless I use this line instead: CODE $price = $this-$$this-$accessory-get_accessoryPrice($key); /CODE This makes no sense to me what so ever, so can anybody shed some light on it for me. I'm prob just making a silly mistake but any help would be very much appreciated. Thanks in advance Regards Mark Cubitt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird problem with objects
Mark Cubitt wrote: $this-$database = new database(); $this-$accessory = new accessory(); $this-$order = new order(); These should be... $this-database = new database(); $this-accessory = new accessory(); $this-order = new order(); You don't want the $ unless $database, $accessory and $order are strings containing the class attribute names. Additionally, you might want to assign the reference of the new objects otherwise PHP will create a new object and then make a copy of it - not very efficient. Like so... $this-database = new database(); $this-accessory = new accessory(); $this-order = new order(); -- Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: RE : [PHP] Weird problem with objects
Vincent DUPONT wrote: what do you mean by this :Additionally, you might want to assign the reference of the new objects otherwise PHP will create a new object and then make a copy of it - not very efficient. Like so... $this-database = new database(); $this-accessory = new accessory(); $this-order = new order(); The = operator makes a copy of the right side and puts it into the left side. So the new database() bit will create a new object of type database. The = operator will then make a copy of that object and put it into $this-database. So it's actually creating 2 database objects one of which will get deleted at the end of the function. By assigning the reference (that's what the gets) only one object is created. Does that make sense now? -- Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Weird problem when creating a db connection and trying to reference it in a function
Hey all- I found another strange problem. I am creating a mysql database connection like this: @ $db = mysql_pconnect(host, user, pass); mysql_select_db(dbname); Now, I have a function that inside uses mysql_list_fields() function getFields($table, $dbname) { $fields = mysql_list_fields($dbname, $table); return $fields; } The problem is this always errors saying it cant find the database. However, if I ran a mysql_query(select * from users) function, it would work fine. Any ideas on what the deal is with this function?? Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird problem when creating a db connection and trying to reference it in a function
Matt Babineau wrote: I found another strange problem. I am creating a mysql database connection like this: @ $db = mysql_pconnect(host, user, pass); mysql_select_db(dbname); you forgot the $ ... should be mysql_select_db($dbname); If you had turned up your php error reporting level (error_reporting(E_ALL); for example) it whould have given you a notice about undeclared constant for that line. A php-aware syntax highlighting editor would have also given you a visual cue about the possible error on that mysql_select_db() line. Also, I don't see where you are setting $dbname to something. You might have just not included it in your excerpt, but it may also be missing from your script :) Now, I have a function that inside uses mysql_list_fields() function getFields($table, $dbname) { $fields = mysql_list_fields($dbname, $table); return $fields; } you can just do this return mysql_list_fields($dbname, $table); -- Burhan Khalid phplist[at]meidomus[dot]com http://www.meidomus.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Weird Problem
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I have the following chunk of code: $sql = SELECT setting from settings where name='display_rows'; include(connect.inc.php); print $sql; $row = mysql_fetch_row($result); $path = $row[0]; print $path; It always prints out 1 But if I run the code at the sql command prompt, it prints out 25, which is the correct value. Does anyone have any ideas why im having this problem?? - --- Aaron Axelsen AIM: AAAK2 Email: [EMAIL PROTECTED] Want reliable web hosting at affordable prices? www.modevia.com Web Dev/Design Community/Zine www.developercube.com -BEGIN PGP SIGNATURE- Version: PGPfreeware 7.0.3 for non-commercial use http://www.pgp.com iQA/AwUBPybNTLrnDjSLw9ADEQI4LQCeP+vaCk+UtDJSeDU9H5yTt+r12JEAniaI LVwLVog89WOCsXxzIHbGsIEb =g4P4 -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird Problem
Hello, This is a reply to an e-mail that you wrote on Tue, 29 Jul 2003 at 20:40, lines prefixed by '' were originally written by you. I have the following chunk of code: $sql = SELECT setting from settings where name='display_rows'; include(connect.inc.php); print $sql; $row = mysql_fetch_row($result); $path = $row[0]; print $path; It always prints out 1 But if I run the code at the sql command prompt, it prints out 25, which is the correct value. Does anyone have any ideas why im having this problem?? - --- Unless it is done within connect.inc.php you have not executed your query. Maybe the last query you executed has a row containing the value 1 ready to be fetched? Try adding $queryid = mysql_query($sql); before $row = mysql_fetch_row($result); David. -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ (developed entirely in PHP) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Weird Problem
I have the following chunk of code: $sql = SELECT setting from settings where name='display_rows'; include(connect.inc.php); print $sql; $row = mysql_fetch_row($result); $path = $row[0]; print $path; It always prints out 1 But if I run the code at the sql command prompt, it prints out 25, which is the correct value. Does anyone have any ideas why im having this problem?? Are you actually executing the query? I don't see a mysql_query() anywhere and it would be anti-intuituve to have that in your connection include. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Weird Problem
[snip] $sql = SELECT setting from settings where name='display_rows'; include(connect.inc.php); print $sql; $row = mysql_fetch_row($result); $path = $row[0]; print $path; [/snip] Because $result is not being gotten properly... $sql = SELECT setting from settings where name='display_rows'; include(connect.inc.php); print $sql; $result = mysql_query($sql); $row = mysql_fetch_row($result); $path = $row[0]; print $path; HTH! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Weird Problem
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Yes, connect.inc.php does the following: @$connect=mysql_connect(localhost,$dbuser,$dbpass); if (!$connect) { echo Could not connect to mysql!; exit(); } @$db=mysql_select_db($dbname); if (!$db){ echo Could not connect to database; exit (); } @$result=mysql_query($sql); if (!$result){ echo Invalid Sql Command; exit (); } - --- Aaron Axelsen AIM: AAAK2 Email: [EMAIL PROTECTED] Want reliable web hosting at affordable prices? www.modevia.com Web Dev/Design Community/Zine www.developercube.com - -Original Message- From: Jennifer Goodie [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 29, 2003 2:46 PM To: Aaron Axelsen; [EMAIL PROTECTED] Subject: RE: [PHP] Weird Problem I have the following chunk of code: $sql = SELECT setting from settings where name='display_rows'; include(connect.inc.php); print $sql; $row = mysql_fetch_row($result); $path = $row[0]; print $path; It always prints out 1 But if I run the code at the sql command prompt, it prints out 25, which is the correct value. Does anyone have any ideas why im having this problem?? Are you actually executing the query? I don't see a mysql_query() anywhere and it would be anti-intuituve to have that in your connection include. -BEGIN PGP SIGNATURE- Version: PGPfreeware 7.0.3 for non-commercial use http://www.pgp.com iQA/AwUBPybRBrrnDjSLw9ADEQJrmACg70sEqN0efwGDg4o958tPx9s6K+0AoJKK 3WZTtCIVXsszKlGA/jOzrmMR =LwnA -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Weird Problem
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 The only setting contained in that table is the one im calling for, and its value is 25. - --- Aaron Axelsen AIM: AAAK2 Email: [EMAIL PROTECTED] Want reliable web hosting at affordable prices? www.modevia.com Web Dev/Design Community/Zine www.developercube.com - -Original Message- From: Aaron Axelsen [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 29, 2003 2:40 PM To: [EMAIL PROTECTED] Subject: [PHP] Weird Problem - -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I have the following chunk of code: $sql = SELECT setting from settings where name='display_rows'; include(connect.inc.php); print $sql; $row = mysql_fetch_row($result); $path = $row[0]; print $path; It always prints out 1 But if I run the code at the sql command prompt, it prints out 25, which is the correct value. Does anyone have any ideas why im having this problem?? - - --- Aaron Axelsen AIM: AAAK2 Email: [EMAIL PROTECTED] Want reliable web hosting at affordable prices? www.modevia.com Web Dev/Design Community/Zine www.developercube.com - -BEGIN PGP SIGNATURE- Version: PGPfreeware 7.0.3 for non-commercial use http://www.pgp.com iQA/AwUBPybNTLrnDjSLw9ADEQI4LQCeP+vaCk+UtDJSeDU9H5yTt+r12JEAniaI LVwLVog89WOCsXxzIHbGsIEb =g4P4 - -END PGP SIGNATURE- - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -BEGIN PGP SIGNATURE- Version: PGPfreeware 7.0.3 for non-commercial use http://www.pgp.com iQA/AwUBPybRWLrnDjSLw9ADEQJMrQCeIFkRzjnN2zoOhtS+JEO3tcVxiJ0AnR2v JHRpp/8B2Gb581ntxzS+5OGL =85R7 -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Weird Problem
The only setting contained in that table is the one im calling for, and its value is 25. see what print_r($row) outputs, then you'll at least know what is in the array. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird Problem
Isn't there a known problem with variables and included files? Like you have to create $result in the first file, or something... Just try to have it all in one file... Also, change mysql_fetch_row($result); to mysql_fetch_row($result) or print(mysql_error());... Something also tells me you are using mysql_fetch_row... Why not array? You should try to just switch between them and try once... I didn't notice it at first... mysql_fetch_array($result) is what I would use... Will probably return same thing, but who knows? -- // DvDmanDT MSN: [EMAIL PROTECTED] Mail: [EMAIL PROTECTED] Aaron Axelsen [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Yes, connect.inc.php does the following: @$connect=mysql_connect(localhost,$dbuser,$dbpass); if (!$connect) { echo Could not connect to mysql!; exit(); } @$db=mysql_select_db($dbname); if (!$db){ echo Could not connect to database; exit (); } @$result=mysql_query($sql); if (!$result){ echo Invalid Sql Command; exit (); } - --- Aaron Axelsen AIM: AAAK2 Email: [EMAIL PROTECTED] Want reliable web hosting at affordable prices? www.modevia.com Web Dev/Design Community/Zine www.developercube.com - -Original Message- From: Jennifer Goodie [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 29, 2003 2:46 PM To: Aaron Axelsen; [EMAIL PROTECTED] Subject: RE: [PHP] Weird Problem I have the following chunk of code: $sql = SELECT setting from settings where name='display_rows'; include(connect.inc.php); print $sql; $row = mysql_fetch_row($result); $path = $row[0]; print $path; It always prints out 1 But if I run the code at the sql command prompt, it prints out 25, which is the correct value. Does anyone have any ideas why im having this problem?? Are you actually executing the query? I don't see a mysql_query() anywhere and it would be anti-intuituve to have that in your connection include. -BEGIN PGP SIGNATURE- Version: PGPfreeware 7.0.3 for non-commercial use http://www.pgp.com iQA/AwUBPybRBrrnDjSLw9ADEQJrmACg70sEqN0efwGDg4o958tPx9s6K+0AoJKK 3WZTtCIVXsszKlGA/jOzrmMR =LwnA -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird Problem
* Thus wrote DvDmanDT ([EMAIL PROTECTED]): Isn't there a known problem with variables and included files? Like you have to create $result in the first file, or something... Just try to have it all in one file... Also, change mysql_fetch_row($result); to mysql_fetch_row($result) or print(mysql_error());... Something also tells me you are using mysql_fetch_row... Why not array? You should try to just switch between them and try once... I didn't notice it at first... mysql_fetch_array($result) is what I would use... Will probably return same thing, but who knows? For the record, there are no problems with variables and include files. Include files are expanded into the parent file as if they file is in the file that included it. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird Problem
Aaron Axelsen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Yes, connect.inc.php does the following: @$connect=mysql_connect(localhost,$dbuser,$dbpass); if (!$connect) { echo Could not connect to mysql!; exit(); } @$db=mysql_select_db($dbname); if (!$db){ echo Could not connect to database; exit (); } @$result=mysql_query($sql); if (!$result){ echo Invalid Sql Command; exit (); } - --- Aaron Axelsen AIM: AAAK2 Email: [EMAIL PROTECTED] Want reliable web hosting at affordable prices? www.modevia.com Web Dev/Design Community/Zine www.developercube.com The resource identifier returned by mysql_connect() is an optional input to the mysql_query() function. You should test it out to see if your system isn't passing the value automatically. $result = mysql_query($sql, $connect); //-- like this The reason you may be seeing 1 instead of the value you expected is that the mysql_query() function can return True even if it doesn't succesfully execute the query. In that case you may see the output 1 becuase the boolean True evaluates to 1 in the parser. -- Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird Problem
Curt Zirzow wrote: Include files are expanded into the parent file as if they file is in the file that included it. Ah... clear as mud. heh... ;) -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Weird Problem
Hey, I've got a script which disables a banner image when it's time is up, the script also sends an e-mail to both me and the banners owner when the time is up I've got a problem which is really weird.. Everything else works, but when the query is sent to the MySQL database, nothing happens... This is the query being sent: UPDATE st_banners SET Disabled='Y' WHERE BannerID='$bannerid' But when the script is run, it reports no errors, yet when i do SELECT Disabled FROM st_banners they are all enabled. I then echoed the query and the result it said it sent the query and it all worked, but the database was never updated.. Any thoughts or suggestions? Or should i be looking for a MySQL list?
[PHP] Weird problem with Windows XP and IE6
Hi... I've written a shopping cart program that is in use at www.dangeo.com and I'm having a weird problem that has just been brought to my attention. As far as I can tell everything works perfectly fine with the shopping cart in windows 98, and 2000. However the problem I'm having is that when customers using XP get into the shopping cart they can't get past the screen where they put in their address. I haven't been able to duplicate this problem. What I'm hoping is that some of you might be able to take a look at it, duplicate the problem, and give me some suggestions as to what the problem is. Jason Cathcart Check Out My Site: http://www.biohazardous.org
[PHP] Weird problem with Win2k
Hello everybody, I haven't made any changes to my system lately. This box is running Win2k w/ SP1. Whenever I try to run php.exe, I get the following error: Application popup: php.exe - Entry Point Not Found: The procedure entry point ??_U@YAPAXI@Z could not be located in the dynamic link library MSVCRT.dll. Does anybody have any idea why this occurs? This also happens when I try to run Paint Shop Pro. So it's not PHP itself. When PHP is started on boot, the error is logged to the event log. Anybody seen anything like this before? Thanks, Tyler Longren -- 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] Weird Problem
Hi everyone, First, let me explain I am a very knowledgable php developer. I'm not someone trying to write their first script. I have been working on a very large and complex problem for some time now when it suddenly stopped working. I did not change anything in any configurations or edit any code that would have affected how my database functionality class would function. But, all of my connections started to bomb out. Follows are the entire contents of a file simp.php (minus the line numbers): 1 ? 2 3 $db = mysql_connect("localhost", "web", "pw") || print "error connecting ".mysql_error()." ".mysql_errno(); 4 mysql_select_db("surveys"); 5 6 $result = mysql_query("select * from attract") || print "error querying ".mysql_error()." ".mysql_errno(); 7 8 $i = 0; 9 while ($row = mysql_fetch_array(mysql_query("select * from attract"))){ // ($i++ 5)){ 10 echo $row[0]." ".$row[1]."br"; 11 } 12 ? Please note that the user web@localhost identified by pw has permissions to select from the table attract. Here is what I have identified so far: A - If I use $result in mysql_fetch_array() line 9, I get the error: Warning: Supplied argument is not a valid MySQL result resource in simp.php3 on line 9 But if I use the statement mysql_query("select * from attract") in its place, the loop (although infinite) will produce expected results, ie print out the first and second columns of the first row of the table infinitely. So basically, I would conclude the life of the variable result is terminiating before I can use it. Why, I don't have a clue. B - Being tired of an infinite loop in my investigation, I added line 8 and I placed the statement ($i++ 5) inside the while loop condition. Now, only the br and spaces from line 10 will print, not the actual values of the $row array. The output is br br br br br, with no values from the table attract. This is where I stand now, completely flabberghasted and nearly insane. Can anyone shed any light on this before I have to commit to bringing down the webserver while I reinstall php4. (oh, btw I am running Apache/1.3.14 (Unix) PHP/4.0.4pl1 on Red Hat 6.2 (I hate redhat, but the bossman says its better supported than slakware. bah.)) Thank you all for your help. steve -- 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] Weird Problem
On Tue, 27 Feb 2001 05:53, Steve Segarra wrote: Hi everyone, First, let me explain I am a very knowledgable php developer. I'm not someone trying to write their first script. I have been working on a very large and complex problem for some time now when it suddenly stopped working. I did not change anything in any configurations or edit any code that would have affected how my database functionality class would function. But, all of my connections started to bomb out. Follows are the entire contents of a file simp.php (minus the line numbers): 1 ? 2 3 $db = mysql_connect("localhost", "web", "pw") || print "error connecting ".mysql_error()." ".mysql_errno(); 4 mysql_select_db("surveys"); 5 6 $result = mysql_query("select * from attract") || print "error querying ".mysql_error()." ".mysql_errno(); 7 8 $i = 0; 9 while ($row = mysql_fetch_array(mysql_query("select * from attract"))){ // ($i++ 5)){ 10 echo $row[0]." ".$row[1]."br"; 11 } 12 ? Please note that the user web@localhost identified by pw has permissions to select from the table attract. Here is what I have identified so far: A - If I use $result in mysql_fetch_array() line 9, I get the error: Warning: Supplied argument is not a valid MySQL result resource in simp.php3 on line 9 But if I use the statement mysql_query("select * from attract") in its place, the loop (although infinite) will produce expected results, ie print out the first and second columns of the first row of the table infinitely. So basically, I would conclude the life of the variable result is terminiating before I can use it. Why, I don't have a clue. B - Being tired of an infinite loop in my investigation, I added line 8 and I placed the statement ($i++ 5) inside the while loop condition. Now, only the br and spaces from line 10 will print, not the actual values of the $row array. The output is br br br br br, with no values from the table attract. This is where I stand now, completely flabberghasted and nearly insane. Can anyone shed any light on this before I have to commit to bringing down the webserver while I reinstall php4. (oh, btw I am running Apache/1.3.14 (Unix) PHP/4.0.4pl1 on Red Hat 6.2 (I hate redhat, but the bossman says its better supported than slakware. bah.)) Thank you all for your help. steve Is it possible that the || construct doesn't work in the way you are using it and thus you aren't seeing mysql_error? The most common examples I have seen use the actual string 'or'. Try with a query that you _know_ will trip an error. -- David Robley| WEBMASTER Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet| http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA -- 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]