Re: [PHP] php.ini
Nathan Nobbe wrote: On Fri, May 9, 2008 at 12:02 PM, Michael Satterwhite [EMAIL PROTECTED] wrote: I do know that on bluehost, they actually encourage people to use their own php.ini file in their web directory ... and users certainly don't have the authority to restart apache. That said - just for grins, I *DID* restart apache2. It made no difference. Some web hosts allow you have have your own local php.ini. You just create an empty php.ini file in your main web directory. After you do that, the loaded configuration file shown in the output from phpinfo() will show the path to the local php.ini file. Then, just put the specific directive in there, such as: magic_quotes_gpc = Off This works on some hosts. Janet -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] First stupid post of the year.
tedd wrote: However, I still have not been able to remove nbsp; from a string. IThe trim(str_replace('nbsp;','',$submit)); seems to work fine for me when I assign the string from your message to $submit. Copy/pasted it. Have you looked at $submit with var_dump before you tried to change it? Perhaps it does not contain what you think it does. Janet Cheers, tedd -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem With mysql_query
Brian Welter wrote: I have the following code and it doesn't behave properly but I can't find my error. The code is designed to validate user login. When I pass in an invalid email name to the checkLogin function it returns a result, not FALSE as the documentation describes. I can SELECT * from the table being used and read out all of the data so I know that the DB connection is valid and that I can compose a valid query. I have looked and looked at this code and can find no error, does anyone see an error here. When the check if (!$result) fails i.e. even thought the email/password are not in the db a none zero result is returned, the calls to mysql_fetch_assoc () return empty strings. The only clue I may have is that when I call mysql_free_result($result) I get a warning saying that $result is not a valid resource. I sure I'm doing something stupid but I just can't see it. Any help would be great! !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleUntitled Document/title /head body ?php global $db; $db = mysql_connect('localhost', '', '', ''); if (!$db) { die(Unable to connect to database: . mysql_connect_error()); } $selected = mysql_select_db(, $db) or die( Unable to select database); if (checkLogin([EMAIL PROTECTED]', '1')) { echo Success; } else { echo Failure; } if(checkLogin('duck', '2') )) { echo Success; } else { echo Failure; } function checkLogin($e, $p) { $ans = 0; $emailcheck = $e; $passwdcheck = $p; $result = 0; $query = SELECT * FROM maillist WHERE email='$emailcheck' AND passwd='$passcheck'; $result = mysql_query($query); Idon't think it's your problem, but you have two different variable--$passwdcheck and $passcheck. After getting the results, you can check how many valid users are in the result, as follows: $n = mysql_num_rows($result); if($n 1) etc. Janet if (!$result) { echo h4UserName is FALSE name is: $eh4; echo h4Password is FALSE name is: $ph4; $ans = 0; } else { $row = mysql_fetch_assoc($result); $em = $row['email']; $pw = $row['passwd']; echo pAccepted ; echo User $em ; echo Password $pw/p; $ans = 1; } return($ans); } //checkLogin mysql_free_result($result); mysql_close($db); ? /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL, PHPMyAdmin, GRANT, headaches
brian wrote: I'm setting up a site and am having loads of problems with MySQL (which i don't use much, being a Postgres fan). The server is not controlled by myself and I'm waiting on a reply from the admin. In the meantime: PHP 4.3.9 Mysql 4.1.10a (server) 3.23.49 (client) The database has been set up along with PHPMyAdmin (i also rarely use this). I have been provided with a user pass for PHPMyAdmin, as well as a user pass for the DB. Using the former, i have created the tables and copied in my data. Within that interface, i can make any query i'd like. However, from within a PHP script (and using the second user pass), i seem to be SOL. Even the most basic queries return empty results. Debugging has been a royal pain because interfaces such as MDB2, DB, etc. are also not available. That means relying on mysql_error() which is frustrating. After much dicking around, i've come to the conclusion that the problem must be that the user does not have permission to select from the DB. A comment on the mysql_error() manual page [1] says that, in the case of Access denied ... mysql_error() returns the empty string. I feel like i've taken crazy pills! Please, someone tell me this isn't true! How does one debug a problem like this? How can i know if i have SELECT rights to the table? [1] http://ca3.php.net/manual/en/function.mysql-error.php#44168 First, if you are having an access denied problem, you will get a PHP error message. Perhaps you have errors turned off in your PHP script. Turn them on until you get it working. Second, you should be able to use phpMyAdmin to see what the permissions are for the account you are using. Janet brian -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Books - A poll of sorts
Jay Blanchard wrote: Evening all! (at least it is evening here in Texas) We all have our favorite PHP books and resources but there is one tome that seems to be missing from the group...a best practices book. We all have our preferences for what we call best practices and it seems at this stage in the life of PHP that there would be a guide to the best of the best. I am not talking about the holy wars here (like bracket placement) I am talking about things like testing variable in conditional situations or the proper use of constructors or ways to leverage the power of PHP with databases. If there was a best practices book would you buy it? (I am showing complete disregard for the thread on copyright infringement v. theft.) Or do you rely on other sources like this list, articles, etc to derive your own set of practices? Thanks for indulging me. Thanks Jay I would buy it. But, I buy tons of books. Janet -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Pirate PHP books online?
Larry Garfield wrote: And here is the crux of the point that I've been making. Information is not property. Property cannot be duplicated ad infinitim. Information can, by its very nature. The concept of theft does not apply. The concept of restricting the flow of information is artificial (to answer someone else's question from earlier), whereas the laws of physics provide a natural restriction on the flow of goods. And here's where your argument loses me. It's not information that is being restricted. It's my writing of the information that's mine. I spent my time organizing a bunch of words in a particular way to communicate some information. I wrote them. I spent a lot of time doing it. It's my skill. You have no right to take the fruit of my skills without compensating me. If I want to give it to you, I can. But you have no right to just take my book. If you want to take all the information that is in the book, all the knowledge, all the facts, and put them in your own words, write them down in some other form, they are yours. Feel free. Facts are facts. But the particular expression of that information is mine. It seems me that, in theory, any property can be duplicated infinatum. It's just a question of resources and time. It takes very little time and resources to duplicate a computer file. It takes a lot of time and resources to duplicate a house. You are the one buying into the spin by claiming that information is as permanently and inviolately restricted as atoms and molecules are. That is false. That does not make breaking the law right, but it is a necessary fact of nature to understand if you want to understand the law and why the law exists (in theory). Sorry, but no one is trying to restrict information. Talk about spin. The storage of my words in a file is a concrete thing. Because it is stored in ones and zeros on a computer disk does not make it some sort of cosmic entity. It still is just a collection of words. My words. It's no different than a stack of paper with typewritten words on it that an author produced with a typewriter. Just as a matter of curiosity, do you also spend time writing long emails correcting people who use the term identity theft? Janet Of course, the media moguls have spent decades selling that spin precisely because they want to confuse the issue. If you convince people that information is property in the same way that their house or car is, then you undermine the purpose of copyright (promoting social good, not private profit), undermine any attempts to reform the law, and undermine the basic precepts of both open source software (the free flow of information creates better expressive works through sharing) and Free software (restriction of the free flow of information is immoral). Is murder theft? Of course not, but it's still illegal. Is rape theft? Of course not, but it's still illegal. Is arson theft? Of course not, but it's still illegal. Is jaywalking theft? Of course not, but it's still illegal. Is speeding theft? Of course not, but it's still illegal. Is copyright infringement theft? Of course not, but it's still illegal. Copyright infringement is no more theft than walking against the light is speeding. I, for one, just call theft what it is. And everything else that is illegal too, apparently, regardless of whether or not it is. -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Pirate PHP books online?
Anyone who is concerned about the trees doesn't need to steal the book. They can buy it as a PDF. Janet Richard Davey wrote: Hi Crayon, Monday, July 16, 2007, 4:22:14 PM, you wrote: I think no matter which way you dice it, sending 1 email is a lot more energy efficient than printing 1 book. Just because the tree itself is renewable, the *energy* used in cutting it down, turning it into paper, turning the paper into a book and all the transporting in between, is most likely not renewable. It wasn't about comparing emails to paper, it was about stating that at least ripping off someones book as a PDF saves the environment, while I'd argue that the very act of reading it electronically is still detrimental to the environment. The irony just amused me. Cheers, Rich -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HELP - I have tried to unsubscribe from this listmutipletimes but cannot.
Here's a page with more info about unsubscribing and problems. Have you seen this? http://www.php.net/unsub.php Janet -Patrick wrote: Stut wrote: I've never known an unsubscribe request to need identity confirmation. Are you sure you're asking the system to unsubscribe you not subscribe you? I'm really not sure how, or even if it's possible, to escalate this to the next level. I've subscribed and unsubscribed to PHP lists various times with several addresses and have never had any issues. I call PEBKAC. -Stut Yes, I tried every link on that confirmation message when nothing would work. And I am 110% positive I have used the confirmation-unsubscribe link. It sends me a message asking if I am sure that I want to UNsubscribe. Great, I am stuck receiving the email equivalent of spam(since I do not want to receive it) for the rest of this email address's life. wtf. -Patrick -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Login page error
The error comes from having output before the session_start(). This means that anything before the ? would be output. Even a single empty space. Janet Humani Power wrote: Hi! Im trying to make a login page. I have searched for examples that makes me check the user name with a database, and the one that suits better is this code. ? session_start(); // start session. ? !-- header tags, edit to match your own, or include template header file. -- html head titleLogin/title head body ? if(!isset($username) | !isset($password)) { // escape from php mode. ? form action=?=$PHP_SELF??if($QUERY_STRING){ echo?. $QUERY_STRING;}? method=POST p align=centerMembers only. Please login to access this document./p table align=center border=0 tr th Username: /th th input type=text name=username /th /tr tr th Password: /th th input type=password name=password /th /tr tr th colspan=2 align=right input type=submit value=Login /form /th /tr /table /body /html ? exit(); } // If all is well so far. session_register(username); session_register(password); // register username and password as session variables. // Here you would check the supplied username and password against your database to see if they exist. // For example, a MySQL Query, your method may differ. $sql = mysql_query(SELECT password FROM user_table WHERE username = '$username'); $fetch_em = mysql_fetch_array($sql); $numrows = mysql_num_rows($sql); if($numrows != 0 $password == $fetch_em[password]) { $valid_user = 1; } else { $valid_user = 0; } // If the username exists and pass is correct, don't pop up the login code again. // If info can't be found or verified if (!($valid_user)) { session_unset(); // Unset session variables. session_destroy(); // End Session we created earlier. // escape from php mode. ? form action=?=$PHP_SELF??if($QUERY_STRING){ echo?. $QUERY_STRING;}? method=POST p align=centerIncorrect login information, please try again. You must login to access this document./p table align=center border=0 tr th Username: /th th input type=text name=username /th /tr tr th Password: /th th input type=password name=password /th /tr tr th colspan=2 align=right input type=submit value=Login /form /th /tr /table /body /html ? exit(); } ? After this, I have only included on a file that has this code ?php include_once 'connection/login.php'; ? But when I try to see it in a browser I got the error *Warning*: session_start() [function.session-start http://localhost/apache2-default/function.session-start]: Cannot send session cache limiter - headers already sent (output started at /var/www/apache2-default/visual_imag.php:2) in */var/www/apache2-default/connection/login.php* on line *2 I have searched for possible answers, and all I have found is that I should not send any output before the session_start(); But in this code the session_start(); output is before anything else. can you give me a tip? Thanks in advance. Yamil * -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie question
bob pilly wrote: Hi all Can anyone tell me what '' means before a var? e.g function($var) http://us3.php.net/manual/en/language.references.php Janet -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting last record ID created from DB
Jeff wrote: Is there a way to get the last Record # created by the DB. ... what code could I add here to make the following line work? echo REMEMBER your USER ID# you will need it when creating Characters!! It is: $user_id; - I want to show the user_id just created here. Thanks in advance! The function mysql_insert_id will return the previous id inserted. http://us3.php.net/manual/en/function.mysql-insert-id.php Janet -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passwords suddenly not working
Dave M G wrote: PHP List, I have a few scripts that have been around for a while. In one, is a simple login function: $query = SELECT * FROM forum_members WHERE memberName = ' . $username . ' AND passwd = MD5(' . $password . '); $result = mysql_query($query); This was working fine, but recently I haven't been able to log in. I think the only thing that has changed is that on my hosting service, they recently upgraded to PHP 5.1.6. (MySQL is 4.1.21, but I think it's been that for quite a while) Perhaps you have error reporting turned off. Errors or warnings may be generated but not displayed. Add the following to the top of your program to temporarily see the error messages: error_reporting(E_ALL); Also check in php.ini to make sure that You may also want to see if any MySQL errors are being generated. Try the following code: $result = mysql_query($query) or die(Query failed: .mysql_error()); With this code, if the query fails, the program will stop and an error message will be displayed. You also may want to display $query before you execute it to see what, exactly, is being executed. Janet Is there any potential for PHP 5.1.6 to handle things different when it comes to MySQL queries, post data, or anything? I thought it might be that I still had $HTTP_POST_VARS for some of my variables, but I changed them all to $_POST, and it still doesn't work. I don't get any errors or anything. My own code is not very sophisticated for error reporting. But I'm not getting any PHP syntax errors of any kind. If I run the SQL code by itself at an SQL command prompt, I get results back, so I don't think the SQL is failing. Are there any gotchas in the upgrade that I might be missing? I can't think of anything else that could be a culprit (though of course I'm open to suggestions). Any advice would be much appreciated. -- Dave M G Ubuntu 6.06 LTS Kernel 2.6.17.7 Pentium D Dual Core Processor PHP 5, MySQL 5, Apache 2 -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] combine implode() and array_keys() to get a string of key names
Dave M G wrote: PHP List, I've got a series of associative arrays that contain simple string values that I want to insert into my database. In each array, the names of the keys correspond to the column names in the database table. The values stored in the array are, of course, the values that I want to insert into the columns. So, I want to set up a function where I can pass the array as an argument, and it will construct the MySQL statement using the keys for column names, and array values for insert values. Within the function, the query looks like this: $query = INSERT INTO table ( . $columns . ) VALUES = ( . $values . ); Assuming that the array argument passed to the function is called $array, converting the array values to the insert values is pretty easy: $values = implode(, , $array); But in the case of using the array keys for column names, it's not so easy: $columns = implode(, array-keys($array)); I know that code above doesn't work, because, as described in the manual, array keys returns a list of the numerical indexes along with the string indexes. Actually, it doesn't matter what the indexes are when you use implode. Implode just puts the values into a string. Here's code that will work. $field_array = array_keys($fields_form); $fields = implode(,,$field_array); $values = implode(',',$fields_form); $query = INSERT INTO Table1 ($fields) VALUES (\$values\); $result = mysqli_query($cxn,$query); $fields_form is an associative array of all the fields to be entered into the database, with the field names as keys and the field values as values. This code quotes the values in the $values string in the query, as needed if the values are strings. Janet Something like this: Array ( [0] = column1 [1] = column2 [2] = column3 ) At least, that's what it looks like if it's just echoed out. Is there a way I can strip out the relevant column names to be more like this: column1, column2. column3 Thank you for any advice. -- Dave M G -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error checking
Michael Satterwhite wrote: Philip Hallstrom wrote: I'm using Apache and PHP4 under debian. in /etc/php4/apache, I have the setting error_reporting = E_ALL ~E_NOTICE but I don't get any errors - even when I've clearly used an undefined variable. What else might need to be set to get PHP to report errors for me? You won't see the notice for an undefined variable with this setting. You have notices turned off. You will only see warnings and fatal errors. If you want to see notices, you need to use the following setting: error_reporting = E_ALL Janet -- Janet Valade -- janet.valade.com -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource
Mark Sargent wrote: Hi All, get the following error when calling data from mysql, *Warning*: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in */var/www/html/phpmysqltable.php* on line *36 This means that $result is not a valid result resource. You can var_dump($result) to see that this is true. It probably contains false. You get false when there's a problem with your query. If you echo mysql_error() after the query, you will get more information about what is wrong. Janet * Below are snippets of my code, Line 22: $result = mysql_query(SELECT product_name, product_model_number, product_serial_number FROM Products,$db); Line 36: while ($myrow = mysql_fetch_row($result)) { printf(trtd%s %s/tdtd%s/tdtd%s %/td/tr\n, $myrow[1], $myrow[2], $myrow[3]); I'm following a webmonkey.com tut for php/mysql. http://webmonkey.wired.com/webmonkey/99/21/index3a.html Cheers. Mark Sargent. -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] radio buttons in $_POST
Ashley M. Kirchner wrote: I have this form.html: form method=post action=form.php text input input type=text name=input_testbr / radio input1 input type=radio name=radio_test value=test1 / radio input2 input type=radio name=radio_test value=test2 / input type=submit value=Submit /form Then I have this script (form.php): ?php foreach ($_POST as $key = $val) echo $key = $val\n; ? If I simply submit the form empty, all I get back from the script is the text input $key. The radio button doesn't show up. Why is that and how can I have it show up? (the radio input does show up once one of the radios is checked, but I need it to show up when empty as well.) One way would be to have a selection None and have it selected by default. As in, None input type=radio checked name=radio_test value=None / Or you can just do something like, ?php if(!isset[$_POST['radio_test'])) echo radio_test = none\n; foreach ($_POST as $key = $val) echo $key = $val\n; ? Janet -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php error with MySql
Wil wrote: I get the following error Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/wilmail/public_html/elblog.php on line 7 n= //error ends here with the following bit of code $qResult = mysql_query (SELECT * FROM blog_entries ORDER BY id DESC); $nRows = mysql_num_rows($qResult); $rString =n=.$nRows; If I am just naming a variable how is the argument not valid? It's not valid because your query didn't execute as you expected. So, there is no result resource. I would suggest you use mysql_error() after your query to see what's wrong. Janet -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] about installing php
satya bharti wrote: sir, I am using Red Hat Linux 8.0, and tried many times to install apache 2.0 and php4.0 many times, the message comes that apache and php has installed on my system. when i execute a php program through my web brouser it shows blank. what causes this and how can I solve this problem? plz help on this matter. with regards:- There are two likely sources of this problem. 1. Are you sure you are accessing your PHP program by typing the name into the browser address field, e.g., localhost/test.php. You cannot use File-Open File. 2. The lines you added to httpd.conf are not correct. Check the lines carefully. You may have a typo. You need to add two lines in the correct location: LoadModule php4_module libexec/libphp4.so AddType application/x-httpd-php .php Janet Satya Prakash. Yahoo! India Matrimony: Find your life partneronline. -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include files, .php or .inc ?
Perry Jönsson wrote: Jon-Eirik Pettersen wrote: Perry Jönsson wrote: Hello, Does it make any difference if you include (include/require/include_once/require_once) files with extension .inc or .php? No, it does not. What it the purpose of the .inc file then? For organization. The file name shows what the file is, without having to look at the contents of any scripts. Janet /Perry -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot retrive the data ???
PHPDiscuss - PHP Newsgroups and mailing lists wrote: Hi there, Look at the following code please. I have a mysql db setup and apache running. I have the register_globals=OFF on the php.ini file. The code is suppose to show all the jokes in the databse and give user to enter jokes. The code works fine when when the register_globals=ON in the php.ini file. But for some reason it does not work when it is OFF. Infact when it is OFF it give a blank page with no data retrieved from the databse and gives no errors. Please help me.Code is below... ?php if (isset($_GET[addjoke])){ ? form name=form1 method=post action=?php echo ($PHP_SELF); ? Type your joke :br textarea name=jokeText id=jokeText/textarea br input name=insert type=submit id=submit value=Insert Joke /form With register_globals off, you need to use $_SERVER['PHP_SELF']. You possibly have your errors turned off in php.ini. Check that error_reporting is E_ALL and display_errors is on. Janet -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache+PHP on Windows
[EMAIL PROTECTED] wrote: I have installed Apache 2.0.52 and PHP 5.0.2 on windows XP. I have configured directories and everything works until I unmark any of extensions. After this, during Apache server starting, I am reciving the warning : PHP Startup: Unable to load dynamic library D:/MyWWWsrv/php/ext/php_mysql.dll - the module could not be found the result is that I cannot use MySQL in php scripts. Please, write me back, what should be done to make it working correctly. For MySQL, there are two files that PHP needs to find--php_mysql.dll and libmysql.dll. The simplest, if not most elegant, way to be sure PHP can find them is to copy them into your windows\system32 directory. Janet Thanks a lot. Gregor -- Startuj z INTERIA.PL!!! http://link.interia.pl/f1837 -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] url
Dan McCullough wrote: I have this old script I wrote 2-3 years back. I gets arguments from the url. index.php?area=blah The client moved the code to another server and some odd happened. Nothing seems to be parsing from the URL anymore. The top code is ? if (!isset($area)) { ? HTML THis code no longer seems to work and I am racking my brain trying to figure out what. It probably has to do with settings in php.ini. The new server probably has register_globals = off. The old one probably had it set to on. Try $_GET['area'] instead of $area. Janet Theres no such thing as a problem unless the servers are on fire! - Do you Yahoo!? vote.yahoo.com - Register online to vote today! -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] heredoc syntax
Adil wrote: anyone know why heredoc syntax might not work with php5/apache installed. I can't get even the simplest strings in heredoc syntax to work and I've tried just cutting and pasting other peoples stuff in that syntax as well, and still no luck thx. Adil. Heredoc syntax is pretty rigid and it's easy to have it wrong invisibly. $varname = END Text of string END; The first END must be at the end of the line, nothing after it, not even a blank space. The last END must be at the beginning of the line, not before it, not even a blank space. Janet -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error --- can not solve at this time... please assit
GH wrote: With the following code, I am getting the following message Parse error: parse error, expecting `')'' in /var/www/html/cert/admin_template.php on line 30 Line 30 Reads as follows: foreach($admin_get_options_result as $api = $file, $desc) Your syntax is incorrect on this statement. It should be: foreach($admin_get_options_result as $api = $file) PHP is expecting the ) after $file. Here's the documentation for foreach. http://www.php.net/manual/en/control-structures.foreach.php Janet Can any one please assist. ***ENTIRE CODE STARTING AT LINE 1 FOLLOWS * html head titleADMINISTRATION SCREEN/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body ?PHP require 'mod/db_access.php'; echo 'this is a test of the system'; if(!isset($_GET['api']) || (isset($_GET['api']) ((strlen(trim(urldecode($_GET['api']))) == 0) || (!is_int($_GET['api']) $_GET['api']=0; if($_GET['api'] == 0) { $admin_get_options_query_text = Select * from Adminpage; $admin_get_options_results_reference = mysql_query($admin_get_options_query_text,$db_access) or die(Admin Get Options: . mysql_error()); $admin_get_options_result = mysql_fetch_assoc($admin_get_options_result_reference); if(mysql_num_rows($admin_get_options_results_reference)0) { ? table width=600 TR TD Link /TD TD DESCRIPTION /TD/TR ?PHP foreach($admin_get_options_result as $api = $file, $desc) { echo 'TR TD'; echo 'a href=#?api'.urlencoded($api).' Click Here /a /td'; echo 'TD'.$desc.'/TD/TR'; } ? /table ?PHP } } else { $admin_get_page_query_text = Select * from Adminpage Where adminpageid = $_GET['api'] LIMIT 1; $admin_get_page_results_reference = mysql_query($admin_get_page_query_text,$db_access) or die(Admin Get Page: . mysql_error()); $admin_get_page_result = mysql_fetch_row($admin_get_page_result_reference); if (mysql_num_rows($admin_get_page_results_reference) 0) { require mod/admin/.trim(strtolower($admin_get_page_result[1])); } else { echo ERROR: Invalid Admin Page Requested br; echo 'Please Try Again ... a href=admin_template.php?api=0 Click Here /a'; } } ? /body /html -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with a while loop
Richard Kurth wrote: I am having a problem with a while loop if I put in a number with 0's in front of it it converts the number two the first whole number. such as 1 would be 1 02200 would be 2200. Then it starts the count down starting with that number. How can I make it not remove the 0's in front of the number these are needed to search a certain database . The following script would look like this when run 1 2 3 4 I needed it to look like this 1 2 3 ?php $startnumber=1; $stopnumber=02200; $i = $startnumber; echo $i; while ($i = $stopnumber): echo br ; echo $i; ++$i; endwhile; ? Here's the problem. You set the number originally as a string. However, as soon as you tell PHP to add the number, it becomes an integer. It must. You can't add strings. If you need to use the number as a string inside the loop, you will have to convert it back to a string. You can do this with sprintf, as in: $str_num = sprintf(%05.0f,$i); You can use var_dump($varname) to see what kind of data is stored in $varname. Janet -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Loop within Loop help please
Nick Wilson wrote: hi everyone, I have a simplified bit of code below: ?php foreach($someArray as $someVal) { //do some stuff } ? What i'd like to do is have a count inside that loop that will trigger some action every 20 iterations of the foreach. Like this: ?php $count=0; foreach($someArray as $someVal) { if($count is divisible by 20 exactly) { // do some stuff } //do some stuff } ? How might i do that? if($count % 20 == 0 ) { Janet -- Janet Valade -- janet.valade.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Split haystack at nth occurrence of needle?
Brian Dunning wrote: Thanks Chris, that works great, but it's not doing what I want. I'm just trying to get the position of the 3rd occurrence (for example) of 'br'. So I'm looking for a function that will return the value 19, given the above example string. From your first post, you just want to remove everything after a certain occurrence. I don't understand why explode won't work for you. As in, ? $string = 'onebrtwobrthreebrfourbrfive'; $nthPos = 4; $tmpArr = explode( 'br', $string ); $newArr = array_slice($tmpArr,0,$nthPos-1); $shortString = implode('br',$newArr); ? A function that would give you the position to truncate from would be shorter. But, I don't seem to be finding that function either. So, the above seems like a solution. Janet - Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using foreach() to capture multiple selections
Luke Mackenzie wrote: Subject: using foreach() to capture multiple selections hi, i would like to to put multiple selections from a form list into a single variable using foreach but am unsure how to do so. can someone advise how to adapt the following code? ?php print You are interested in: ; foreach($myGoals as $value) { print $value ; } ? I'm not totally sure what you are looking for. It looks like you have values in an array $myGoals. I'm assuming you collected the form values in the array, so you have $myGoals[0], $myGoals[1], etc. Are you saying you want all the values in MyGoals added to a single variable as a string? If so, look at the function implode. www.php.net/manual/en/function.implode.php Or, you can have a statement in your forrach loop something like: $string .= $value. ; Janet - lukem - quality custom t-shirts browse - www.lukem.co.uk contact- [EMAIL PROTECTED] need a new website? get over to http://www.lukem-sites.co.uk http://www.lukem-sites.co.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] password-protecting with PHP, help plz
[EMAIL PROTECTED] wrote: I appreciate the help, but unfortunately it still doesn't work. I changed testing2.php, the action page to do this: ?php if ($_POST['user']) == me { echo Andrew; } else { echo not me; } ? I still get a blank page. What's more I turned on Display Errors and restarted the server, but still got no error message. Your errors are still not displaying. Recheck display errors and error_reporting. Your line with the if statement is generating a parse error. You have an = sign that PHP is sure to complain about. Janet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] password-protecting with PHP, help plz
[EMAIL PROTECTED] wrote: You were right, my display_error function was turned off. I turned it on and get this: Parse error: syntax error, unexpected T_IS_EQUAL in c:\TSW\pages\testing2.php on line 3 So it isn't working. How do I get to let me make comparisons between the post data and something else? I figure if I can get it so that this will work, it'll be an easy way to password protect my pages... -Andrew The syntax is: if (comparison){ You have: if ($_POST['user']) == me { Part of your comparison is not inside the parentheses. You need to have: if ($_POST['user'] == me) { Also, your string isn't quoted. That's not causing the parse error in this message, but will cause a problem after you fix your parentheses. (e.g., me). Janet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How is SESSION_ID passed?
- Original Message - From: Alex Shi [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, May 24, 2002 8:25 PM Subject: [PHP] How is SESSION_ID passed? Hello, I have created several web sites using php. In all these sites session id is passed via cookie. However I noticed that some times it was passed by url. I am thinking that to pass session id by url will be safer than by cookie. However I don't know how can do this without change my code. Do I have to do any configuration on php so that I can use url session id but don't need to modify my code? If the user has cookies turned on, PHP passes the session ID using cookies. If the user has cookies turned off, different things can happen. If trans-sid is turned on, PHP passes the session ID in the URL for links or in a hidden variable for forms that use the post method. If trans-sid is not turned on, you have to pass the session ID yourself. Janet Alex -- 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] method=post problem
You need double quotes around the value. E.g., input type=hidden name=quiz[owner_name] value=$quiz[owner_name] - Original Message - From: Jule [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 15, 2002 6:27 PM Subject: [PHP] method=post problem Hey guys and gals, i have a form with method=post which sends input type=hidden name=quiz[quiz_title] value=$quiz[quiz_title] input type=hidden name=quiz[owner_name] value=$quiz[owner_name] input type=hidden name=quiz[owner_email] value=$quiz[owner_email] input type=hidden name=quiz[number_answers] value=$quiz[number_answers] input type=hidden name=submitted value=TRUE to the same page, and picks it up in an if ($submitted) {} loop. but now here's the problem: when it comes back and goes into the loop. Only the first name from $quiz[owner_name] is left, so where it used to be John Doe, is now only Joe. how do i fix this? thanks Jule -- |\/\__/\/| | Jule Slootbeek | | [EMAIL PROTECTED] | | http://blindtheory.cjb.net | | __ | |/\/ \/\| -- 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] Newbie Question
On the browser i have a page in which i select the first button which has a link in the form of products.php?tosend = 1 but in the second pagein where I try to trap the value of tosend to include a file, i don't get anything. I assume you mean that you can see the value in the URL, but when you access $tosend, it has no value. You should be able to get it from $_GET['tosend']. Or if you are using a version of PHP prior to 4.1.0, you can use $HTTP_GET_VARS. The problem may be that you have register_globals turned off. Janet If somebody could help me TYA Hubert DAUL Lyon - France -- 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 problem
The message means that that your script produced some output before the session_start. You have to use session_start before any output. The message shows where the output was started (line 9 of the given file). Sometimes output is started accidentally by having a blank space before your ?php tag. Janet - Original Message - From: Torkil Johnsen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, April 15, 2002 2:07 AM Subject: [PHP] Session problem I get this errormessage when trying to make my logon work: Warning: Cannot send session cache limiter - headers already sent (output started at /path/to/my/little/session.inc:9) in /path/to/my/little/session.inc on line 10 line 10 contains: session_start(); It does however seem like I am logged in, becase at the bottom of my page, my logout button is appearing. (which it is only supposed to do if session_is_registered(session_id) When clickign the logout button I get this message: Warning: Trying to destroy uninitialized session in /path/to/my/little/session.inc on line 37 Where line 37 says:session_destroy(); Anyone...? Anyone have any links to any really good php session examples? I have read quite a few of them now... -- 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] nullifying php and html tags?
Yes, there is a function strip_tags(). Also look at the functions, htmlentities() and htmlspecialchars(). Janet - Original Message - From: Police Trainee [EMAIL PROTECTED] To: PHP [EMAIL PROTECTED] Sent: Monday, February 18, 2002 9:47 PM Subject: [PHP] nullifying php and html tags? Hello. I just finished creating a simple input form in which the contents of a textarea get written to a file which in turn gets read by a particular page. is there anyway to disable any html or php tags that the user might have typed in? it seems pretty dangerous to allow a user to enter any amount of php programming at their will. something as simple as a function that strips all 's and 's would work just as well i would imagine. thanks! -mark __ Do You Yahoo!? Yahoo! Sports - Coverage of the 2002 Olympic Games http://sports.yahoo.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] Include file for MySQL insert rows
INCLUDE is not really what you are looking for. INCLUDE is more to read in files that contain PHP code. If I'm understanding correctly, what you want to do is to read each line from your file and put each line into a separate variable. Then, you can create the INSERT statement for each row. It might go something like this: $fp = fopen(testsql,r) ; while ($row = fgets($fp,1024)) { $query = INSERT INTO catalogwinetmp VALUES $row; $result = mysql_query($query); } It looks like there might be something at the end of each line that you need to remove before you construct the query. A comma on the first line and a semicolon on the second line. Janet - Original Message - From: Paul Fowler [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, February 17, 2002 8:17 PM Subject: [PHP] Include file for MySQL insert rows I am very new at this and am having trouble migrating to php and mysql from a different system (WebCatalog). I want to start dumping files to text and let php use them to populate mysql on the fly as I start migrating. snip--- $db = mysql_pconnect(host, user, pass); $query = insert into catalogwinetmp values include(testsql); $result = mysql_query($query); ---end-snip The contents of testsql look like this (19, 38080, 'Senejac', 'Haut-Medoc / Cru Bourgeois', '', 12, 1995, 'Bottle - .75L', 'LN, LE, CI', 135, '/collectors/images/bottles/38080.JPG'), (20, 38780, 'Yquem', 'Sauternes / Premier Cru Superieur', '', 1, 1927, 'Bottle - .75L', 'TS, LP, CI', 465, '/collectors/images/bottles/38780.JPG'); Just with more lines (1-18). But I can not get rid of errors in the $query = insert into catalogwinetmp values include(testsql); No matter what quotes and semi-colons I put in testsql or in this script. If I try to set the contents of the include into a variable as in: $rowsToAdd = include(testsql); all I get is the value 1, I guess this is because it is successful. If I could get a variable to contain the contents of the include I am not sure if I could use it in the script. I am not sure if I am even getting warm or if I am on another planet. 1. Any ideas how I can simply make php get a text file into the mysql database? 2. Is there a way to set a (albeit maybe large) variable with the contents of an include file? Sorry to sound like such a php newbie, but I am. Kind thanks, Paul -- 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 to start a secure HTTP session?
To have a secure HTTP session, you must be communicating with a secure web server. This is apache. It has nothing to do with PHP or Linux. You classmate was right. The only difference for SSL is that you use https instead of http. To find out if your server can communicate using SSL, try it. If you try to access a web page using https and the server is not a secure server, you will get an error message. Page connot be displayed. If you are using Apache and you installed it yourself, if you did not do extra stuff to make it SSL, then it is not. For more info, go to main apache web site, www.apache.org, and follow links to apache-ssl and mod_ssl. Janet - Original Message - From: gaukia 345 [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, February 18, 2002 5:43 AM Subject: [PHP] How to start a secure HTTP session? I heard from my coursemates it's just typing https:// instead of http://. 1) To enable secure http (SSL) session, what extensions should I install? To which one: Apache or PHP or Linux? 2) How do I know if my Apache and/or Linux and/or PHP support SSL? Thanx _ Send and receive Hotmail on your mobile device: http://mobile.msn.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 register!!
Did you use session_start() on the second page? In other words, the first page should have session_start(); session_register(the_var); $the_var=-here it is; link or whatever takes you to the second page. Then the second page needs session_start(); echo $the_var; Janet - Original Message - From: Cristian Cerda [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 08, 2002 11:15 AM Subject: [PHP] session register!! Hi there, hope you can help me with my problem. I'm trying to set up a PHP/MySQL web site using session variables to pass information between pages. So far no good. I did set register_globals to On on the php.ini file. But when i use for example session_register(the_var) in one page ( using session_start() at the beginning), i don't get anything on the next page if i do echo $the_var . Don't know what's wrong, but my guess is i have something wrong with the configuration as i copy/pasted most of the code. I'm using OS X / WebSTAR V / PHP 4.0.6 as a CGI / MySQL please help Cristian -- 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] Re: Does anyone have the 'edit_member.php' script ....
The problem is on this line. print (INPUT TYPE=\submit\ NAME=\button\ value=\ Submit\\n); There is a space between the \ and the before Submit. Janet - Original Message - From: Mike C [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Saturday, January 19, 2002 4:02 AM Subject: [PHP] Re: Does anyone have the 'edit_member.php' script It was suggested I send this to the list. The 'samp_db.inc' file follows this. The parse error is: Parse error: parse error in /edit_member.php on line 11 #edit_member.php ?php include (/users/mike/documents/include_files/samp_db.inc); define (initial_page, 0); define (display_entry, 1); define (update_entry, 2); function solicit_member_id () { global $PHP_SELF; printf (FORM METHOD=\post\ ACTION=\%s?action=%d\\n, $PHP_SELF, DISPLAY_ENTRY); print (Enter your membership ID number and password,\n); print (then select submit.\nBRBR\n); print (TABLE\n); print (TR); print (TDMember ID/TDTD); print (INPUT TYPE=text NAME=\member_id\ size=10BR\n); print (/TD/TR); print (TR); print (TDPassword/TDTD); print (INPUT TYPE=password NAME=\password\ size=10BR\n); print (/TD/TR); print (/TABLE\n); print (INPUT TYPE=\submit\ NAME=\button\ value=\Submit\\n); print /FORM\n; } function display_entry () { global $PHP_SELF; global $member_id, $password; $member_id = trim ($member_id); if (empty ($member_id)) die (No member ID specified); if (!ereg (^[0-9]+$, $member_id)) die (Invalid member ID specified (must be a number)); if (empty ($password)) die (No password specified); if (check_pass ($member_id, $password)) $admin = 0; else if (check_pass (0, $password)) $admin = 1; else die (Invalid password); $query = SELECT last_name, first_name, suffix, email, . street, city, state, zip, phone, interests, . member_id, expiration . FROM member . WHERE member_id = $member_id . ORDER by last_name; $result = mysql_query ($query) or die (Cannot execute query); if (mysql_num_rows ($result) == 0) die (No user with member_id = $member_id found); if (mysql_num_rows ($result) 1) die (More than one user with member_id = $member_id found); printf (FORM METHOD=\post\ ACTION=\%s?action=%d\\n, $PHP_SELF, UPDATE_ENTRY); hidden_field (member_id, $member_id); hidden_field (password, $password); print (TABLE\n); $row = mysql_fetch_array ($result); display_column (Member ID, $row, member_id, 0); display_column (Expiration, $row, expiration, $admin); display_column (Last name, $row, last_name, 1); display_column (First name, $row, first_name, 1); display_column (Suffix, $row, suffix, 1); display_column (Email, $row, email, 1); display_column (Street, $row, street, 1); display_column (City, $row, city, 1); display_column (State, $row, state, 1); display_column (Zip, $row, zip, 1); display_column (Phone, $row, phone, 1); display_column (Interests, $row, interests, 1); print (/TABLE\n); print (INPUT TYPE=\submit\ NAME=\button\ value=\ Submit\\n); print /FORM\n; } function check_pass ($id, $pass) { $query = Select password from member_pass where member_id = $id; if (!($result = mysql_query ($query))) die (Error reading password table); if (!($row = mysql_fetch_array ($result))) return (FALSE); return ($row[password] == $pass); } function display_column ($label, $row, $col_name, $editable) { print (TR\n); printf (TD%s/TD\n, htmlspecialchars ($label)); $value = htmlspecialchars ($row[$col_name]); if ($editable) { $str = sprintf (INPUT TYPE=text NAME=\row[%s]\, $col_name); $str .= sprintf ( VALUE=\%s\ SIZE=\80\\n, $value); } else $str = $value; printf (TD%s/TD\n, $str); print (/TR\n); } function update_entry () { global $row, $member_id, $password; $member_id = trim ($member_id); if (empty ($member_id)) die (No member ID specified); if (!ereg (^[0-9]+$, $member_id)) die (Invalid member ID specified (must be number)); if (!check_pass ($member_id, $password) !check_pass (0, $password)) die (Invalid password); $result = mysql_query (select * from member where 1 = 0); if (!$result) die (Cannot query member table); $query = Update member ; $delim = set ;# put set before first column,, before others while (list ($col_name, $val) = each ($row)) { $query .= $delim $col_name =; $delim = ,; $val = trim ($val); if (empty ($val)) { if (nullable ($result, $col_name)) $query .= NULL; else $query .= \\; } else $query .= \ . addslashes ($val) . \; } $query .= where member_id = $member_id; if (mysql_query ($query) mysql_affected_rows () 0) print (Entry updated successfully.\n); else print (Entry not updated.\n); } function nullable ($result, $col_name) { for ($i = 0; $i mysql_num_fields ($result); $i++) { if (!($fld = mysql_fetch_field ($result, $i))) continue; if ($fld-name == $col_name) return (!$fld-not_null); } return (0); } if (empty ($action)) $action = INITIAL_PAGE; $title = Historical League member editing form; html_begin
Re: [PHP] Newbie: Ending Sessions
I'm not sure what you mean by the session is still active, but if you mean that the variables still are set to the same values, try moving the session_unregister after the session_unset, but still before the session_destroy. Janet - Original Message - From: Lee P Reilly [EMAIL PROTECTED] To: PHP List [EMAIL PROTECTED] Sent: Wednesday, January 16, 2002 8:58 AM Subject: [PHP] Newbie: Ending Sessions Hi, I wonder if someone could tell me what I am doing wrong with the following? I am trying to end a session (logout), but am having a problem... I register a new session as follows: authenticate.php (snippet) // if the user has just tried to login if ($username $password) { // if the user is present in the database, register the username in the session if (login($username, $password)==1) { $valid_user=$username; session_register(valid_user); } } ^ This works okay. BTW, session_start() is present - just not shown above. I then have a hyperlink to a logout function: logout.php (snippet) session_start(); include(sasdap_fns.php); $result = session_unregister(valid_user); session_unset(); session_destroy(); ^ $result always returns 1, but when I return to /reload /refresh the login screen I see that I am still logged in i.e. the session is still active. Can anyone see a problem anywhere? Thanks very much in advance. - Best regards, Lee -- 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] sql question
select * from tbl_lit where lit_source like c% Janet - Original Message - From: Wolf-Dietrich von Loeffelholz [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 15, 2002 12:09 PM Subject: [PHP] sql question i want that a select query display me all words beginning with an a .. like select * from tbl_lit where lit_source = 'c*' .. thnx bSue -- 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] ereg problem
I am using the following statement to check phone numbers. if (!ereg("^[0-9\-\+\.\ \)\(]{10,}$",$value)) { Can anyone tell me why this works for every character except the -. It doesn't see the hyphen as a valid part of the phone number, even though it recognizes the other characters, e.g. + or . Janet -- 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] ereg problem
Thank you. That was exactly the problem. Janet -Original Message- From: Charlie Llewellin [SMTP:[EMAIL PROTECTED]] Sent: Wednesday, February 14, 2001 11:00 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] ereg problem the - needs to be immediately after the [ to include that character. Otherwise it is a range indicator. Charlie - Original Message - From: "CC Zona" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 14, 2001 12:56 PM Subject: Re: [PHP] ereg problem In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Janet Valade) wrote: if (!ereg("^[0-9\-\+\.\ \)\(]{10,}$",$value)) { Can anyone tell me why this works for every character except the -. It doesn't see the hyphen as a valid part of the phone number, even though it recognizes the other characters, e.g. + or . Try: if (!ereg("^[0-9+. )(-]{10,}$",$value)) -- CC -- 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]