[PHP] error from 4.3.10: The specified procedure could not be found.
Forgive me if this has been answered before, but all I was able to find was a bogus bug report on this issue that did not contain any useful information. When installing php 4.3.10 on a Win2k3 machine I'm getting the The specified procedure could not be found. Error from any php page I attempt to execute. I don't have any extensions enabled and this is a completely vanilla install of 4.3.10. Followed the installation procedure to a tee. It works with 4.3.6 but 4.3.6 has other show-stopper bugs. It looks like other people are having this problem as well, though it doesn't appear (at least, not to Google) that anyone has been able to solve it. Any information is greatly appreciated, including links to any FAQs that might be helpful since I haven't found any that contain *any* useful information on this problem. Thanks, -Javier -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Unique ID
auto_increment is not in the SQL standard, and not everyone uses MySQL. To be cross-compatible between databases use a Sequence: http://pear.php.net/manual/en/package.database.db.intro-sequences.php provides a brief introduction, the PEAR::DB class allows you to use sequences easily. Neither auto-increment nor sequences allow you to do what you're asking for though, which is like database garbage collection. If you really need something like this you should implement it in a cron job that runs during non-peak hours as it will be quite an expensive operation on a large table (the best way I can think of would be to iterate over all table rows and look for gaps in the table, and for each gap take the record with the highest ID and change the ID to fill the gap, then update all replys to match the new ID, after everything is finished reset the sequence to the highest id in the modified table and you're done). Note from the MySQL manual for you auto_increment fans out there: Posted by Jim Martin on Tuesday October 1 2002, @11:57am Just in case there's any question, the AUTO_INCREMENT field /DOES NOT WRAP/. Once you hit the limit for the field size, INSERTs generate an error. (As per Jeremy Cole) And the comment a few beyond that regarding being able to drop the index and renumber doesn't help here, as there is an exterior resource (the reply table) that will be broken as soon as the ids change. If anyone has a better suggestion on how to do this I'd love to hear it :) -Javier -Original Message- From: Marek Kilimajer [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 11, 2003 3:30 PM To: Dimitri Marshall Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Unique ID Dimitri Marshall wrote: Hi there, Here's my situation: I'm making a message board and I've decided the best way to go about the structure is to have 3 tables, two of them will be Posts and Replys. Now, in order for this ti work, each post has to have a UniqueID - same with the replys. Looking at another program, I can see that one way to do this is to do it by rows (ie. count how many rows, add 1, then that is the ID). It would be unique because no two rows would be 1 for example. The problem I can see is that the database would become incredibly huge (size wise I mean). I want to delete the posts after 30 days, and if I delete the row, then that would mess up the row system. Any suggestions? Have you heard about auto_increment? Read on: http://www.mysql.com/doc/en/example- AUTO_INCREMENT.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Beveled text
Interesting, is this for a website? If so have you tried doing the same thing with CSS? Using CSS you could make the site load faster and be more accessible (for instance, you can allow users to choose their own font size, and make it easier for page readers to handle your page). -Javier -Original Message- From: Ashley M. Kirchner [mailto:[EMAIL PROTECTED] Sent: Saturday, November 08, 2003 10:12 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Beveled text Ashley M. Kirchner wrote: This produces the attached result. Not exactly beveled, but pretty close (and it's the effect I wanted.) Hmm, yes. Attached result gets stripped by the listserv. So, it's also visible here: http://37th.yeehaw.net/phpiscool.png -- H| I haven't lost my mind; it's backed up on tape somewhere. + Ashley M. Kirchner mailto:[EMAIL PROTECTED] . 303.442.6410 x130 IT Director / SysAdmin / WebSmith . 800.441.3873 x130 Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6 http://www.pcraft.com . . .. Boulder, CO 80303, U.S.A. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Beveled text
Ok, that's reasonable. My only suggestion would be to cache the images that your script generates. A good way to do this is to md5 or otherwise hash the arguments to the PNG generation code and then have the code search for a file in a specified directory (/tmp/generated_pngs for instance) with that name before calling gd, if it exists just read out that file, otherwise generate a new one and place it in the directory. This will lower your overhead without adding too much complexity. To spray out the cached version of your PNG use readfile() or something similar. -Javier -Original Message- From: Ashley M. Kirchner [mailto:[EMAIL PROTECTED] Sent: Saturday, November 08, 2003 11:57 PM To: Javier Muniz Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Beveled text Javier Muniz wrote: Interesting, is this for a website? If so have you tried doing the same thing with CSS? Using CSS you could make the site load faster and be more accessible (for instance, you can allow users to choose their own font size, and make it easier for page readers to handle your page). When I originally created the script, it was simply an exercise, to see if I could do it. However, I have since then incorporated it into a site design of mine, where I wanted the headers to be images, dynamically created. So yes, for each page that loads, each header calls this script which then spits out the PNG data. Large overhead, simply because I never bothered looking into doing it with CSS, and also because outputting a PNG image I'm guaranteed it will work, and it will look the way I want it to look (both font type, as well as with layout positioning,) as opposed to dealing with broken browsers and people not seeing the same thing. And also because I can use my fonts, instead of relying on the user having a particular font installed on their system. -- H| I haven't lost my mind; it's backed up on tape somewhere. + Ashley M. Kirchner mailto:[EMAIL PROTECTED] . 303.442.6410 x130 IT Director / SysAdmin / WebSmith . 800.441.3873 x130 Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6 http://www.pcraft.com . . .. Boulder, CO 80303, U.S.A. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Executing shell commands
Ack! No no no no no! At least put something this critical in a password protected database, not a place that could possibly be written to by a malicious user that gains access to an easily-writable directory like /tmp, the DoS and security ramifications of having a system like this are huge. Be exceptionally careful, and never pretend that /tmp is a safe place for data. If something is being read from /tmp then it should be treated the same way user-inputted data is, and never trusted. -Javier -Original Message- From: Robert Cummings [mailto:[EMAIL PROTECTED] Sent: Sunday, November 09, 2003 12:47 AM To: Teren Cc: PHP-General Subject: Re: [PHP] Executing shell commands On Sun, 2003-11-09 at 03:41, Teren wrote: Hi, I'm trying to write a front end for something and I want to be able to execute shell commands. I tried all of the pre-written functions and non of them would work. I setup a user that can sudo and then i set apache to run as that user. So, what I tried to do is shell_exec(sudo -s; reboot;); but that didn't work, I also tried other numerous variations all of which didn't work (also using exec(), system(), passthru() ). If any one has any ideas how i can do this, please let me know. Thanks I believe this has been answered quite recently and the large consensus was to have a daemon (cron or otherwise) check for some status file or database entry, which when set it would perform the required function. So for instance to reboot the machine, perhaps a cron job would check for the existence of /tmp/myFrontEnd/reboot and if found reboot the machine. Thus the front end would only need to create the file. HTH, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | a | powerful, scalable system for accessing system services | such as | forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Solutions for 1970 epoch date restriction
If you can't change your database for some reason, for instance if it's a legacy system or other large systems rely on that table format, look into PEAR's Date class, it can probably help you out. -Javier -Original Message- From: David Otton [mailto:[EMAIL PROTECTED] Sent: Sunday, November 09, 2003 4:00 PM To: YC Nyon Cc: php Subject: Re: [PHP] Solutions for 1970 epoch date restriction On Mon, 10 Nov 2003 01:41:15 +0800, you wrote: I have a table that includes 3 columns for day, month and year. Example: Day, Month, Year 11,Jan, 1974 4,Sep, 1921 That would be your problem - you should be using your database's native date type. I need to construct a query where users can specify a starting date. Currently, I stuck in mktime function became of the 1970 epoch problem. It gives an error for dates before 1970. Anyone has a solution? [assumes mysql] http://www.mysql.com/doc/en/Date_and_time_types.html SELECT * FROM table WHERE start_date '1969-08-25'; [for anyone who's interested, Raymond Chen's excellent journal had a short article on various Windows timestamps: http://blogs.gotdotnet.com/raymondc/permalink.aspx/99c54993-5c5e-45b9-95c1-c 20a0526ce0b] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Executing shell commands
I realize that, just didn't want to suggest that /tmp was a good solution instead of a database. The question is always about security, btw ;) -Javier -Original Message- From: Robert Cummings [mailto:[EMAIL PROTECTED] Sent: Sunday, November 09, 2003 5:54 PM To: Javier Muniz Cc: Teren; PHP-General Subject: RE: [PHP] Executing shell commands I did mention database as one of the solutions. The question wasn't about security so I didn't elaborate. Cheers, Rob. On Sun, 2003-11-09 at 16:45, Javier Muniz wrote: Ack! No no no no no! At least put something this critical in a password protected database, not a place that could possibly be written to by a malicious user that gains access to an easily-writable directory like /tmp, the DoS and security ramifications of having a system like this are huge. Be exceptionally careful, and never pretend that /tmp is a safe place for data. If something is being read from /tmp then it should be treated the same way user-inputted data is, and never trusted. -Javier -Original Message- From: Robert Cummings [mailto:[EMAIL PROTECTED] Sent: Sunday, November 09, 2003 12:47 AM To: Teren Cc: PHP-General Subject: Re: [PHP] Executing shell commands On Sun, 2003-11-09 at 03:41, Teren wrote: Hi, I'm trying to write a front end for something and I want to be able to execute shell commands. I tried all of the pre-written functions and non of them would work. I setup a user that can sudo and then i set apache to run as that user. So, what I tried to do is shell_exec(sudo -s; reboot;); but that didn't work, I also tried other numerous variations all of which didn't work (also using exec(), system(), passthru() ). If any one has any ideas how i can do this, please let me know. Thanks I believe this has been answered quite recently and the large consensus was to have a daemon (cron or otherwise) check for some status file or database entry, which when set it would perform the required function. So for instance to reboot the machine, perhaps a cron job would check for the existence of /tmp/myFrontEnd/reboot and if found reboot the machine. Thus the front end would only need to create the file. HTH, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | a | powerful, scalable system for accessing system services | such as | forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | a | powerful, scalable system for accessing system services | such as | forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] BTML 2.0 released!!!
Agreed, and the flexibility of smarty allows for quite a bit more functionality for the template developer... Anyone seriously considering template engines should take a hard look at Smarty. Just my $0.02. Oh, and if you don't like top-posting, ignore this msg, as I will undoubtedly ignore your response (actually I won't even have the chance, I have at this point configured my anti-spam software to automatically delete msgs with top post or bottom post in them, and suggest that other users of this list do the same). -Javier -Original Message- From: Chris Hubbard [mailto:[EMAIL PROTECTED] Sent: Thursday, November 06, 2003 3:13 PM To: Bas; [EMAIL PROTECTED] Subject: RE: [PHP] BTML 2.0 released!!! Bas, Looks interesting. But why would I use bhtml when I've got Smarty and 10,000 other templating systems to choose from? I'm not interested in the vauge promises of speed. I'm only interested in systems that make it easier for me to code. Smarty makes it easier for me to code. How does bhtml help me? And ditto on the comments about posting code. Please find a way to make it readable. Chris -Original Message- From: Bas [mailto:[EMAIL PROTECTED] Sent: Thursday, November 06, 2003 7:21 AM To: [EMAIL PROTECTED] Subject: [PHP] BTML 2.0 released!!! Okay, i am happy that BTML 2.0 is released(finally) It is also known as BTML Template Edition. The 3 files(the parser, a simple template and a test BTML-file) btmltpl.php --- ?php function tpl2html($title, $images, $text, $tplfile = simple.tpl, $links = ) { $tpldata = file_get_contents($tplfile); $trans = array('%title%' = $title, '%text%' = $text, '%images%' = $images, '%links%' = $links); $html = strtr($tpldata, $trans); return $html; } function parseTags($file) { /* readfile... here */ $filedata = file_get_contents($file); $tag_match =(!bttag=(\w*)\s*(.*?)\s*/bttag!is); preg_match_all($tag_match, $filedata, $matches); for ($i=0; $i count($matches[0]); $i++) { $tagname = $matches[1][$i]; $tag['tagname'] = $tagname; $tag['value'] = $matches[2][$i]; $tags[] = $tag; } return $tags; } include_once template.php; $filename = $_GET['name']; $bttags = parseTags($filename); // echo HTMLHEAD; foreach($bttags as $tag) { switch($tag['tagname']) { case 'title': $title = $tag['value']; // echo TITLE . $tag['value'] . /TITLE/HEADBODY; // echo H1 . $tag['value'] . /h1br; break; case 'heading': $completetext .= h1 . $tag['value'] . /h1br; // echo H1 . $tag['value'] . /h1br; break; case 'image': if (!empty($tag['value'])) { // echo IMG SRC=\ . $tag['value'] . \; $images .= IMG SRC=\ . $tag['value'] . \br; } break; case 'text': // echo nl2br($tag['value']); $completetext .= nl2br($tag['value']); break; case 'nl': // echo br\n; $completetext .= br; break; case 'template': $templatefile = $tag['value']; break; case 'link': $links .= a href= . $tag['value'] . . $tag['value'] . /abr } } // echo /body/html; if (empty($templatefile)) { echo tpl2html($title, $images, $completetext); } else { echo tpl2html($title, $images, $completetext, $templatefile); } ? --- simple.tpl --- HTML HEADTITLE%title%/TITLE/HEAD BODY centerh1%title%/h1/centerbr hr %text%brbr Images: br %images% /BODY /HTML --- And test.btm --- bttag=title Welcome to BTML page v1! /bttag bttag=text Welcome to my BTML page!!! This is an experimentally version of HTML!!! brBye!!! /bttag bttag=nl /bttag bttag=heading Bye /bttag --- Hope that you like it and please tell me wat you think of it, Bas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Beveled text
You'll have to increase the character spacing as well, so that each character has the same center not just the individual word/phrase. I don't think this is going to be exactly a bevel effect, but on small enough text it might appear like one. -Javier -Original Message- From: Nathan Taylor [mailto:[EMAIL PROTECTED] Sent: Saturday, November 08, 2003 6:02 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Beveled text Well, I'm speaking from imagination here but I imagine the effect could be obtained by creating a series of layers to one item in a loop, changing the alpha transparency slightly each time as well as shrinking the size of the image. You'd start with 75ish alpha level and then loop through one level at a time up a to 100 or something like that, shrinking the text gradually and building off the same center each time. Try it and tell me what happens, I am curious. Cheers, Nathan - Original Message - From: Siddhartha Lahiri To: [EMAIL PROTECTED] Sent: Saturday, November 08, 2003 8:45 AM Subject: [PHP] Beveled text Hi, is it possible to create a beveled text using GD. Going through all the classes I have not come across any algorithm which explains beveled text. Siddhartha -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SESSION Not behaving II: permission denied(13)
Look at on_session_save_handler in the manual, I believe there is an example there on how to do this. If not google it, many examples of this exist... So many that I don't think it's worth spamming this list with my own examples. -Javier -Original Message- From: [-^-!-%- [mailto:[EMAIL PROTECTED] Sent: Saturday, October 18, 2003 2:35 PM To: Burhan Khalid Cc: [EMAIL PROTECTED] Subject: Re: [PHP] SESSION Not behaving II: permission denied(13) That would be one solution, but I am on a shared hosting server. I cannot change the folder permissions. I've asked tech support to look into this. Does anyone know where I can get a class that will save the session vars to mysql? =P e p i e D e s i g n s www.pepiedesigns.com Providing Solutions That Increase Productivity Web Developement. Database. Hosting. Multimedia. On Sat, 18 Oct 2003, Burhan Khalid wrote: [-^-!-%- wrote: Yep. It's me again. 96 hours into the battle, and SESSIONS are still winning. I've written my login script and is now getting the following error. Please advise. Warning: open(/tmp/sess_a690c089dead297c95034d9fe243f860, O_RDWR) failed: Permission denied (13) in Unknown on line 0 Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0 First thing, make sure /tmp exists. If it does, make sure that the apache user has permissions to write to it. You can modify its permissions so that the apache user and/or group can write to /tmp; or you can chmod it to 777 (which could lead to other security issues). This should get rid of your warnings. -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SESSION Not behaving II: permission denied(13)
Err, make that session_set_save_handler :) -Original Message- From: Javier Muniz [mailto:[EMAIL PROTECTED] Sent: Saturday, October 18, 2003 4:27 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] SESSION Not behaving II: permission denied(13) Look at on_session_save_handler in the manual, I believe there is an example there on how to do this. If not google it, many examples of this exist... So many that I don't think it's worth spamming this list with my own examples. -Javier -Original Message- From: [-^-!-%- [mailto:[EMAIL PROTECTED] Sent: Saturday, October 18, 2003 2:35 PM To: Burhan Khalid Cc: [EMAIL PROTECTED] Subject: Re: [PHP] SESSION Not behaving II: permission denied(13) That would be one solution, but I am on a shared hosting server. I cannot change the folder permissions. I've asked tech support to look into this. Does anyone know where I can get a class that will save the session vars to mysql? =P e p i e D e s i g n s www.pepiedesigns.com Providing Solutions That Increase Productivity Web Developement. Database. Hosting. Multimedia. On Sat, 18 Oct 2003, Burhan Khalid wrote: [-^-!-%- wrote: Yep. It's me again. 96 hours into the battle, and SESSIONS are still winning. I've written my login script and is now getting the following error. Please advise. Warning: open(/tmp/sess_a690c089dead297c95034d9fe243f860, O_RDWR) failed: Permission denied (13) in Unknown on line 0 Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0 First thing, make sure /tmp exists. If it does, make sure that the apache user has permissions to write to it. You can modify its permissions so that the apache user and/or group can write to /tmp; or you can chmod it to 777 (which could lead to other security issues). This should get rid of your warnings. -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] returning a variable from a class function? plus other probs
Your sql statement is generating an error. You can test for this using mysql_errno and mysql_error to test for and view the error, respectively. The likely cause of the SQL error is that you are not putting quotes (') around your string for the email query, the proper query would look like: $chk = select id, fname from contact_info where email = '$email'; Hope that helps! -Original Message- From: Kirk Babb [mailto:[EMAIL PROTECTED] Sent: Saturday, October 04, 2003 5:28 PM To: [EMAIL PROTECTED] Subject: [PHP] returning a variable from a class function? plus other probs I'm new at OO and still a newbie at PHP despite hacking away at it for a while (admittedly off and on). I'm creating a signup form for alumni of our department, and I'm trying to verify that they have not signed up previously before allowing their data to be inserted. Trouble has ensued! :) In the following code: class alumnus { function addAlum($fname,$lname,$tel,$address,$city,$state,$zipcode,$country,$email) { $conxn = mysql_connect('localhost','root','redtail.7') or fail(Could not connect: .mysql_error()); $dbSelect = mysql_select_db(alumni, $conxn) or fail(Could not select database: .mysql_error()); $chk = Select id, fname from contact_info where email = . $email; $result = mysql_query($chk); $dataSet = mysql_fetch_array($result); $fields = mysql_num_fields($dataSet); if ($fields==0) { $insertData = INSERT into contact_info (fname,lname,tel,address,city,state,zipcode,country,email) VALUES ('$fname','$lname','$tel','$address','$city','$state','$zipcode','$country', '$email'); $query = mysql_query($insertData); if ($query) { $bool=true; return $bool; } } } I keep getting supplied argument is not a valid MySQL result resource for the lines using mysql_fetch_array and mysql_num_fields - I've looked up the functions but it doesn't seem like I'm misusing them. PLUS my $bool doesn't show up outside like I'd like it to. Can somebody guide me on the right path here? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5 interfaces?
What I meant was not the implementation, what I meant was that there was no way for the compiler/parser to know whether I was implementing position() from the Employee interface or the BoardMember interface, the declaration was ambiguous. If I implement the function there, then (from what I can tell) it becomes the position member for both the BoardMember interface AND the Employee interface. While this might be desired in some cases, it's definitely not desired in all cases, so there needs to be some other identifier (such as the implements keyword followed by which interface(s) this function should be used for). PHP5 may have such an identifier, but I have not found any documentation at this point... -Javier Marek Kilimajer wrote: interface BoardMember { function position(); // used to set board position of board member } interface Employee { function position(); // used to set job title of employee } class BusyBoardMember implements Employee, BoardMember { function position(); // what does this function do? ambiguous unless I am missing something } It is not ambiguous, you should implement the function here. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP5 interfaces?
So does this mean that I can then do: Class BusyBoardMember implements Employee, BoardMember { function position() { // code for Employee implementation; } function position() { // code for BoardMember implementation; } } And if I only implement position() once then it will return an error? This seems more than a little confusing, and like it could cause serious mistakes down the road (during maintenance, etc) -Javier -Original Message- From: Robert Cummings [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 23, 2003 11:23 AM To: Javier Muniz Cc: '[EMAIL PROTECTED]' Subject: Re: [PHP] PHP5 interfaces? On Tue, 2003-09-23 at 14:01, Javier Muniz wrote: What I meant was not the implementation, what I meant was that there was no way for the compiler/parser to know whether I was implementing position() from the Employee interface or the BoardMember interface, the declaration was ambiguous. I would imagine priority would be based on the order of the named interfaces. Thus in your example it would use the Employee position() method. Cheers, Rob. If I implement the function there, then (from what I can tell) it becomes the position member for both the BoardMember interface AND the Employee interface. While this might be desired in some cases, it's definitely not desired in all cases, so there needs to be some other identifier (such as the implements keyword followed by which interface(s) this function should be used for). PHP5 may have such an identifier, but I have not found any documentation at this point... -Javier Marek Kilimajer wrote: interface BoardMember { function position(); // used to set board position of board member } interface Employee { function position(); // used to set job title of employee } class BusyBoardMember implements Employee, BoardMember { function position(); // what does this function do? ambiguous unless I am missing something } It is not ambiguous, you should implement the function here. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | a | powerful, scalable system for accessing system services | such as | forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Validation: Problems with header(Location) in PHP
Hi Martin, When they say at the top of the page before anything else, they mean before any other output. Just make sure that you don't have any HTML/text before the header(Location: ...) that's outside of your ?php ?'s, and that you don't echo anything before your header call. -Javier -Original Message- From: Martin Raychev [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 24, 2003 1:23 PM To: [EMAIL PROTECTED] Subject: [PHP] Validation: Problems with header(Location) in PHP Hi! I am kind of newbie coming from ASP and I came upon some hindrances, which could be because of not knowing enough of PHP The problem is: I am trying to make a form with good and user-friendly validation. After failure to validate properly some of the fields and going to another page i.e. the form action=anotherpage.php I need to go back to the previos page where the form is. In ASP I would use Response.Redirect and that's it but the header (Location...) in PHP is said that it must be on top of the HTML page before anything else. This doesn't seems to work for me. Does anyone has a solution to this problem? Many thanks in advance! Martin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL statement
You need to change timestamp to formatted_ts in your php code. -Original Message- From: Dan J. Rychlik [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 23, 2003 5:45 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] SQL statement Thank you for your time on this. I do apologize for being a pain. Here is my code... ?php // Function that runs reports on logon history function logonHist() { db_connect(); //establish connection $_qlogonhist = (SELECT username,host_info,status, DATE_FORMAT(timestamp, '%d%m%y') as formatted_ts FROM custlogon_hist); // Build query. //$_qlogonhist = ('SELECT * FROM custlogon_hist'); $_rlogonhist = mysql_query($_qlogonhist); ? table width=50% border=0 align=center cellpadding=0 cellspacing=0 ?php while ($row = mysql_fetch_array($_rlogonhist)) { ? tr td width=27%strongfont color=#00 size=2 face=Arial, Helvetica, sans-serifUsername/font/strong/td td colspan=3font color=#00 size=2 face=Arial, Helvetica, sans-serif ?php echo $row['username'];?/font/td /tr tr tdstrongfont color=#00 size=2 face=Arial, Helvetica, sans-serifHost Info /font/strong/td td colspan=3font color=#00 size=2 face=Arial, Helvetica, sans-serif ?php echo $row['host_info'];?/font/td /tr tr tdstrongfont color=#00 size=2 face=Arial, Helvetica, sans-serifStatus/font/strong/td td colspan=3font color=#00 size=2 face=Arial, Helvetica, sans-serif ?php echo $row['status'];?/font/td /tr tr tdstrongfont color=#00 size=2 face=Arial, Helvetica, sans-serifTime Stamp /font/strong/td td colspan=3font color=#00 size=2 face=Arial, Helvetica, sans-serif ?php echo $row['timestamp'];?/font/td /tr tr bgcolor=#99 tdnbsp;/td td width=38%nbsp;/td td colspan=2nbsp;/td /tr ?php } // end while ? /table ?php } // end function ? ERROR Username drychlik Host Info 127.0.0.1 Status OK Time Stamp Notice: Undefined index: timestamp in C:\Program Files\Apache Group\Apache2\htdocs\Ameriforms\admintool\includes\getlogonhist.php on line 44 - Original Message - From: Jennifer Goodie [EMAIL PROTECTED] To: Dan J. Rychlik [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, September 23, 2003 7:39 PM Subject: RE: [PHP] SQL statement Jennifer, you're right, I am using fetch_array... I tried to use your suggestion, and it failing as well, It wont even execute There's probably an error in my SQL syntax. What is mysql_error() telling you? I dont believe it to be an error because Ive run this from the CLI on my zeus system. I have also echoed out the sql statement to read exactly what I know its got to be problem with the string terminators and or the way the fetch_array reads the elements of a record in my database. Why don't you humor me and tell me what the error is and show me the code that is generating it. A PHP error message and the output from mysql_error() will go a long way in debugging a problem. I can't really work with it stops working and it fails to execute, those don't tell me much except that there's probably a problem with the query. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP5 interfaces?
Wondering if maybe someone famililar with php5 can respond to this. I am reading about PHP5 and it's interface support, and i have a concern. The purpose of interfaces is to handle multiple inheritance in a fashion that resolves a number of conflicts that arise when performing true multiple inheritance, the most obvious conflict being two identical members being inherited from different classes. What appears to be missing, and correct me if I'm wrong, is the ability to address this issue in PHP5. A (rather poor) Example: interface BoardMember { function position(); // used to set board position of board member } interface Employee { function position(); // used to set job title of employee } class BusyBoardMember implements Employee, BoardMember { function position(); // what does this function do? ambiguous unless I am missing something } In Visual Basic, for instance, this is handled using the implements keyword, so the function definitions within BusyBoardMember would look like: function position() implements Employee.position() function position() implements BoardMember.position() Then when you do something like function operatesOnEmployee(Employee $e) { $e-position(CEO) } or function operatesOnBoardMember(BoardMember $b) { $b-position(Chairman) } The right thing can happen, as the compiler/parser knows which position() you're referring to in each case. Hopefully this is the right list to be posting this, and hopefully I'm completely wrong and have missed something while reading about PHP5 :) -Javier
[PHP] Issues with fopen long file names?
I'm trying to open a file using php 4.1.0 under windows 2k server. The script uses fopen and the filename is long (approx 40 characters + extension). I'm getting the error: Warning: fopen(c:\_file_345176fo90301b70374d2f30e5a11d5b.ext , r) - Invalid argument in file.php on line 127 can fopen not handle long file names, or am I doing something wrong? The script uses \\ not \, so that's not the problem (even though only one \) is displayed above. if fopen can't display long file names, is there a function that will return the short (i.e. _file_~1.ext) format? any help is appreciated. Javier Muniz Granicus, LTD. (www.granicus.com) Tel: (415) 522-5216 Fax: (415) 522-5215 -- 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] PHP + MySQL problem (strange behavior)
Unfortunately, mysql returns no error string. MySQL doesn't appear to think it's an error, as it does apply changes to the row I'm trying to change, it simple isn't applying the CORRECT change to said row :) -Javier -Original Message- From: David Robley [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 05, 2001 4:59 PM To: Javier Muniz; '[EMAIL PROTECTED]' Subject: Re: [PHP] PHP + MySQL problem (strange behavior) On Thu, 6 Dec 2001 08:32, Javier Muniz wrote: Hello, I'm having trouble determining what's going wrong with a MySQL query that I'm doing from PHP. Now before you go blaming MySQL read on :) I have a table with the following columns: id (int) name (varchar 20) starttime (int) duration (int) now, i have a row that has a starttime of 60, when i attempt to do the following update with PHP, it sets it to 0: UPDATE mytable SET starttime=starttime-30 WHERE name = 'myname' but when I run it from the MySQL command line, copy/pasted from the code, it sets the value of starttime to 30 as expected. Anyone have any clue why this is? mysql_error() is a good debugging tool; it will return an error string that may be useful. -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA A waist is a terrible thing to mind. -- 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] PHP + MySQL problem (strange behavior)
Hello, I'm having trouble determining what's going wrong with a MySQL query that I'm doing from PHP. Now before you go blaming MySQL read on :) I have a table with the following columns: id (int) name (varchar 20) starttime (int) duration (int) now, i have a row that has a starttime of 60, when i attempt to do the following update with PHP, it sets it to 0: UPDATE mytable SET starttime=starttime-30 WHERE name = 'myname' but when I run it from the MySQL command line, copy/pasted from the code, it sets the value of starttime to 30 as expected. Anyone have any clue why this is? Javier Muniz Chief Technology Officer Granicus, LTD. Tel: (415) 522-5216 Fax: (415) 522-5215 -- 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] Problem with timeouts
I've written a PHP script that's used internally by an application backend. It transfers files via FTP from one server to another. This process often takes in excess of 1hr. My problem is that for some reason, even though i've set the max_execution_time in the php.ini is set to 10800 (3 hours) the script gets CGI Application Timeout: The specified CGI application exceeded the allowed time for processing. The server has deleted the process. after 5 minutes of execution. I'm running PHP 4.04pl1 under IIS 4.0. Any help is greatly appreciated. Thanks, -Javier -- 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] Giving my script the power!
I do a similar thing on my machines, only instead of having a java daemon that runs as root I chose to create a database that the php script can insert user and other information into, then a perl script that is called from cron that fetches from the database and does the necessary user adds. This is a nice system for adding users to many systems at once for a network that is not running NIS, as all of the linux machines on my network can fetch data from the database and add the users as necessary. I don't, however, trust the security of this implementation, and only use it on our internal network that sits behind a firewall. I'd recommend that you take the same precaution. -jm -Original Message- From: Sebastien Roy [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 29, 2001 1:28 PM To: Brandon Orther Cc: PHP User Group Subject: Re: [PHP] Giving my script the power! Hi, I'm doing the exact same thing as you and I got the exact same problem. After getting almost crazy with trying everything possible to run a script as root, someone told me that I'm limited to the server permission. So I decided to simply create a java deamon wich run as root. This deamon wait on a port for commands (encrypted) to be executed.via fsockopen(...). Surprisly, it was easy and it work prety well... Hope it helps Sebastien Roy [EMAIL PROTECTED] Brandon Orther wrote: Hello, I am trying to make a script that can add users and multiple things to a linux box. I have all teh programming issues solved except I need to make this script root, or make it able to run anyhting it want to. Is there a way to make my php script liek a super user? INFO: Redhat 7 Apache1.? Thanks Brandon Orther -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Script to convert # of seconds to HH:mm
should probably be: function philtime($time) { $hours = ($time - ($time % 3600)) / 3600; $min = (int) (($time % 3600) / 60); return ("$hours:$min"); } This way you don't risk rounding up on your first cast to int and being off by an hour... rounding is ok, however, for minutes since that is your most granular interval. -jm -Original Message- From: Phillip Bow [mailto:[EMAIL PROTECTED]] Sent: Monday, March 19, 2001 2:43 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Script to convert # of seconds to HH:mm function philtime($time){ $hours = (int) ($time / 3600); $min = (int) (($time % 3600) / 60 ); return ("$hours:$min"); } Should be 3600 since: 60sec = 1min 60min = 1hour 60 * 60 = 3600sec/hour -- phill How about something like this: $secs = number of seconds; $hours = intval($secs/360); $minutes = intval(($secs-$hours*360)/60) $seconds = $secs - $hours*360 - $minutes * 60; Hope this helps. Michael Ridinger -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Passing values containing a ? and a
URLs must be encoded if they contain special characters (and should be encoded always). See urlencode(). -jm -Original Message- From: Tom Harris [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 22, 2001 11:12 AM To: [EMAIL PROTECTED] Subject: [PHP] Passing values containing a ? and a I want to assign a value using the url however the value contains both a ? and an so PHP (or the browser) seems to get confused. Here's an example: http://www.mysite.com/index.php?id=23url=http://www.anothersite.com/file.ph p?qid=234forum=4 Everything after url= should be the value of $url but this is not the case. Is there a way to solve this? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP 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] security
Encode them, or set filesystem permissions in such a way (suggest using groups) to allow apache to read files but not other users. For instance, if your users are all members of the users group, and apache runs as nobody, then set your files to be owned by the user with the nobody group (chown user:nobody file) then set it to be readable by group, but not others (chmod 640 file). -jm -Original Message- From: Gustavo Vieira Goncalves Coelho Rios [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 21, 2001 9:15 PM To: [EMAIL PROTECTED] Subject: [PHP] security How may i prevent my users from reading others php scripts? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Arrays -- How do I insert a pair of data into an array
Try: echo $array[$i][course_num] . ' ' . $array[$i][course_title]; -jm -Original Message- From: Scott Walter [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 22, 2001 1:59 PM To: [EMAIL PROTECTED] Subject: [PHP] Arrays -- How do I insert a pair of data into an array I am attempting to insert a set of data (actually a pair) into an array, without much success. I would like to insert the data set ("course number", "course title") into a numerically indexed array so that when I want to output the array I can reference it like so: echo("$array[$i]["course_num"] $array[$i]["course_title"]"); // where $i is just the index value that increments I tried building the array like so (where $tuple[] is a valid result set from pg_fetch_row(): $array[] = array("course_num" = $tuple[crn], "course_title" = $tuple[course_name]); But all I gets outputted is: Array["course_num"] Array["course_title"] Any help with this would be greatly appreciated. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP 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] MySQL COUNT Won't Work
Nope, with php the second argument of mysql_query is indeed the connection identifier. What happens when you run the query via the mysql client? -jm -Original Message- From: Jon Haworth [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 9:32 AM To: '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]' Subject: RE: [PHP] MySQL COUNT Won't Work Shouldn't that be $result = mysql_query($sql,$db) or die("Couldn't execute query."); So you're querying the database, and not the connection? HTH Jon -Original Message- From: Jeff Oien [mailto:[EMAIL PROTECTED]] Sent: 16 February 2001 17:27 To: PHP Subject: [PHP] MySQL COUNT Won't Work I'm totally stuck on this code. I get the error "Couldn't execute query." so I know where it's failing but can't figure out what's wrong. I have a database with 'title' as one of the fields. Based on code in PHP Fast and Easy. Jeff Oien ?php $db_name = "Music"; $table_name = "music"; $connection = mysql_connect("localhost", "", "") or die("Couldn't connect."); $db = mysql_select_db($db_name, $connection) or die("Couldn't select database."); $sql = "SELECT COUNT (title) FROM music"; $result = mysql_query($sql,$connection) or die("Couldn't execute query."); //error from here $count = mysql_result($result,0,"count(title)"); echo "$count"; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] MySQL COUNT Won't Work
Are you using 3.23.33? If so try removing the space between the COUNT and the open paren. It looks like there may be a bug in the latest release (seeing this problem on the mysql list for MAX, probably exists for COUNT as well). -jm -Original Message- From: Jeff Oien [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 9:37 AM To: PHP Subject: RE: [PHP] MySQL COUNT Won't Work That's not it. Get: Warning: Supplied argument is not a valid MySQL-Link resource in count.php3 on line 14 Jeff Oien Shouldn't that be $result = mysql_query($sql,$db) or die("Couldn't execute query."); So you're querying the database, and not the connection? HTH Jon -Original Message- From: Jeff Oien [mailto:[EMAIL PROTECTED]] Sent: 16 February 2001 17:27 To: PHP Subject: [PHP] MySQL COUNT Won't Work I'm totally stuck on this code. I get the error "Couldn't execute query." so I know where it's failing but can't figure out what's wrong. I have a database with 'title' as one of the fields. Based on code in PHP Fast and Easy. Jeff Oien ?php $db_name = "Music"; $table_name = "music"; $connection = mysql_connect("localhost", "", "") or die("Couldn't connect."); $db = mysql_select_db($db_name, $connection) or die("Couldn't select database."); $sql = "SELECT COUNT (title) FROM music"; $result = mysql_query($sql,$connection) or die("Couldn't execute query."); //error from here $count = mysql_result($result,0,"count(title)"); echo "$count"; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- 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] MySQL COUNT Won't Work
You should use fieldnames in your selects... I'd imagine count(*) would be slower just as select * is slower. -jm -Original Message- From: Joe Sheble (Wizaerd) [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 9:46 AM To: PHP Subject: RE: [PHP] MySQL COUNT Won't Work I do lots and lots of count()'s in PHP and have never had any problems... of course, I do it a bit differently than you did.. // I always have these in a top level include $UserName = "noneYa"; $Password = "yeahRight"; $myDatabase = "uhhuh"; $dbConn = mysql_connect( "localhost", $UserName, $Password ) or die( "Cannot Connect To Database Server" ); mysql_select_db( $myDatabase ) or die( "Unable To Connect To Database: " . $myDatabase ); // up to here // then I always make sure the file is included at the top of my page, and then call this query like this... $qQuery = "SELECT Count(*) as nTotal FROM someDB"; $rQuery = mysql_query( $qQuery, $dbConn ); $qrQuery = mysql_fetch_array( $rQuery ); print( $qrQuery["nTotal"] ); At 11:37 AM 2/16/01 -0600, Jeff Oien wrote: That's not it. Get: Warning: Supplied argument is not a valid MySQL-Link resource in count.php3 on line 14 Jeff Oien Shouldn't that be $result = mysql_query($sql,$db) or die("Couldn't execute query."); So you're querying the database, and not the connection? HTH Jon -Original Message- From: Jeff Oien [mailto:[EMAIL PROTECTED]] Sent: 16 February 2001 17:27 To: PHP Subject: [PHP] MySQL COUNT Won't Work I'm totally stuck on this code. I get the error "Couldn't execute query." so I know where it's failing but can't figure out what's wrong. I have a database with 'title' as one of the fields. Based on code in PHP Fast and Easy. Jeff Oien ?php $db_name = "Music"; $table_name = "music"; $connection = mysql_connect("localhost", "", "") or die("Couldn't connect."); $db = mysql_select_db($db_name, $connection) or die("Couldn't select database."); $sql = "SELECT COUNT (title) FROM music"; $result = mysql_query($sql,$connection) or die("Couldn't execute query."); //error from here $count = mysql_result($result,0,"count(title)"); echo "$count"; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Finding the? in $REQUEST_URI?page=blah
An exceptionally easy way to do this would be to pass both $PHP_SELF and $REQUEST_URI. Alternatively, you can use explode(): ?php $array = explode('?',$REQUEST_URI); ? form method="post" action=?php echo $array[0] ?" Username: input type="text" name="username"r etc/form -Original Message- From: James, Yz [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 2:57 PM To: [EMAIL PROTECTED] Subject: [PHP] Finding the? in $REQUEST_URI?page=blah I really wouldn't ask this if I wasn't completely exausted, but the last thing I feel like doing just now is reading up on this when someone can probably answer it in a matter of seconds. OK, I've an error handling page. Basically, I want to split (that might even be one of the functions I'll have to use) this sort of url: error.php?/pages/login.php?username=name into: /pages/login.php I'm using : header("location: error.php?page=$REQUEST_URI"); When echoing the request_uri back on the error page, it omits the error.php? bit, so I get: login.php?username=name The reason I want to do this is so that I can use a re-login form that will submit to the page the user has badly logged into, so if they logged in to main.php, the request_uri would be something like: /pages/main.php?username=name Which I'd want to rebuild on the error page, into a form, like: form method="post" action=? echo "$REQUEST_URI"; /* Minus the suffix the page may include */ ?" Username: input type="text" name="username"r etc/form Can anyone help? Thankees :) James. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] php site, parse error
Looks like the PHP site is down, parse error on site.inc... just an FYI :) -- 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] php site, parse error
Definately a bit frightening that a virtually static site has an include that is over 300 lines long :) Maybe just well documented? -jm -Original Message- From: Martin A. Marques [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 15, 2001 12:40 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] php site, parse error El Jue 15 Feb 2001 17:41, escribiste: Looks like the PHP site is down, parse error on site.inc... just an FYI :) Ohhh, I'd love to get me hands on some of the code these great guys do. :-) Saludos... :-) -- System Administration: It's a dirty job, but someone told I had to do it. - Martn Marqus email: [EMAIL PROTECTED] Santa Fe - Argentinahttp://math.unl.edu.ar/~martin/ Administrador de sistemas en math.unl.edu.ar - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Passing files to a browser
Actually, if you read the manual entry for fpassthru, it states that the filehandle will be closed by fpassthru upon reading. So you're trying to close your filehandle twice... get rid of the fclose($fp) at the end and you should be fine. -jm -Original Message- From: Christian Reiniger [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 08, 2001 11:19 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Passing files to a browser On Thursday 08 February 2001 18:43, Rob Root wrote: ?php $fp = fopen("test.txt", "r"); header("content-type: text/plain"); fpassthru($fp); fclose($fp); ? And got: Hello, World br bWarning/b: 1 is not a valid File-Handle resource in b/home/robr/public_html/php/getpdf.php/b on line b5/bbr That most likely means the fopen () failed. -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) This is JohnC IMHO, I compaired tri-word groupings here and in his plan and got a good match. - /. posting discussing the likelihood that an AC post that claimed to be posted by John Carmack during his honeymoon (and having the login info at home) was actually from him. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] XSLT problems....
In my experience this is caused by an error in your .xsl... not exactly the most verbose error so I don't know what's actually happening here. -jm -Original Message- From: Chris Lee [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 06, 2001 5:34 PM To: [EMAIL PROTECTED] Subject: [PHP] XSLT problems test.xml results match count1/count name:PHatCat/name linkhttp://freshmeat.net/projects/phatcat//link descriptionA PHP CueCat Decoder./description dateOct 9th 2000/date categoryWeb/Applications/category licenseGPL/license /match match count2/count nameAbout Me/name linkhttp://freshmeat.net/projects/aboutme//link descriptionA system for recording/sharing preferences/description dateApr 18th 2000/date categoryWeb/Tools/category licenseGPL/license /match /results test.xsl ?xml version="1.0" encoding="utf-8"? xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:output method="html" indent="yes" encoding="utf-8" / xsl:template match="/results" htmlheadtitleXSLT Freshmeat Demo/title/head body bgcolor="#FF" table xsl:call-template name="matches"/ /table /body/html /xsl:template xsl:template name="matches" xsl:for-each select="match" tr tdxsl:value-of select="count"//td tda href="{link}"xsl:value-of select="name"//a/td tdxsl:value-of select="description"//td tdxsl:value-of select="date"//td tdxsl:value-of select="license"//td /tr /xsl:for-each /xsl:template /xsl:stylesheet test.php ?php $parser = xslt_create(); xslt_run($parser, './test.xsl', './test.xml'); echo xslt_fetch_result($parser); xslt_free($parser); ? Fatal error: msgtype: error in /home/httpd/vhosts/mediawaveonline/test/xslt.php on line 4 I am *very* new to both xml and xsl but this interests me greatly, please help if you could. -- Chris Lee Mediawaveonline.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Session problem?
I am using the following function to add a serialized object to a session: function add_toCart($id,$array) { session_register("OBJECT"); $c = new Configurator; $c-readConfig($id); $OBJECT = serialize($c); header("Location: Cart.php"); echo "Redirecting..." } Unfortunately, the session file (in /tmp) is always empty after this function executes. I'm using PHP 4.0.4 with --enable-trans-sid. Any help is greatly appreciated. Cheers, -jm -- 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] Session problem? (Correction)
The session file is not empty :) the OBJECT portion of the session file is empty. i.e. cat'ing /tmp/sess_whatever yields: !OBJECT| -jm -Original Message- From: Javier Muniz [mailto:[EMAIL PROTECTED]] Sent: Friday, January 19, 2001 3:57 PM To: '[EMAIL PROTECTED]' Subject: [PHP] Session problem? I am using the following function to add a serialized object to a session: function add_toCart($id,$array) { session_register("OBJECT"); $c = new Configurator; $c-readConfig($id); $OBJECT = serialize($c); header("Location: Cart.php"); echo "Redirecting..." } Unfortunately, the session file (in /tmp) is always empty after this function executes. I'm using PHP 4.0.4 with --enable-trans-sid. Any help is greatly appreciated. Cheers, -jm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Levels of Access
Just a side note: A very nice way to do this is using bitwise operators to store all your access information into one int This is handy for saving space in databases, and bitwise operations should be incredibly fast compared to string comparisons. Cheers, Javier -Original Message- From: Ignacio Vazquez-Abrams [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 17, 2001 2:43 PM To: Abe Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Levels of Access On Wed, 17 Jan 2001, Abe wrote: Hey Guys, I wonder if anyone can shed light... I have a system that internal users access - I have separated access levels into 1, 2, 3 etc. So if you have access 1 you can view certain things - If you are 2 then you can view more or other things. However the problem arises when someone in access level 1 wants to access a level 2 function. I then manually specify that: if (access = 2 or user=joe) { Allow the functions ... } This can get messy - as individuals will be specified all over the place on a large system to override levels of access. Is there a sensible standard that is used to have levels of access but special people can access certain higher level functions.? I hope that makes sense. Thanks Instead of having individual users specified at certain points, why don't you say that a user has to be a member of a certain group? That way in order to open an access lock for a user, all you have to do is add them to the group. You could even make the security levels groups themselves. -- Ignacio Vazquez-Abrams [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] session vars with recursive form
This is probably due to the fact that form values don't override session values... this is a feature, not a bug. (imagine if i could do: http://www.yourdomain.com/highsecurity.php?user=admin and magically become admin... very broken security) -jm -Original Message- From: bill [mailto:[EMAIL PROTECTED]] Sent: Friday, January 12, 2001 11:25 AM To: [EMAIL PROTECTED] Subject: [PHP] session vars with recursive form How can I correctly register session vars on a recursive form? If I call a page repeatedly using: FORM ACTION="?php echo $PHP_SELF ?" METHOD="POST" The earlier variables keep getting lost. How can I register the session variables correctly? Each subsequent page should set its own variable while remembering all those previously set. Right now the top of the page says: --- session_start(); $thevals=array(alpha,beta,gamma,delta,epsilon); while (list($key, $val) = each($thevals)) { if (!session_is_registered($val) ) { session_register("$val"); } } -- thanks, bill -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]