Re: [PHP] Debugging Help Needed
On Wed, 13 Apr 2011, Daniel Brown wrote: I believe he meant that it's been too long since he used C (which uses semicolons) and that Python, which he used more recently, doesn't use semicolons (which always trips me up whenever I have to patch Python code). Thank you, Daniel. Inserting a call to debug_print_traceback() (with a terminating semi-colon) at the top of the ErrorHandler404() function produces no visible output (and nothing in the application directory or in ~/). Will someone suggest either how I properly use debug_print_traceback() or otherwise learn what's failing as I try to invoke the application and transferring control to the error handler? There has to be something either in the index.php, or a function it's calling, that cannot find the opening display. I need to learn what's happening so I can get this application running here. Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Debugging Help Needed
On Tue, 12 Apr 2011, Daniel Brown wrote: You missed the ending semicolon, that's all. Daniel, Oops! Too long since C and Python doesn't use semicolons. Adding that, I remove the error but do not see the printed backtrace. Please suggest how I can determine the source of the page not found error, or how to capture output from debug_print_backtrace. Thanks, Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Debugging Help Needed
I'm not a PHP coder, but I have an application written in PHP (CMS Made Simple) that stopped working when I upgraded postgres to 9.x. I seem to have most of the problems fixed (those with adodb_lite) but now need to track down why I get a "404 Page Not Found" error when I try to invoke the local application. BTW, I'm running php-5.2.17 on Slackware-13.1. Running 'php index.php' from the application subdirectory to the document root directory, I learn the code to search in the directory structure. It turns out to be misc.functions.php, and the specific function in that file is ErrorHandler404(). However, I have not been able to trace execution to learn just where this function is being called. Looking at the PHP manual I see there's a function called debug_print_backtrace(), but I have not found how to properly use it. When I insert it at the top of ErrorHandler404(), php throws an error when I try to run index.php: function ErrorHandler404() { debug_print_backtrace() #if ($errno == E_USER_WARNING) { @ob_end_clean(); header("HTTP/1.0 404 Not Found"); header("Status: 404 Not Found"); echo ' 404 Not Found produces: PHP Parse error: syntax error, unexpected '@' in /var/www/htdocs/cmsms/lib/misc.functions.php on line 223 How can I determine where ErrorHandler404() is being called so I can fix the problem and get the application running again? Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] System log in problems
Hi All Let me start by saying I am not 100% sure this is the correct board to post this to. I hope it is because as i have watched this list it contains some very helpful people. I have search for an answer to this and cannot seem to find it. We have a subscription based site that is developed mainly with php and mysql. We have one person who each time he attempts to log in it just rolls back to the login page. With almost 2000 users this is the only time we have come across this problem. He is not running your average system at his home the details are. Operating system is Ubuntu 7.04 released in April 2007 also using Firefox Version 2.0.03 Mozilla/5.0 (x11; U; Linusi686; en-US;rv:1.8.13) Gecko/200611201 Firefox/ 2.0.0.3 (Ubuntu-feisty) I can login using firefox and ie no problem but am running a more common windows system. Is there something on our end that could be causing this problem for him? Thanks in advance Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Eclipse on Linux
Try setting JAVA_HOME then starting Eclipse. I got a similar error because it was trying to load Java from the wrong directory. Rich Quoting Bagus Nugroho <[EMAIL PROTECTED]>: Hi All, When I'm trying to use eclipse on Linux, using command "java -startup.jar", it was show an error like this "Could not create Java Virtual Machine" Is my command wrong. Java already installed and eclipse was put on /opt Thanks in advance bn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] str_replace on words with an array
Paul Novitski wrote: If you go this route, perhaps you could enclose each member of your original array in \b word boundary sequences using an array_walk routine so that you don't have to muddy your original array declaration statement. IIRC str_replace() does not interpret or understand regular expression syntax - you'd need preg_replace() for that rich
Re: [PHP] PHP Frameworks - Opinion
Robert Cummings wrote: [chop] An IDE is not a framework, it's an IDE :) Cheers, Rob. I think Rob is being unduly modest - correct me if I am wrong but he is the core developer of the InterJinn php framework -> http://interjinn.com - it's been out there for a while now (read: robust, fully featured) and the ZF is still in beta I think... cheers rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] looking for shopping cart
Try Zen cart http://www.zen-cart.com/modules/frontpage/ it is a fork of osCommerce which is a very popular OS cart. I've used it and customised it on a few sites without problems. Cheers Rich Lisa A wrote: I'm still looking for an inexpensive shopping cart to use on my client's website. Something they can easily update their products, prices, photos, etc once I set it up for them. It must be very simple for them to use. Anyone write any shopping cart scripts that might work? thanks, Lisa A -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to kill session id without closing the window?
[chop] How can I create new, other sesssion id (after I, for example, click on 'Log Out' button) without closing window? Thanks for any help. er .. session_regenerate_id() hth rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Like ternary but without the else.
I couldn't find this anywhere on google or PHP's site but I'm pretty sure there's an answer to it. How can I turn the following into something that resembles the ternary operator? is this what you're after? $this = ($something ? $that : $this) rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array concatenation behaviour change
> > Can't you sort the array? > > > Yes of course but that wasn't the point of my post I was trying to show that the same code produces differing results on 2 different versions of PHP ... rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Array concatenation behaviour change
Just a heads up on this change in array concatenation behaviour that could cause a few probs for some people... 'Zero'); $arr2 = array(1 => 'One',2 => 'Two'); $arr2 = $arr1 + $arr2; echo phpversion().''; print_r($arr2); ?> this code produces on our provider's server... 4.2.3 Array ( [0] => Zero [1] => One [2] => Two ) and on my development server... 4.3.8 Array ( [1] => One [2] => Two [0] => Zero ) hth rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mysql fetch_row()
> when I call mysql_fetch_row() I get an array, but this Array doesn't have > the fieldnames as array-keys. > I've seen several codes from others where they use something like > > print $row['key']; > > This doesn't work on my server. Is this because my server-software is too > old or am I using the wrong function? ...the wrong function - use mysql_fetch_assoc() rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] count number of occurences of character in a string
> > what function can I use to count the number of occurences of a certain > character in a string? substr_count() ...? rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] executing php scripts via cron
> I am trying to run a php script via cron. Problem is, that it > does not work if I > include the whole path in crontab > > Currently it looks like: > 0 6 * * * php > /home/www/project/app_cron/follow_up_new_members.php > /dev/null > > Most likeley because the webserver root for the project is: > /home/www/project/ > > So if I go into this dir and execute: > php app_cron/follow_up_new_members.php > > it workes. But not with the full path. What do I have to enter > into crontab? It > obviosly does not work with the full path, but how to change into > the directory > via cron first? It is probably because the cron daemon cannot find the php binary in its path try it like this... > 0 6 * * * /full/path/to/php/binary/php /home/www/project/app_cron/follow_up_new_members.php > /dev/null hth rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Sessions on Windows
> How does one get sessions working on Windows? I have modified my php.ini > file so that session.save_path = C:\Temp, restarted and Apache. > Still I get > this error message: > > Warning: session_start(): open(/tmp\sess_26310affee160329c9e50f27663f8971, > O_RDWR) failed: No such file or directory (2) in > c:\apache\htdocs\dbmdata\admin\61646d696e.php on line 2 > check you have edited the correct php.ini -- run and check where the ini file is to make sure you changed the correct one... hth rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] http username
> If a user is logged in via http (authentification e.g. with .htaccess and > .htpasswd file), how can i get the username of the current logged in user? > > Thanx > Harry try $_SERVER['PHP_AUTH_USER'] rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] passing the file back
> Hi all > In the CMS package mambo , there is an option to backup a database etc. > Which I can do etc, but what I would like to know, is of a way to pass the > .sql file, or what ever was selected, to be passed back to the user > > Im looking in the source, but my OO skills is very much lagging. > I basically want a file to be passed back to me, via a web front end > > Kind Regards > Brent Clark not sure what you're after here as mambo gives you an option to download the file to the local computer when you selct backup database... do you not see that option? rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] JavaScript Enabled?
> Can anyone suggest a suitable means for detecting if a client browser > has JavaScript enabled or not? > > I know this isn't exactly PHP related, but I need to make sure my PHP > script offers an alternative in a friendly way and not a JS error, but > I just wondered if there was a foolproof method of doing this? Er ... how do you generate a JS error with a JS disabled browser? I don't think there is a 100% reliable way of detecting server side whether a client browser has disabled javascript. However what you could do is to use a block to spit out javascript enabled code using document.write() which will be ignored by disabled clients and then use tags to enclose whatever stuff is necessary for the disabled clients? Just a thought Cheers Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Alternatives to Flush()
> I do have a database and have considered using it in conjunction with > cron. However, I don't like the disconnected nature of the solution. > There could be up to a minute delay before cron picks up the request. > > There's got to be another method similar to using flush(), that causes > the lengthy processing to immediately start as well as redirecting the > visitor to another page. Hi Ron Well if it is really critical that the batch job runs within seconds of being requested by the web process then you have several alternatives apart from using database/cron ... here's a few examples with various levels of simplicity of implementation... . Kick off a cli script to run the batch job using exec() or similar.. . Implement a web service using XML-RPC or SOAP - i.e. call an API on the XML-RPC/SOAP server and let it do its stuff... . Have a custom background script listening on a socket - send a request to that socket from your web page... . IPC through shared memory... . probably loads more... Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] seesions problem
> Notice: Undefined index: user_id in > /home/pance/public_html/menu.php on line > 13 > > Has anybody else come accross this problem - and how did you solve it? > > Pance Stojkovski are you using session_start() at start of each page that manipulates $_SESSION ? rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Uploading Files
>if($userfile) { > copy($userfile, '/home/sites/site176/web/makeit/$userfile_name'); > echo "Successfully Added!\n"; > } > ?> > > File to Upload: > > Hi Tom Here's some quick comments.. . You need enctype="multipart/form-data" on your form for file uploads . Watch out for max file size being exceeded -- check the php manual on 'Handling file uploads' . If register_globals is off on your server you'd better start looking at using the $_FILES superglobal (check the manual) . use move_uploaded_file(...) rather than copy(...) HTH Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Best way to increment an integer column in mysql
> I was wondering if there is a php / mysql function call that will > increment an integer column in a database. > ie. the equivalent to > $foo++; > Hi John Well you can specify the column as auto_increment to let MySQL handle the incrementation else I suppose - mysql_query('update mytable set my_int_column = my_int_column + 1 where blah blah ...'); HTH Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP's MySQL Query Length Limit? (Long SQL failing!)
> I have a script that accepts large files (images) and inserts them into > a MySQL table. The images are manipulated and whatnot, no problems at > all getting the image into a string and running addslashes() on it. > Then I go and use it with a mysql query. This is something I've coded > dozens of times, but now there's a twist. The files are bigger than > I've ever worked with. In theory, I didn't think there would be a > problem, but there is. When I try in insert a file of about 800K or > larger (9-10 MB is as large as I ever try to insert) the insert fails. > The query is written correctly AKAIK, but no data reaches the table I'm > writing to. > [chop] Hi Galen I'd hazard a guess that it is probably your MySQL server settings that are cause of the problem - in particular check the max_allowed_packet_size (?? - you'll probably need to check this name as I haven't any docs to hand at the moment) setting in your my.ini file... HTH Cheers Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Problem using substr() and strpos() functions
Oh, sorry I've worked it out! The bug was on a different part of the line! Cheers, Richard -- UEA/MUS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem using substr() and strpos() functions
Hello List, I'm trying to extract the sub-string from a string which appears between a pair of brackets, e.g. from "Mozart Requiem (15)" I want to extract the string "15" I tried this: substr($s, (strpos($s, "(") + 1), (strpos($s, ")") - strpos($s, "(") - 1)) but it returned the error: "Parse error: parse error, unexpected T_STRING in /.../loan-edit.php on line 15" What have done wrong? Thanks in advance, Richard -- UEA/MUS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Calling PHP functions from within javascript
> First thing is, it's possible, i've done it in the past myself, it's just > not working due to some reason. Second, functioning cann't be > achieved with > javascript, cauz it's DB related. > > anyway thanx for ur reply > Nitin > Hi Nitin If you mean exchanging data between PHP and javascript without incurring a page reload ... well it is definitely possible using javascript remote scripting techniques and a hidden iframe however if the browser has javascript switched off then this won't work of course... Cheers Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Persisting MySQL connection accross scripts
How can I establish a connection with a MySQL database and have it persist accross multiple script files? I've found the mysql_pconnect() function but this doesn't seem to do the job - which is fairly logical actually because the connection is stored in a variable: $connect = mysql_pconnect(); and that variable $connection won't be available in another script. I would have thought there would be a straightforward answer to this as it seems that its someting which must be done fairly regularly. The only workaround I can think of is sending the username, password and database name to every script. But how would you do this securely? When establishing the initial connection I got the username and password from a form which used the method="POST" method. But if I want to have a link to a script, say 'add_item.php', how can I do it securely? would not use the POST method. I could use forms for every link but this seems ridiculously over-complicated! Thanks in advance for any pointers! Richard. -- UEA/MUS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP with Frames (cont.)
No, he's right - this is an issue. Do variables persist between PHP files? In the attached scripts I have a login page which directs the user, on a sucessful login, to a front page which is a frameset. The login.php opens a connection to a MySQL database ($connection) but once the browser has been re-directed to the frame-root.html page this variable is no longer available. Kb wrote: > Hi, > > Does anyone know why my PHP pages won't work in Frames? I have 5 frames, > each of which are displaying PHP pages.and none of the PHP code works. > > If I run the code outside of Frames it works fine! > > I've can't find any decent references for PHP in Frames. > > Your help would be appreciated. > > Thanks > > Kevin -- UEA/MUS::Record Library -- UEA/MUS::Record Library -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Using two XSLT stylesheets
Aha! I've worked out a (better?) way of doing: $keywords); $library_xml_file = "library.xml"; $search_xsl_file = "simple-search.xsl"; $display_xsl_file = "display-results.xsl"; $library_xml_string = join('', file($library_xml_file)); $search_xsl_string = join('', file($search_xsl_file)); $display_xsl_string = join('', file($display_xsl_file)); $arg_buffer = array("/xml" => $library_xml_string, "/xslt" => $search_xsl_string); $xh = xslt_create(); $results_xml_string = xslt_process($xh, "arg:/xml", "arg:/xslt", NULL, $arg_buffer, $params); xslt_free($xh); $arg_buffer = array("/xml" => $results_xml_string, "/xslt" => $display_xsl_string); $xh = xslt_create(); $results_html_string = xslt_process($xh, "arg:/xml", "arg:/xslt", NULL, $arg_buffer); echo $results_html_string; xslt_free($xh); ?> Thanks for all your suggestions! -- Rich. UEA/MUS::Record Library -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Using two XSLT stylesheets
OK, This is my latest idea to try and do this: $xh = xslt_create(); parse_str($_SERVER['QUERY_STRING']); $params = array("keywords" => $keywords); $results = xslt_process($xh, 'library.xml', 'simple-search.xsl', NULL, NULL, -->$params); $f = fopen('results.xml','w'); fwrite($f, $results); fclose($f); $data = xslt_process($xh, 'results.xml', 'display-results.xsl', NULL, NULL, -->NULL); echo $data; xslt_free($xh); But, of course, it just throws up messages saying I can't write to results.xml! See http://www.cursus.uea.ac.uk/cdlib/ for error messages in action (search terms which will find records include 'Boulez', 'Messiaen'). Does anyone know why: xslt_process($xh, 'sample.xml', 'sample.xsl', 'result.xml') doesn't work? (lifted straight from the manual) Cheers, Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using two XSLT stylesheets
Ray Hunter wrote: > >> xslt_process($xh, 'library.xml', 'simple-search-get-results.xsl', >> --> 'results.xml', NULL, $params); >> $data = xslt_process($xh, 'results.xml', >> --> 'simple-search-display-results.xsl', NULL, NULL, NULL); > > > What happens when you do the above...what is the var_dump of data? > > -- > BigDog I get this: Warning: Sablotron error on line 1001: cannot open file '/var/www/html/cdlib/search/results.xml' in /var/www/html/cdlib/search/simple-search.php on line 24 string(591) " " line 24 is the first call to xslt_process() above. But I'd never tried using var_dump($data) before. It appears the the second call is working fine: the file 'results.xml' exists already becasue I've been using a command line XSL processor to test the stylesheets. The second call to xslt_process() appears to have read and processed the data which was in that file correctly because var_dump() has inserted the result into the HTML following the error message. -- Richard UEA/MUS::Record Library -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using two XSLT stylesheets
I'm working on a read only database. I have the data encoded as XML and am writing the queries using XSLT stylesheets. The only way I can find (being, of course, restricted to XSLT 1.0 on PHP) of executing the required queries requires two stylesheets. The generates a result tree which needs to be proceesed by the second. But I can't find a way of doing this. I've tried: xslt_process($xh, 'library.xml', 'simple-search-get-results.xsl', --> 'results.xml', NULL, $params); $data = xslt_process($xh, 'results.xml', --> 'simple-search-display-results.xsl', NULL, NULL, NULL); and: $results = xslt_process($xh, 'library.xml', 'simple-search-get-results.xsl', --> NULL, NULL, $params); $data = xslt_process($xh, $results, 'simple-search-display-results.xsl', --> NULL, NULL, NULL); neither of which work at all. Any ideas? Cheers, rich. -- UEA/MUS::Record Library http://www.cursus.uea.ac.uk/cdlib/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Use include function (newbie)
But *why* does logic.php need html.php? There is no recursion issue, or endless nesting of includes, because html.php refers to logic.php as an action for a form... this does not "include" the logic.php code into the html.php page. Rich "Karina S" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I make a site where I list data from a mysql database. I want to divide the > task into 2 parts. The 1. php is the logic.php an the 2. is the html table > (html.php) with field values. > I plan that the form action in the html.php file call the logic.php but the > logic.php includes the html.php. > > I mean: > html.php > > ... > > logic.php > ... > include('html.php'); > > On the html.php user can view data and use last, first, next,... buttons to > see the whole table. > > Question: > Is it a right way to do this task or this reqursive calls overloads the > server? > > Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Shouldn't script errors show in my browser?
Yeah, that did it, thanks "David Otton" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Fri, 17 Oct 2003 11:29:41 -0400, you wrote: > > >I hope this question is not too stupid! When I have an error in my script, > >it seems to me that the web server, or in my case the php CGI module I am > >using for testing, should send something back to my browser displaying an > >error message. Instead, I can write any garbage I would like in my php > >script and the browser just shows me a blank page. Is this because I am > >running php as a CGI module? > > Try cranking your error reporting level up in php.ini > > http://uk2.php.net/manual/en/ref.errorfunc.php#ini.error-reporting > > Check the display_errors directive while you're at it. Don't forget to > restart the webserver. > > Also, sometimes errors don't show because they're embedded in HTML. > > Eg > > > > would return > > > > And you'll have to examine the un-parsed HTML to find the error. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Shouldn't script errors show in my browser?
I hope this question is not too stupid! When I have an error in my script, it seems to me that the web server, or in my case the php CGI module I am using for testing, should send something back to my browser displaying an error message. Instead, I can write any garbage I would like in my php script and the browser just shows me a blank page. Is this because I am running php as a CGI module? Thanks, Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Nested queries don't work
I have the following code querying MS SQL Server $query = "SELECT * FROM mytable"; $res = mssql_query($query); $nr = mssql_num_rows($res); for ($i=0; $i<$nr; $i++) { $a = mssql_fetch_array($res); $query = "SELECT * FROM anothertable WHERE id=".$a['anotherID']; $res1 = mssql_query($query); $anr = mssql_num_rows($res1); ... } This does NOT work! It seems that the 2nd query steps on the results of the first one! Can someone verify this effect? I am 99.999% sure this is what's happening. Who is the bonehead responsible for not implementing this for MS SQL Server? Thanks Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reloading a specific window
This does not work, when I replace my header function with: elseif (isset($_POST['btnSave'])) { .. database update, then... $ostr = <<< OUTPUT; document.window.opener.reload() self.parent.close(); OUTPUT; echo $ostr; //header("Location: ".$_POST['CallingScript']."?ID=".$_POST['ID']); exit; } several things happen: the database update does not happen, the mainwindow does not reload, and my form disappears from the popup frame and this frame is blank. I am probably doing something very stupid. Marek Kilimajer wrote > Output from action.php: > > opener.location.reload(); > close(); > > > Rich Fox wrote: > > Warning for server side purists: My php scripts use javascript to popup and > > close windows. So this question, although posted to a php newsgroup, has > > elements of javascript too. Gasp! No flames please. > > > > I have a main window which I will refer to as mainwindow > > (window.name='mainwindow' in the onload event). The script loaded into it is > > mainListing.php. From mainListing.php I popup another window, with a form > > and a save button. The form's action is "action.php" > > > > In action.php I update the database and then would like to: (1) refresh > > mainwindow so it reflects the database changes, and (2) close the popup > > window. > > > > I have been reading, tweaking, trying different things but nothing is > > working. Currently, the action script does: > > ... > > elseif (isset($_POST['btnSave'])) > > { > >.. update the database, then ... > > header("Location: ".$_POST['CallingScript']."?ID=".$_POST['ID']); > > exit; > > } > > ... > > > > This reloads the popup window, and then I have a "close" button to close the > > popup. Then I have to refresh the browser window manually to see the updated > > table from the database. Can I get some advice on how to accomplish (1) and > > (2) above? > > > > Many thanks, > > > > Rich > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Reloading a specific window
Warning for server side purists: My php scripts use javascript to popup and close windows. So this question, although posted to a php newsgroup, has elements of javascript too. Gasp! No flames please. I have a main window which I will refer to as mainwindow (window.name='mainwindow' in the onload event). The script loaded into it is mainListing.php. From mainListing.php I popup another window, with a form and a save button. The form's action is "action.php" In action.php I update the database and then would like to: (1) refresh mainwindow so it reflects the database changes, and (2) close the popup window. I have been reading, tweaking, trying different things but nothing is working. Currently, the action script does: ... elseif (isset($_POST['btnSave'])) { .. update the database, then ... header("Location: ".$_POST['CallingScript']."?ID=".$_POST['ID']); exit; } ... This reloads the popup window, and then I have a "close" button to close the popup. Then I have to refresh the browser window manually to see the updated table from the database. Can I get some advice on how to accomplish (1) and (2) above? Many thanks, Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] documentation on "<<<"
Can someone point me to documentation on the <<< operator? I am wondering if there are some quirks I don't know about. Yet I can't find it documented on the php website. THanks, Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] for loop break and continue
Can't you let me have a shred of programming self-respect? Rich (I should have cracked the book) Fox > On Thu, 2003-09-25 at 12:04, Rich Fox wrote: > > DOH! > > > > This is a new addition to PHP because it wasn't there before! > > > > Thanks for the slap. > > PHP has supported break for as long as I can remember which goes back to > about 1999 and PHP 3.something. > > Cheers, > 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
Re: [PHP] for loop break and continue
DOH! This is a new addition to PHP because it wasn't there before! Thanks for the slap. "Robert Cummings" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Take the sample code below, paste it to a PHP file, add a real > conditional, execute script. Voila, you've taken the first step towards > helping yourself. > > Cheers, > Rob. > > > On Thu, 2003-09-25 at 11:42, Rich Fox wrote: > > Hi, > > Is there an equivalent to the C++ 'break' command to stop execution of a for > > loop? I know I can use 'goto' but I don't want to unless I have to. > > > > for ($i=0; $i<$n; $i++) > > if (some condition) > > break; > > > > And, what about 'continue' which skips the rest of the code in the for loop > > and immediately goes on to the next iteration? > > > > Thanks, > > > > Rich > > > > -- > > 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
[PHP] for loop break and continue
Hi, Is there an equivalent to the C++ 'break' command to stop execution of a for loop? I know I can use 'goto' but I don't want to unless I have to. for ($i=0; $i<$n; $i++) if (some condition) break; And, what about 'continue' which skips the rest of the code in the for loop and immediately goes on to the next iteration? Thanks, Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] using a php variable in javascript
I have a page with the following code: <!-- so = window.open('','CompanyEdit'); so.location.reload(); window.close(); // --> I have 'CompanyEdit' hardcoded, but what I want instead is something like: so = window.open('','$callerWin'); This does not work, of course, but you get the idea: I want to use the value of the $callerWin php variable in my javascript. Can someone tell me the syntax for this? My reading of the documentation and trial-and-error have not met with success. thanks, Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: forcing variable expansion
Sorry, we have a Eugene Lee at my aikido school and it's such an unusual name I thought you might be him. "Eugene Lee" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Sun, Sep 21, 2003 at 03:01:41PM -0400, Rich Fox wrote: > : "Eugene Lee" <[EMAIL PROTECTED]> wrote: > : > > : > If I have a block of text saved in an external text file, e.g.: > : > > : > All {$badstuff} and no {$goodstuff} makes {$name} a dull {$type}. > : > > : > after reading the text into a string, is there a way to force variable > : > expansion? In a sense, it's like having a heredoc for multiline strings > : > with variable expansion while not having the heredoc embedded in PHP code. > > Question already answered by another helpful soul: use eval(). > > : That's not Eugene from the dojo is it? > > Hmmm? What dojo? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: forcing variable expansion
That's not Eugene from the dojo is it? Rich "Eugene Lee" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If I have a block of text saved in an external text file, e.g.: > > All {$badstuff} and no {$goodstuff} makes {$name} a dull {$type}. > > after reading the text into a string, is there a way to force variable > expansion? In a sense, it's like having a heredoc for multiline strings > with variable expansion while not having the heredoc embedded in PHP code. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: popups, parents, parameters, and php
my colleague just suggested that my popup, on the form submit, can call another page which just registers the items selected as session variables. This seems like a good idea. Of course, I will have to reload the original calling page, edit.php, so it can check those session varibles and amend the select1 list. I am going to try this, but I would still greatly appreciate any advice. Thanks, Rich "Rich Fox" <[EMAIL PROTECTED]> > I have been asking specific questions, and getting helpful answers, but I > realized I am getting ahead of myself and thinking about the trees when I > don't see the forest yet. I would like to describe what it is I want to do > in general, and then hopefully you can point me in the right direction so I > use html, php, and javascript together in some kind of reasonable way. I > feel like I am re-inventing the wheel, and badly. What I want to do must > have been done a zillion times by other web programmers already. > > I have a php page (edit.php) with a form with some text fields and a select > menu (select1). I want users to be able to add entries to the select1 menu, > and would like to use a popup window to do this. In the popup window, the > user is presented with a form with a select menu of all possible entries. > The user can make multiple selections from this list in the popup, and when > the popup's form is submitted, I want the select1 menu in edit.php to > reflect these additional entries selected from the popup. > > Those are the requirements. Should be easy, but I am finding it very > difficult to tie the pieces together. > > Any advice or url of a relevant tutorial would be greatly appreciated. > Thanks, > > Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] popups, parents, parameters, and php
I have been asking specific questions, and getting helpful answers, but I realized I am getting ahead of myself and thinking about the trees when I don't see the forest yet. I would like to describe what it is I want to do in general, and then hopefully you can point me in the right direction so I use html, php, and javascript together in some kind of reasonable way. I feel like I am re-inventing the wheel, and badly. What I want to do must have been done a zillion times by other web programmers already. I have a php page (edit.php) with a form with some text fields and a select menu (select1). I want users to be able to add entries to the select1 menu, and would like to use a popup window to do this. In the popup window, the user is presented with a form with a select menu of all possible entries. The user can make multiple selections from this list in the popup, and when the popup's form is submitted, I want the select1 menu in edit.php to reflect these additional entries selected from the popup. Those are the requirements. Should be easy, but I am finding it very difficult to tie the pieces together. Any advice or url of a relevant tutorial would be greatly appreciated. Thanks, Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opening new browser window
And if you are not in a form? My current code is: where popup is my javascript function. But as I said below, the popup doesn't work as expected and I do not want to use javascript. I can also not be in a form. Suggestions? Rich "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message > > > > Rich Fox wrote: > > > I would like to open a new browser window from within my php script > > (edit.php), a window in which another php page is run (search.php). > > search.php should be able to receive $_POST vars etc. from edit.php. I am > > not sure that the javascript solution to popup a window is correct, because > > then the popup does not behave normally. > > > > By normally, I mean that when I use javascript to popup a new window > > (search.php), and in search.php I have a form > > > > > > > > > > > > > > > > > > > > > > clicking OK or Cancel does absolutely nothing. So, I would like to avoid > > javascript and simply open a new browser window to run search.php. What is > > the accepted way to do this in php? > > > > tia, > > > > Rich > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Opening new browser window
I would like to open a new browser window from within my php script (edit.php), a window in which another php page is run (search.php). search.php should be able to receive $_POST vars etc. from edit.php. I am not sure that the javascript solution to popup a window is correct, because then the popup does not behave normally. By normally, I mean that when I use javascript to popup a new window (search.php), and in search.php I have a form > > clicking OK or Cancel does absolutely nothing. So, I would like to avoid javascript and simply open a new browser window to run search.php. What is the accepted way to do this in php? tia, Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Returning form vars from popup
I have a popup window, itemSelect.php, from which I would like to reload the calling page. itemSelect.php has a form, and I want to reload the calling page with these form variables. How can I do this? I can reload the page easily enough, with -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Returning FORM vars from popup
(Sorry, I inadvertently sent an incomplete post) I have a popup window, itemSelect.php, from which I would like to reload the calling page. itemSelect.php has a form, and I want to reload the calling page with these form variables. How can I do this? I can reload the page easily enough, with this test code in itemSelect.php: Not surprisingly, this doesn't work. My calling page reloads and the popup closes, but the onClick code bypasses the form and newparam doesn't get passed. What, please, is a good way to accomplish passing newparam (and other form vars) back to the calling page? Many thanks, Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Session data getting lost
> * Thus wrote Rich Gray ([EMAIL PROTECTED]): > > So your telling me that all variables defined in the global scope are > > automatically added to the $_SESSION array...? > > Not true I think > > > > no. read the documentation, in full. you're right - I'm sorry I hadn't read it in full... > > The soluction to your problem was resolved from the first reply (by > Chris Shiflett), but you rejected it because of it not making sense > to you, which seems to be the problem. Yes, however I was simply asking Chris to explain to me more as it didn't make sense to me (because I hadn't read the manual fully). I mistakenly expected the $_SESSION array to hold copies of assigned data not references to the global namespace variable ... my expectations were based on PHP's current default behaviour of pass by copy rather than by reference. It seems with globals on it can become a minefield eg below where a script happens to define and use a variable with the same name as an entry in the $_SESSION array... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Session data getting lost
> > * Thus wrote Rich Gray ([EMAIL PROTECTED]): > > Well a functon that doesn't work under certain conditions should be > > deprecated IMO ... I haven't used it for a long time now... > > this makes absolutly no sense. So if I use a function improperly, > it should become deprecated? Er ...I'm not using it improperly I'm just not using it at all. Why? Because it behaves differently in different operating conditions. Sure I could write extra code to detect the operating conditions but what's the point? If globals are off you can't use it as it doesn't work... The manual seems to make it pretty obvious to me that it should be avoided and even mentions the function is deprecated in a code example... > > session_register() is used in cases where you haver register_globals > on; it is not useed when it is off. So are you happy to use session_register() in your code? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Session data getting lost
So your telling me that all variables defined in the global scope are automatically added to the $_SESSION array...? Not true I think > [snip] > Well a functon that doesn't work under certain conditions should be > deprecated IMO ... I haven't used it for a long time now... > > To answer your question ... yep I've used print_r() and after the 1st > form > submission the entry is set to -1 however at no time do I ever set > $_SESSION['test'] to -1 in my code example ... > [/snip] > > Nope, but $test is a GLOBAL variable, and therefore would be set to -1 > within $_SESSION as all GLOBALS are, as you pointed out earlier, > registerd with $_SESSION. If $test is within a function it is a PRIVATE > variable, local to the function only, unless declared as a GLOBAL. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Session data getting lost
Well a functon that doesn't work under certain conditions should be deprecated IMO ... I haven't used it for a long time now... To answer your question ... yep I've used print_r() and after the 1st form submission the entry is set to -1 however at no time do I ever set $_SESSION['test'] to -1 in my code example ... Rich > [snip] > Thanks, but no I don't think so ... session_register() is deprecated ... > [/snip] > > Not depricated, just doesn't work when register_globals is off in the > .ini > > Have you done a print_r($_SESSION) to see if in fact the $test variable > is contained? > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Session data getting lost
Jay Thanks, but no I don't think so ... session_register() is deprecated ... Quote PHP manual: Caution: If you want your script to work regardless of register_globals, you need to instead use the $_SESSION array as $_SESSION entries are automatically registered. If your script uses session_register(), it will not work in environments where the PHP directive register_globals is disabled. Cheers Rich > > [snip] > session_start(); > $test = -1; > . > > [/snip] > > I think you need to register test > > http://us3.php.net/session_register > > HTH! > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Session data getting lost
Jan Sorry - no that doesn't help - as you can see from the code snippet I posted the session_start() is at the very top of the code... Thx anyway. Rich > > You have to put session_start(); at the VERY TOP of your code. > even before alle the tags. > Hope that helps! > > Jan > > --- Rich Gray <[EMAIL PROTECTED]> wrote: > > I'm running v4.2.3 on RedHat v7.0 and am getting some strange > > behaviour with the $_SESSION superglobal... > ... > > It works fine on Win2K albeit v4.3.0 of PHP. > > Maybe you have register_globals enabled on your Linux server and > not on your > Windows PC? Compare php.ini files before giving it too much thought. > > Chris > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Session data getting lost
Chris Thanks for your answer which I'm sorry to say makes no sense to me given the code example I supplied ... can you explain to me why you think register globals being set to on for the Linux server will cause the $_SESSION superglobal array to lose data? Am I missing something obvious here? Thx Rich > --- Rich Gray <[EMAIL PROTECTED]> wrote: > > I'm running v4.2.3 on RedHat v7.0 and am getting some strange > > behaviour with the $_SESSION superglobal... > ... > > It works fine on Win2K albeit v4.3.0 of PHP. > > Maybe you have register_globals enabled on your Linux server and > not on your > Windows PC? Compare php.ini files before giving it too much thought. > > Chris > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session data getting lost
Hi I'm running v4.2.3 on RedHat v7.0 and am getting some strange behaviour with the $_SESSION superglobal... below is a script to demonstrate the problem... Whenever the $_SESSION array gets re-created by session_start() the reloaded test entry is set to -1 however at no time does this value ever get assigned to the $_SESSION array ... it seems to be picking up the initialised value of the variable that gets assigned to the array... It works fine on Win2K albeit v4.3.0 of PHP. Anybody come across this before? Cheers Rich Initial script load ... $_SESSION value is '.(isset($_SESSION['test']) ? $_SESSION['test'].' it should be 999...' : 'not set yet').''; $test = 999; $_SESSION['test'] = $test; ?> After the assignment $test is '.$test.' and the $_SESSION value is '.$_SESSION['test'].''; ?> The output from the 'initial script load' line is shown below ... Initial script load ... $_SESSION value is not set yet (first time only) Initial script load ... $_SESSION value is -1it should be 999... (all subsequent submits) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Microsoft SQL Server varchar(500) field text concatenated at 255 characters.
> Hi There. > > I am using PHP 4.3.0 on WIN32 to query data from a Microsoft SQL Server. > One field I am requesting is type VARCHAR size 500. For some reason, PHP > is returning only the first 255 characters of the text from that field. > > If I change the field type to TEXT, all of the data in that field > is returned. > > Unfortunately, an ASP application is also using that database, > and when I change > the field type to TEXT, it pukes completely. > I would rather try to resolve the issue in PHP than waste my time > looking at ASP code. > > Has anyone got an idea why this might be hapenning? > > Many thanks. > > Scott Hi Scott I believe this is a problem because of the relatively old TDS libraries used by native access methods... Possible workarounds are... . cast the data to TEXT before returning it . use ODBC which doesn't have this problem IIRC HTH Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Time stamp and changing to a date.
> $mydate = "20030328231154"; > > $myPrintDate=date ("l dS of F Y h:i:s A",$mydate); > > echo "$myPrintDate"; > > Whats wrong $mydate should be a unix style timestamp not a MMDDHHMMSS type date/time format... Check the functions time() and mktime() to help you generate unix timestamps. HTH Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] string replace problem!!
> Good day , > > I have the following string. > ,slideimages[0],slideimages[1],slideimages[2] > Wich starts with a ','. No my problem is i want to strip > this first and only the first ','. > > i've tried > $string = ",slideimages[0],slideimages[1],slideimages[2]"; > $string = preg_replace('/^./','',$string,1); > > wich results in slideimages[0]slideimages[1]slideimages[2] > Can somebody help me out here?? > > thnx > Thijs $string = substr($string,1); Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] file
> hi all! > > i have a simple program to open and write a file. > but the file is not getting created. > can anyone please spot the mistake? > giving the code below. > > thanks a lot, > diksha. > > echo"hi?how are u doing??"; > $fp = fopen ("sandrew.html", "w"); > string="hii am > > fine"; > $contents=fwrite($fp,string); > echo "'$contents'"; > fclose($fp); > ?> Hi Diksha Some comments... . Your string variable needs to be defined and referenced as $string not just string - unless this is a typo in your post . fwrite() returns an int - you are assigning this int to $contents - what exactly are you expecting $contents to be set to? . Does your user or web server process have the permissions to create files in the directory? . What does readfile('sandrew.html'); after your fclose($fp) return? HTH Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Persistent values between executions
> > I have some sets of values that I have stored in several tables in a mySQL > database. These don't often change, but are referenced on every > single page > view. While each call is quick, as a gross the load on the server is too > high. I would like to know if there is a way to have these sets of values > remain persistent in the server's memory between calls from browsers, like > environment variables, to reduce the back and forth calls to > mySQL. As the > data from the calls are almost always the same, it would seem easier this > way. > > Any thoughts? Comments? RTFM suggestions? > > Mike > Use a 404 handler to build static html pages from the database. To refresh the content just delete the static content - this could be done automatically at predetermined intervals using cron or similar. FFT Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySQL Alias and PHP
> Hi all, > > I have this query: > > SELECT a.area_name, b.area_name FROM tbl_1 x, tbl_2 a, tbl_2 b > WHERE x.area_1 = a.id > AND x.area_2 = b.id > > I am using PEAR DB to get my results as an ASSOC ARRAY. How do I echo > the values for a.id and b.id? > > Thnks > Charles > I presume you mean area_name... Try this -> SELECT a.area_name as area_a, b.area_name as area_b FROM tbl_1 x, tbl_2 a, tbl_2 b Then you can refer to the columns as $array['area_a'] and $array['area_b'] HTH Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Uploading file problem
> Thanks!! I'll give that a try! > > On Thu, 6 Mar 2003, 1LT John W. Holmes wrote: > > > > Well, I have a statement that says: > > > > > > if ([EMAIL PROTECTED]($photo, $long_path . "speakers/" . $photo_name)) { > > > echo an error > > > }else{ > > > proceed with renaming the file > > > } > > > > > > The error that is echoed after the copy is the one that pops > up. So, it > > > could be some other problem, but I'm not sure what to look for. > > > > Take out the @ sign so you can see what the PHP error message is. > > > > ---John Holmes... Try using move_uploaded_file() as well... Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Uploading file problem
> I'm very new to PHP, so I hope no one is offended by reading my very basic > questions. > > I have created a web form that saves some data to a database and uploads > three files, copies them to a new directory, and renames them. From my > work machine and home machine, it works great for me - there are never any > errors. When my boss tries it, two of the files work fine, but the other > fails at the copy. I have watched him do it, and it's not user error. > What could the problem be? I'm stumped! > > I can include code or links if needed. > > Thanks, > Amanda >From what you say above I'd check the permissions on the 3rd target directory to check if it allows writes by the web server process. Are all 3 files going into the same directory? Is the server *nix or Windows? Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] submit button
> hi everybody, > > i have a PHP script by name registration.php > in which i have a submit button at the bottom. > the form in this script is sent to p.php by "GET". > but on clicking the submit button, nothing happens > attaching registration.php. > > p.php has only the following: > echo "hi how are u"; > ?> > > please help, > diksha. Can you post the form code? Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] question about smarty
> just wondering... does smarty have to be installed on the server where the > web site or php scripts it makes are going to be ran... or do you > just make > the stuff and put on the server like normal php files... No, the Smarty classes and plugins will have to be installed/accessible on the target server. It can be outside the document root though if it bothers you... HTH Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] quick echo output
> Ok most all programs I see they use > within the html. > Now I have always used the shortened version Is > there a reason > why I should not use this? I've never had any problems with this way of > doing things, but I just don't see anyone else using that format.. I think it's because the '=$blah' syntax relies on short tags ... and short tags can upset XML parsers... as a result short tags aren't supported by all hosting providers so your code could break if ported to another site... Cheers Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP on IIS session problems
> I get these errors from a simple "session_start();" script. > > Warning: session_start() [function.session-start]: > open(/tmp\sess_f4aa3ef3c537bb6327d5e7b991e91be7, O_RDWR) failed: No such > file or directory (2) in c:\inetpub\wwwroot\picoblog\admin.php on line 2 > > Warning: session_start() [function.session-start]: Cannot send session > cookie - headers already sent by (output started at > c:\inetpub\wwwroot\picoblog\admin.php:2) in > c:\inetpub\wwwroot\picoblog\admin.php on line 2 > > Warning: session_start() [function.session-start]: Cannot send > session cache > limiter - headers already sent (output started at > c:\inetpub\wwwroot\picoblog\admin.php:2) in > c:\inetpub\wwwroot\picoblog\admin.php on line 2 > Your php.ini still has the default /tmp session save path which is OK on Unix but squawks on Win32. So you will need to reset the directive session.save_path to c:\temp or any other valid scratch directory on your windows machine you will probably also need to bounce IIS as well to pick up the new settings if your running as an ISAPI module The second and third errors are a knock-on effect of the 1st problem so fix the bad session temp directory and they will probably disappear. HTH Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php.ini
> Rich, > I've checked my php.ini files on my drive and all I've got is one. > > The php_gd2.dll file is in: > > C:/PHP/extensions > > There was no default folder called extensions when I installed > PHP so I made > a directory called extensions under PHP. > > Everytime I take out the semicolon in the .ini file, the page > won't load and > I've got to shut down Apache server manually. > > If I put the semicolon back in, the page loads fine. > > I don't have a clue. Somewhere between the .ini file and Apache something > is very screwed up. > > TR > You said in your earlier post that in your php.ini your extension_dir is set to "C:\PHP\" - this is wrong it should be c:/php/extensions If the extensions directory was not there and you had to create it manually then where did you get the php_gd2.dll from? The extensions sub-directory should be there for a normal installation - did you install from zip? Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Random not working?
> Hi All, > > I'm trying to get a random record each time this script runs; > Only it's giving me everytime the first record back.. No random at all.. > > // generate and execute query > $query = "SELECT stedenid, naamstad, stadomschrijvk FROM steden > ORDER BY RAND() LIMIT 1"; > $result = mysql_query($query) or die ("Error in query: $query. " > . mysql_error()); > $row = mysql_fetch_object($result); > echo $row->naamstad; > > > Version info; > > PHP 4.3.1 > Mysql 3.23.54 > > When i'm trying to excute the SELECT statement in phpmyadmin; i'm > only getting the first record back and when i'm taking off the > LIMIT 1 it will display all the records in ascending order so > also not in random.. > > > Regards, > > Frank Frank This really belongs on the MySQL list but there was a known issue with RAND() on 3.23.54 - can you upgrade? If your table has an auto_increment ID column then a workaround would be to use rand() in PHP to generate a random ID then use that with a 'where id = '.$id in your query... HTH Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mysql replication + mysql_pconnect
> hi there i am setting up a test replication slave server as a mysql db > master backup if it fails , i would like to know how to > dynamically connect > to the slave if the master fails , something really strange i have set the > host like localhost:3307 for the slave but is still connecting to > the master > , and if i shut down the master it wont goto the slave :| > > Not sure I understand ... are you saying that mysql_connect('localhost:3307','user','password') connects to the master server? Can you describe the problem in more detail? Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php.ini
> I run the following script: > > phpinfo(); > ?> > > // the page loads o.k. when the semi-colon remains as in: > ;extension=php_gd2.dll > > but if I remove the semicolon as in: > > extension=php_gd2.dll > > the page won't load and the server hangs up. > .. > > \\ this is my php.ini file on MS Win 98/ PHP/ Apache > > > ; Directory in which the loadable extensions (modules) reside. > extension_dir = "C:\PHP\" > > ; Whether or not to enable the dl() function. The dl() function does NOT > work > ; properly in multithreaded servers, such as IIS or Zeus, and is > automatically > ; disabled on them. > enable_dl = On > > extension=php_gd2.dll > ... > > Any advice on how I can install GD libraries greatly appreciated. > Thank you. > Tony Ritter Hi Tony Still battling GD I see :) Are there any errors in the Apache error.log? What happens if you change your php.ini directive to ... extension_dir = C:/php/extensions HTH Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Parse exec output
> > If I exec a command like ifconfig, I'd like to be able to parse. What is > the best way to go about thihs? An example output from ifconfig is: Check http://www.php.net/manual/en/function.passthru.php Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Get variable from PHP before submit
> I'm trying to implement the following functionality into the file > test.php: > > When I scroll down the page and then hit a button, the page > should remember > the scrolled position, refresh the page and then scroll down to the > remembered position. I've almost managed to make this work, but > only almost. > > The first time I click one of the buttons, the page won't scroll, > but after > that it works fine. I think the reason for this is that the function > hentKoordinat() gets called before $teller is set. hentKoordinat() uses > $teller. > > Anyone know a way to make this work? > > Thanks alot! > > Lars I've probably misunderstood but can you not use an HTML anchor...? Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Destroying COM objects
> When using the COM functions in PHP what is the equivalent of > ASPs "set object=nothing"? > I am using the Crystal Report objects and I cannot seem to > destroy my Report object. Have you tried setting it to NULL? Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Automatically included file?
> New to PHP, I was wondering if PHP, running as a module under Apache 2, > had an automatically included script that would run prior to any/each > PHP script served by Apache? > > Tks, > Dwayne Dwayne Look into the auto_prepend_file directive that you can specify in php.ini - this may suit your needs. Cheers Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Counting table fields having specific values
Mike Try ... Rich > -Original Message- > From: rentAweek support [mailto:[EMAIL PROTECTED] > Sent: 27 February 2003 17:32 > To: [EMAIL PROTECTED] > Subject: [PHP] Counting table fields having specific values > > > I have a table where the row named "hide" can have a value 0 or 1. > I want to obtain a count of all the rows where "hide" has value 0. > > The following works on mysqladmin: > > SELECT SUM( hide = 0 ) FROM `names` LIMIT 0, - 1 > > Giving > > SUM( hide = 0 ) > 7 > > The PHP script statements generated are: > > $sql = 'SELECT SUM( hide = 0 ) FROM `names` LIMIT 0, -1'; > $result = mysql_query($sql); > > What assignment statement do I need to write now to obtain the SUM value > as shown by mysqladmin please? > > TIA > > Mike > > > > > > > -- > 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] How do I display the script file name?
> How can I display the script file name? Presumably something like-: > > echo $ScriptFileName; > ?> > > While I'm learning php and developing various Web page versions, I want to > be sure the that the display is from the appropriate script. > > Regards > Stephen Ford, Surrey, UK Try any of these to see if it is what you want - some are absolute some are relative ... Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ftp browsing
> I am using Windows XP Pro, and I am using Serv-U to run my FTP server. > It is just a server running from my machine. Is it supposed to have PHP > installed somewhere? OK I've probably misunderstood - I assumed you were running your PHP scripts locally - what platform are you running the PHP scripts on and what version of PHP is it? Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ftp browsing
> -Original Message- > From: Matt Palermo [mailto:[EMAIL PROTECTED] > Sent: 23 February 2003 09:46 > To: [EMAIL PROTECTED] > Subject: [PHP] ftp browsing > > > I have a php script that is like and ftp client, only is just browsers the > server and displays file names and folders. If you click on the name of a > folder that it displays, it will then display the files and folders inside > that directory, and so on for all directories. It works perfectly when I > connect to my internet hosting company through ftp to browse, but > it doesn't > work right when I connect to my personal ftp server. I have tried using > both Serv-U and Bulletproof ftp servers to host my ftp site. The script > won't display my server correctly with either of these. Can > anyone give me > some advice? I would really appreciate it. Thanks. > > Matt What version of PHP are you running on your personal ftp server? Is your personal server Win32? There was a bug with ftp_nlist()/ftp_rawlist() on Windows that wasn't fixed till v4.3.x IIRC Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] online tutorial
> > > dear all, > > i am a final year engineering student and have > started studying PHP since last 10 days. > > can anybody suggest some good online tutorial for mastering PHP? > > regards, > diksha. > Hi Diskha try these urls... http://www.zend.com/zend/tut/ http://www.php.net/manual/en/tutorial.php http://www.devshed.com/Server_Side/PHP Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Block direct image loads but allow them in PHP
[snip] > > if(isset($i)) > { > //codeImageURL decodes $i into an image path that we can work with > $link=codeImageURL($i); > if($link!="" && (isAdmin() || !isThisFileBlocked($link))) > { > header("Cache-control: private"); > header("Content-type: image/jpg"); > header("Content-Disposition: attachment; filename=".$link); > $fp = fopen($link, 'r'); > fpassthru($fp); > fclose($fp); > } > else > echo "Error: Couldn't decode image URL\n"; > } Michael Have you tried header('Content-type: image/jpeg') ? Note the 'e'... Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_SESSIONS and printing off..
Um... how about... echo 'Welcome '.$_SESSION['username'].', you are still logged in and your authentication level is '.(isset($_SESSION['level']) ? $_SESSION['level'] : 'unknown'); Or am I missing something here? Rich > -Original Message- > From: Frank Keessen [mailto:[EMAIL PROTECTED]] > Sent: 18 February 2003 12:15 > To: Rich Gray; [EMAIL PROTECTED] > Subject: Re: [PHP] $_SESSIONS and printing off.. > > > Thanks, > > But then another question; > > if (isset($_SESSION['username']) && !empty($_SESSION['username'])) { > > echo 'Welcome '.$_SESSION['username'].', you are still logged in.'; > > > I want also checked if the level of authentication = 2; for example > User Frank = level 1 > User Rich = level 2 > > I've set $_SESSION['level'] to 2 but how can i check that with the above > line? > > Thanks for your help, > > Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_SESSIONS and printing off..
Er... well I've seen a lot worse code than that but maybe you could use ... if (isset($_SESSION['username']) && !empty($_SESSION['username'])) { echo 'Welcome '.$_SESSION['username'].', you are still logged in.'; } else { header... etc etc } Rich > -Original Message- > From: Frank Keessen [mailto:[EMAIL PROTECTED]] > Sent: 18 February 2003 09:00 > To: [EMAIL PROTECTED] > Subject: [PHP] $_SESSIONS and printing off.. > > > Hi All, > > I'm a little bit confused and it's maybe a newbie question but > maybe you can help me out; > > A user is login in and after username password check it will > redirects to this page > > session_start(); > if (isset($_SESSION['username'])){ > $username = $_SESSION['username']; > echo 'Welcome, you are still loged in.'; > echo $username; > } > else{ > header ( "Location: login.htm" ); > } > ?> > > Question is; is this the way to print of his username? > > $username = $_SESSION['username']; > Echo $username > > Or has anyone some alternatives.. > > This is working o.k. but in my opinion it's a little bit quick and dirty? > > Thanks for the comments and suggestions! > > Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] 4.0.6 to 4.3.0
> > Secondly for file uploads why are you not using the $_FILES[] > > superglobal array? > > I did not write the app, just trying to figure out why it stopped > working after upgrading PHP. You think that's the problem? Well try ... if (is_uploaded_file($_FILES['attach']['tmp_name'])) { // Blah Blah Blah } Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] 4.0.6 to 4.3.0
[snip] > > > > > > After upgrading from 4.0.6 to 4.3.0 > > > > > > > Most probably because with 4.3.0 register_globals is set to OFF > by default - > > where does $attach get set? > > > > > Nope, I do have register_globals on in php.ini > > Its being set in another file like this: > method=POST> > > > > It behaves like, if ($_GET['attach'] != "none") or ($attach != "none") > is always true. > > If I attach something it goes through no prob, if I do not attach > something > it still goes through but with all the error messages and an > empty attachment > at the recieving end. Only thng that has changes was upgrading > PHP from 4.0.6 > to 4.3.0 > Hi Brian Why are you using $_GET[] when your form is submitting via the 'post' method? Secondly for file uploads why are you not using the $_FILES[] superglobal array? Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] 4.0.6 to 4.3.0
> > Any thoughts as to why this snippet: > > 25: if ($attach != "none") > 26: { > 27:$file = fopen($attach, "r"); > 28:$contents = fread($file, $attach_size); > 29:$encoded_attach = chunk_split(base64_encode($contents)); > 30:fclose($file); > > would produce these errors: > > Warning: fread(): supplied argument is not a valid stream resource in > /usr/virtual/share/pkgs/installed/aeromail/1.40/aeromail/send_mess > age.php on line 28 > > Warning: fclose(): supplied argument is not a valid stream resource in > /usr/virtual/share/pkgs/installed/aeromail/1.40/aeromail/send_mess > age.php on line 30 > > After upgrading from 4.0.6 to 4.3.0 > Most probably because with 4.3.0 register_globals is set to OFF by default - where does $attach get set? Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] session id
> -Original Message- > From: Edward Peloke [mailto:[EMAIL PROTECTED]] > Sent: 06 February 2003 13:56 > To: Php-General@Lists. Php. Net > Subject: [PHP] session id > > > Ok, I am sure this has been discussed but I have not been keeping up with > the listserv. I am using sessions so to test, I blocked all > cookies and of > course the sessionid is then in the url. How can I hide it from the > url?...or is this even possible? > > Thanks, > Eddie If you disable session.use_trans_sid in your php.ini then session id's will not get passed via the url if cookies are being refused. But then of course your session support is gone for that particular browser/user. Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] If... Else.. I'm not getting it!
You are using the post method not get so $_GET[] should be empty. Does this version of your code work? Input yourname Rich -Original Message- From: Frank Keessen [mailto:[EMAIL PROTECTED]] Sent: 25 January 2003 11:33 To: Johannes Schlueter; [EMAIL PROTECTED] Subject: Re: [PHP] If... Else.. I'm not getting it! Hi, Thanks, but i'm a kind of a newbie in PHP and what i've read it's better to have the register_globals = Off!!! If you look at my code you see that i'm using the $_GET variable.. This works fine!! It's the IF.. ELSE what gives me a lot of trouble! Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Starting sessions, registering variables, destroying sessions with global_variables off....
Phil It should be as easy as .. You'll need a session_start() on all pages that will be using the $_SESSION[] array. Is your session.save_path pointing to a writable directory? Do you see any errors in the server logs when you try to start a session? Rich -Original Message- From: Phil Schwarzmann [mailto:[EMAIL PROTECTED]] Sent: 24 January 2003 13:36 To: [EMAIL PROTECTED] Subject: [PHP] Starting sessions, registering variables, destroying sessions with global_variables off I just switched from a 4.06 server with global_variables ON to a 4.22 with global_variables OFF Can someone give me a quick run down of how to set/unset variables and register/destroy sessions with PHP 4.22 (global_variables OFF). I've been all through the php.net manual and still can't figure it out. I know that I have to use $_SESSION['foo'] instead of just $foo now, but for some reason I can't get session_start(); to properly start a session. Any ideas?? Thanks!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] setcooke(...) before header("Location: XYZ") - Cookie doesn't set!
Mike IIRC this is a known bug with IIS (not PHP) when it gets the http redirect it junks the cookie - sorry I can't remember much more detail than that... Workaround maybe is to spit out an HTML based META refresh redirect tag instead of using the header() call. HTH Rich -Original Message- From: Mike Potter [mailto:[EMAIL PROTECTED]] Sent: 21 January 2003 15:35 To: [EMAIL PROTECTED] Subject: [PHP] setcooke(...) before header("Location: XYZ") - Cookie doesn't set! HELP! I know I'm new at this so please don't laugh. But I can't get this to work! I am using Microsoft IIS with the latest PHP installed. Here's a smple: . . . setcookie("testCookie", "testValue", time() + 3600, "/"); header("Location: http://newpage.php";); exit; Later, I pull the cookie: echo $_COOKIE["testCookie"]; and there is no value. If I don't use the header function at the end, and write something to the page, it works fine. Why does this cookie not get set? Thanks a ton! Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Form Validating Class (OOP misunderstandings...)
PHP does not yet support private methods ... your problem with getValue() is most probably because register_globals is off in your php.ini try substituting $_POST[] for $HTTP_POST_VARS[] and it may start to work... HTH Rich -Original Message- From: Nicholas Wieland [mailto:[EMAIL PROTECTED]] Sent: 21 January 2003 14:13 To: [EMAIL PROTECTED] Subject: [PHP] Form Validating Class (OOP misunderstandings...) Hello everybody, I'm working on a class but having a lot of problems... probably my understanding of PhP-OOP is not so good ... Here's the class: I found it on the web and I've tried to personalize it to fit my needs... reset_errorList(); } function getValue( $field ) { $value = $HTTP_POST_VARS[ $field ]; return $value; } function isEmpty( $field, $msg ) { $value = $this->getValue( $field ); if( trim( $value ) == "" ) { $this->errorList[] = array( "field" => $field, "value" => $value, "msg" => $msg ); return true; } else return false; } function isString( $field, $msg ) { $value = $this->getValue( $field ); if( is_string( $value ) ) return true; else { $this->errorList[] = array( "field" => $field, "value" => $value, "msg" => $msg ); return false; } } function isEmail( $field, $msg ) { $value = $this->getValue( $field ); $pattern = "/^([a-zA-Z0-9])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/"; if( preg_match( $pattern, $value ) ) return true; else { $this->errorList[] = array( "field" => $field, "value" => $value, "msg" => $msg ); return false; } } function isError() { if( sizeof( $this->errorList ) > 0 ) return true; else return false; } function get_errorList() { return $this->errorList; } function reset_errorList() { $this->errorList = array(); } function stringConvert( $field ) { $value = $this->getValue( $field ); $value = html_special_chars( $value ); $value = stripslashes( $value ); $value = strtolower( $value ); return $value; } }; ?> Ok. I think that the getter is *totally* wrong but I'm not able to debug it, because it's private (I think...). Also the stringConvert() method sucks, maybe I'll split it in some others accessor methods, for a better design. Now I'm totally lost, I don't have a clue how to continue, I've tried for hours and hours to make it work, but didn't succeed :( Any suggestion on improving and other enhancment for a good form validating class is really really appreciated. TIA, Nicholas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Sessions
Sorry I'm a bit late in on this thread but I know there is a problem with sessions with 4.1.2 with IIS 5 over Win2K... is that your platform? I encountered it a while back and there is a hack/workaround which I can dig up if you need it... HTH Rich -Original Message- From: Tim Thorburn [mailto:[EMAIL PROTECTED]] Sent: 21 January 2003 10:26 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] PHP Sessions There is some discussion as to whether my globals are on or not ... I am using session_register to name my sessions, and then the global command later on on the individual pages to remember which session it is we're looking for. It would be simply priceless if sessions were broken in 4.1.2 - and make much sense in the long run. Thanks -Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to upload a file
And if you select a small file it works fine right? -Original Message- From: Somesh [mailto:[EMAIL PROTECTED]] Sent: 20 December 2002 12:29 To: Rich Gray Cc: [EMAIL PROTECTED] Subject: RE: [PHP] How to upload a file post_max_size 8M upload_tmp_dir It fails immediately after clicking the submit button. [thanx for ur concern] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Check Uploaded File
Shaun Run getimagesize() on the uploaded file - if a valid jpeg the returned array[2] will be set to 2... http://www.php.net/manual/en/function.getimagesize.php HTH Rich -Original Message- From: shaun [mailto:[EMAIL PROTECTED]] Sent: 19 December 2002 02:24 To: [EMAIL PROTECTED] Subject: [PHP] Check Uploaded File Hi, Is it possible to ensure that a user is uploading a jpeg file from a form and nothing else? Thanks for your help -- 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] PHP and MySQL queries
Does it work if you put quotes around the array keys as follows... echo $line['idn']; echo $line['total']; echo $line['idp']; echo $line['position']; echo $line['points']; Rich -Original Message- From: Beauford.2002 [mailto:[EMAIL PROTECTED]] Sent: 18 December 2002 20:28 To: PHP General Subject: [PHP] PHP and MySQL queries Hi, I am having a real problem with variables in PHP and trying to query my MySQL database. I have a form that a user inputs information and then that info is used to query my database, but it's not working. I don't get any errorrs and it appears every thing worked, but nothing gets displayed (see code below). I know the info is getting passed from the form as it appears correct in the address bar of my browser. The query below also works if I use the command line in MySQL and hard code the information. Any help is appreciated. http://etc/etc?FromTrade=TRUE&name=1&from=2 $query = "select tmanager.idn, tmanager.total, troster.idp, user, position, points from troster join treference join tmanager where tmanager.idn=treference.idn and treference.idp=troster.idp and tmanager.name like '$name' and troster.player like '$from'"; $results = mysql_query($query) or die("Query failed"); while ($line = mysql_fetch_array($results, MYSQL_ASSOC)) { echo $line[idn]; echo $line[total]; echo $line[idp]; echo $line[position]; echo $line[points]; This just displays an empty page. So it appears the query found nothing, but like I said, it works from the command line and there should be one entry (see below). So I have to assume it is a problem with the variables. +-++-++--++ | idn | total | idp | user | position | points | +-++-++--++ | 1 | 746.75 | 2 | Trevor | F| 45.00 | +-++-++--++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php