[PHP] passing variables to a sql statement
hi, i'm hoping someone can help me out here - im trying to pass a variable from a string in the href tag, however my sql breaks when i put a var in the statment. when i replace $foo with a number, the page works fine. can someone please tell me what im doing wrong? here is the error i get: Warning: Supplied argument is not a valid MySQL result resource in /home/villany2k1/www.villany2k1.com/htdocs/projects/projects_descrip.php on line 11 here is my code: descrip; echo(""); echo("" . "$foo" . " | "); echo(""); } ?> thanks in advance, jennifer
[PHP] connecting to a txt file - newbie
good morning, im having some issues with the simple task of pulling from a txt file. my code is: job app db and the txt file contains one line of bogus txt. you can see my results here: http://www.villany2k1.com/text.php. if anyone has any info as to what i am doing wrong, i would really appreciate it. thanks so much jennifer ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions
I have been doing a few test pages trying to figure out how sessions work. The SID is not being automatically added to my urls so I assume that means that php was not compiled with -enable-trans-sid (I'm on a virtual server so I can't access php.ini) So that means that I need to add to all my urls, correct? Can I change the value of session_name() and still have the above work for the new session name? I tried it and the session_name was changed to the new value, but then SID seemed to be empty after that. Is there something I am missing or is that the way it is supposed to work? Jennifer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] session_register()
I have been racking my brain with this for hours and I am not getting anywhere. session_register doesn't seem to be registering my variables. Several questions to see if I am even on the right track. Do you need to register a variable with the session before you assign it a value? session_register should return true if the variable was successfully registered? The variable name and it's value should be written to the file with the same name as session_id()? Jennifer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] session_register()
"Johnson, Kirk" wrote: > > > -Original Message- > > From: Jennifer [mailto:[EMAIL PROTECTED]] > > Do you need to register a variable with the session before you > > assign it a value? > > Not in my experience. > > > session_register should return true if the variable was > > successfully registered? > > It returns "1". > > > The variable name and it's value should be written to the file > > with the same name as session_id()? > > Yes, here's a sample from a session file: superUser|s:3:"Yes"; > Here's a sample session filename: sess_01bc2e24aa5291300887948f0af74899 This is all what I thought, but I am still having problems and I don't have a clue what I am missing. Here's an example that I have been paying with for testing. page1.php contains \n"; if (session_register("testing")) { echo "session_register worked.\n"; } else { echo "session_register did not work\n"; } if (session_is_registered("testing")) { echo "testing is a registered variable\n"; } else { echo "testing is not a registered variable\n"; } $testing = "Let's see if this works."; ?> Go to next page. The output of the above page, gives me session id is e35c2893382e28a14fa0455302edb06e session_register did not work testing is a registered variable Go to next page. and page2.php contains \n"; echo "Testing: $testing\n"; ?> The output of page2 gives me session id is e35c2893382e28a14fa0455302edb06e Testing: I am totally confused. First off, why isn't it registering the variable? There is a file named e35c2893382e28a14fa0455302edb06e in my /tmp directory, but it is empty. Second, if it isn't registering the variable then why is session_is_registered("testing") returning true? Jennifer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] session_register()
Warren Vail wrote: > > When the session_register is executed the session contents are partially > updated. > Your first test actually executed the session_register that posted the > variable with 0 string length, because the variable had not yet been > initialized (the bad return is the only indication of this). Ok. I changed the script below to set the variable before registering it and it makes no difference to the output. > You can identify what actually happened by viewing the session file contents > after your two pages are displayed. I mentioned that already. The file is empty. Jennifer > "Johnson, Kirk" wrote: > > > > > -Original Message- > > > From: Jennifer [mailto:[EMAIL PROTECTED]] > > > Do you need to register a variable with the session before you > > > assign it a value? > > > > Not in my experience. > > > > > session_register should return true if the variable was > > > successfully registered? > > > > It returns "1". > > > > > The variable name and it's value should be written to the file > > > with the same name as session_id()? > > > > Yes, here's a sample from a session file: superUser|s:3:"Yes"; > > Here's a sample session filename: sess_01bc2e24aa5291300887948f0af74899 > > This is all what I thought, but I am still having problems and I > don't have a clue what I am missing. Here's an example that I > have been paying with for testing. > > page1.php contains > session_start(); > echo "session id is ".session_id()."\n"; > if (session_register("testing")) { > echo "session_register worked.\n"; > } > else { > echo "session_register did not work\n"; > } > if (session_is_registered("testing")) { > echo "testing is a registered variable\n"; > } > else { > echo "testing is not a registered variable\n"; > } > $testing = "Let's see if this works."; > ?> > Go to next page. > > The output of the above page, gives me > session id is e35c2893382e28a14fa0455302edb06e > session_register did not work > testing is a registered variable > Go to next page. > > and page2.php contains > session_start(); > echo "session id is ".session_id()."\n"; > echo "Testing: $testing\n"; > ?> > > The output of page2 gives me > session id is e35c2893382e28a14fa0455302edb06e > Testing: > > I am totally confused. First off, why isn't it registering the > variable? There is a file named e35c2893382e28a14fa0455302edb06e > in my /tmp directory, but it is empty. > > Second, if it isn't registering the variable then why is > session_is_registered("testing") returning true? > > Jennifer -- 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] Working with numbers
I have a shopping cart that allows decimal points for quantities. I like it like that, but would like to remove any trailing zeros and if the quantity is not a fraction I would like to remove the decimal point too. What would be the easiest way to do this? I don't see any function that would make it easy. Jennifer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] session_register()
This is bad, bad, bad. I tried using another browser as you suggested (since I was using Netscape 4.7) and the session_register worked. I still got different results than you though. Read throughout for more comments. "Johnson, Kirk" wrote: > > Jennifer, there are at least two of us totally confused. I did a copy and > paste of your code and got the expected results: > > session id is afb1f9e27afc752f7d9e96e096ca2209 > session_register worked. > testing is a registered variable Using IE 5, I got the same results here as with NS4.7 session id is e49f9b5ddb39388ab48c45dd4f14b00c session_register did not work testing is a registered variable Go to next page. *But* It did work. So why did session_register return false? > with the contents of /tmp/sess_afb1f9e27afc752f7d9e96e096ca2209 being: > > testing|s:24:"Let's see if this works."; This is the contents of my session file too *when* I use IE for my browser. > 1. What browser are you using? I, and others, have seen erratic results with > sessions using Netscape 4.x. If this is your browser, try your code with > another browser, if possible. This appears to be the problem. Now what? So I have to forget about sessions or forget about the multitude of NS 4.x users that still exist? > 2. This is a longshot, but who is PHP running as? By default, it is nobody. > In any case, check that whomever PHP is running as has write permission to > /tmp. I had thought of that one. I increased the permissions to be world writable and it had no effect. Thank you for helping me find the problem, now I just wish there was an easy solution. Arggg. Jennifer -- 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] Working with numbers
Christian Reiniger wrote: > > On Thursday 03 May 2001 08:53, Jennifer wrote: > > > I have a shopping cart that allows decimal points for quantities. > > I like it like that, but would like to remove any trailing zeros > > and if the quantity is not a fraction I would like to remove the > > decimal point too. > > > > What would be the easiest way to do this? I don't see any > > function that would make it easy. > > It's so easy that you don't need a function for it :) > > $Qty = "12.470"; > $Qty_real = (double) $Qty; > > echo "$Qty - $Qty_real"; > > In other words - convert it from a strin to a floating-point number and > PHP will do the rest. I've done some searching on the php site for more info about double and float etc, but I don't really understand anything I found. Can someone give me an explanation about the difference between decimal, float, double? Should I be using decimal as my column type in the MySQL database or should I be using a different column type? Jennifer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] session_register() - Netscape workaround?
"Johnson, Kirk" wrote: > > > -Original Message- > > From: Jennifer [mailto:[EMAIL PROTECTED]] > > Subject: Re: [PHP] session_register() > > > > 1. What browser are you using? I, and others, have seen > > erratic results with > > > sessions using Netscape 4.x. If this is your browser, try > > your code with > > > another browser, if possible. > > > > This appears to be the problem. Now what? So I have to forget > > about sessions or forget about the multitude of NS 4.x users that > > still exist? > > At least 3 of us have reported this problem here on this list. No one seems > to have an answer. On the up side, it seems to be erratic, Netscape 4.x > sometimes works. Realistically, this affects less than 10% of your visitors. > So I don't know what else to say, except good luck! > I thought of a workaraound for Netscape and would like some feedback on how to do it and whether it is a good idea. I manually edited the session file and Netscape was able to read the variable on subsequent pages. It just can't seem to write it. So I thought, until Netscape 4.x is more of a gonner, I could have my own custom_session_register() function that can open the file and write the info manually. 2 questions. 1) Is there some reason that this would be a bad idea? 2) What is the format of the file? My file contents are testing|s:24:"Let's see if this works."; So that is variable_name|what is the s for? scalar maybe?:value_length?:value in quotes; And I'm assuming that a newline delimits the variables? Sorry, haven't tried a test with more than one variable yet. Jennifer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] session_register() - Netscape workaround?
Jennifer wrote: > I thought of a workaraound for Netscape and would like some > feedback on how to do it and whether it is a good idea. > > I manually edited the session file and Netscape was able to read > the variable on subsequent pages. It just can't seem to write > it. > > So I thought, until Netscape 4.x is more of a gonner, I could > have my own custom_session_register() function that can open the > file and write the info manually. > > 2 questions. > 1) Is there some reason that this would be a bad idea? I would still really like to know this answer. > 2) What is the format of the file? My file contents are > testing|s:24:"Let's see if this works."; I think I figured this out. variable_name|variable_type*:length*:value*; *variable_type is the first letter of the type *length can be diferent things depending on the variable type. I've only tried a few, but here is what I have gathered thus far. If type is string, then length is the length of the value, pretty simple. If type is integer then there is no length and it is skipped altogether rather than being left blank. If type is array, then length is the number of elements. *value can also vary depending on type. If type is string, then it is simply the value quoted, if the type is integer then it is simply the value. If type is array, then each element of the array is described by type and length etc. After trying a few, it's not too difficult to see the pattern. Jennifer -- 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] fopen failing to connect
Hello I have a script which uses fopen( ). It works on my local machine which has php and apache on a windows platform as well as on another server (php/apache) which is windows based. However, when I have the same script on a unix machine (php/apache), the fopen gives me the following error: Warning: php_hostconnect: connect failed in /usr/local/apache/htdocs/514parser.php on line 135 Warning: fopen("http://www.thedeal.com/NASApp/cs/ContentServer?pagename=TheDeal/xmlfeed";, "r") - Bad file number in /usr/local/apache/htdocs/514parser.php on line 135 Any suggestions? -jennifer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fopen failing to connect
i looked at the php.ini file and f wrapper is configured. thanks for the suggestion. i am still looking for any suggestions anyone has. thanks. -jennifer Miguel Cruz wrote: > Sounds like maybe the fopen url wrapper is not installed. I've never taken > any particular steps to install it, so I'm not sure how that would come > about. > > miguel > > On Wed, 15 May 2002, jennifer jefferson wrote: > > thanks for looking. my guess is that it could be a > > server configuration issue. i am really not sure. the > > actual script works just not on the server i need > > it to work on. maybe it has something to do with the > > .ini file or the installation. i am not very familiar > > with that. does this sound likely as a problem? > > thanks. > > > > -jennifer > > > > --- Kevin Stone <[EMAIL PROTECTED]> wrote: > > > Jennifer, works just fine here.. > > > > > > - > > > $fp = > > > > > fopen("http://www.thedeal.com/NASApp/cs/ContentServer?pagename=TheDeal/xmlfe > > > ed","r"); > > > if ($fp !== FALSE) > > > echo "The file exists!"; > > > else > > > echo "The file does not exist"; > > > - > > > > > > This prints "The file exists!" so it may be > > > something else in your code > > > cuasing the problem. And when I read the file it > > > displays a bunch of > > > numbers. Don't know what you could be doing wrong > > > but if you continue to > > > experiece problems post some more of your code and > > > maybe we can decipher the > > > error from that. > > > > > > -Kevin > > > > __ > > Do You Yahoo!? > > LAUNCH - Your Yahoo! Music Experience > > http://launch.yahoo.com > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mail()
Hi guys, I'm new to PHP and i'm trying to set it up so that i can use the mail() function to send emails. I'm using Mac OS X 10.1.3, PHP 4.1.2 and Apache/1.3.20. I've copied the php.ini-dist to usr/local/lib and renamed it php.ini I have also uncommented the following lines from the httpd.conf - AddType application/x-httpd-php .php .phtml AddType application/x-httpd-php-source .phps The server was also restarted using the command: sudo apachectl graceful When i run my .php file containing: ... nothing seems to happen ei. the mail was not sent. Can anyone suggest anything that i could do to try and rectify this problem. Thanks in advance. -jen-
Re: [PHP] mail()
sorry...i should have mentioned also that I am not using the internal mail server but i am using an external mail server On Wednesday, March 20, 2002, at 05:24 PM, Jennifer wrote: > Hi guys, > > I'm new to PHP and i'm trying to set it up so that i can use the mail() > function to send emails. I'm using Mac OS X 10.1.3, PHP 4.1.2 and > Apache/1.3.20. > > I've copied the php.ini-dist to usr/local/lib and renamed it php.ini > > I have also uncommented the following lines from the httpd.conf - > AddType application/x-httpd-php .php .phtml > AddType application/x-httpd-php-source .phps > > The server was also restarted using the command: > sudo apachectl graceful > > When i run my .php file containing: > > > $to="[EMAIL PROTECTED]"; > $from="[EMAIL PROTECTED]"; > $subject="Hi"; > $message="this message"; > mail($to, $subject, $message, "$from\r\nX-Priority: 1 (Highest)"); > > ?> > ... nothing seems to happen ei. the mail was not sent. > > Can anyone suggest anything that i could do to try and rectify this > problem. > Thanks in advance. > > -jen- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] TTF Support
How do I find out if my installation supports this? I am on a virtual server, and I know my host has Apache installed with mod_php4 Is there something that I can check to see if the FreeType library is there when I only have a virtual server? And if it wasn't installed, is there any way that I can do this locally without having root access? Jennifer -- 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] What is Dynamic Library support
When I do phpinfo() on my server one of the things it says is PHP_DL Dynamic Library support enabled. What does that mean? Jennifer -- 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] is_null
I wanted to use is_null, but it isn't available in my version (4.0B2) What would be an equivalent? I'm fairly new to PHP. I was using isset, but sometimes it is set to Null. Null values are unacceptable, but zero is a perfectly acceptable value for what I want. Jennifer -- 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] How to add a new color to JPEG
> > > -Original Message- > > > From: SED [mailto:[EMAIL PROTECTED]] > > > According to the manual, you can only get closest value of your > > > desired color by letting the ImageColorClosest() find it. Therefore, > > > if the image is totally black, you can not get the yellow color. I > > > have not found a way to do this though I believe I have tried > > > everything. And yet, I have not found any documents covering this > > > other than PHP-manual. I didn't get this from reading the manual, but I struggled with this problem for days and finally gave up. I posted to some other forums when this one was done and found no answers. Now, I know it isn't just me and I know what the problem is, but I still don't know a solution. I am creating an image on the fly and I have no problem if I am just using a background color and adding text to it or if I use ImageCreateFromPNG, but if I use ImageCreateFromJPEG and try to add text on top of that or even a rectangle or anything on top, it seems to ignore the color that I specify and always came out grey. (Of course now if I use ImageColorClosest(), some colors work because they are in my image.) It doesn't matter what I output it as, only what I read it in as. And if I read it in as a png, the image quality is horrible which I also don't understand. It seems to have drastically reduced the number of colors used. My phphinfo says GD version 1.6.2 or higher I'm using PHP Version 4.0.1pl2 Here is my test page. http://216.122.251.174/test/test.php Here is the source for the graphic http://216.122.251.174/test/button.phps Any idea on how solutions? Jennifer -- 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] How to add a new color to JPEG
Jennifer wrote: > it seems to ignore the color that I specify and always came out > grey. (Of course now if I use ImageColorClosest(), some colors > work because they are in my image.) > > > Any idea on how solutions? > Oops. I didn't read far enough. I found the following in a separate thread. > I experienced the same, but i use following workaround: > Create a new Jpeg, Allocate your colours, and copy your original jpg > into the new one. then you have all the colours you have allocated in > your new pic... So now my question is, how do I copy one image into another? I see ImageCopy(), but it mentions copying a part of the image, so do I have to use GetImageSize to determine the size of the src image first? Jennifer -- 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] Whitespace in Emails
I'm experiencing a strange problem and difficult to diagnose because it's random. I have built an application that sends out an email with a nice amount of text (don't have exact char count, but could get it). On the html email, a random whitespace appears in the content, but always toward the end pointing to a possible character count issue. See below for examples of how the space wanders and is random: 1- "Th ere are several things being discussed in this email." 2- "There are se veral things being discussed in this email." 3- "There are severa l things being discussed in this email." This whitepace issue happens after the email is sent. Anybody have any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP and MySQL bug
It would be helpful if you posted that error. You can get it by changing the die to $queryr = mysql_query($query) or die(mysql_error()); Without knowing the error, you problem will be harder for everyone to debug. -Original Message- From: Nuno Lopes [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 10:09 AM To: MySQL List; [EMAIL PROTECTED] Subject: Re: PHP and MySQL bug The problem is if I close the connection and reopen it the query is done, but if I remain with the same connection has the previous query, mysql returns an error. - Original Message - From: "Larry Brown" <[EMAIL PROTECTED]> To: "MySQL List" <[EMAIL PROTECTED]> Sent: Sunday, January 05, 2003 4:16 PM Subject: Re:PHP and MySQL bug > Try replacing the following line... > > @MYSQL_QUERY("UPDATE d SET h='$h' WHERE id='$id'"); // this query doesn't > work > > With... > > $query = "UPDATE d SET h='$h' WERE id='$id'"; > $queryr = mysql_query($query) or die("The sql statement does not execute"); > > if(mysql_affected_rows() !== 1) > { >die("The sql statement is successfully run however either h did not > change or there is an internal error. Try executing the sql from the > command line to make sure it otherwise works."); > } > > and see which is coming back. > > > Larry S. Brown > Dimension Networks, Inc. > (727) 723-8388 > - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] preg_replace - understanding
> $filevalue = str_replace("\\", "/", $filevalue); > > it is reversing the "\\" to "//" but not replacing them with just a single > "/". I think you need to escape your \ so each \ is \\ so your string should be "" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php - javascript together prob?
Since you had problems with quotes yesterday too, I would suggest reading the manual page on strings so you do not continue to have the same problems day after day. http://www.php.net/manual/en/language.types.string.php > -Original Message- > From: Micah Montoy [mailto:[EMAIL PROTECTED] > Sent: Wednesday, July 09, 2003 2:51 PM > To: [EMAIL PROTECTED] > Subject: [PHP] php - javascript together prob? > > > Anyone have an idea of how to get this to work? Its the onClick part that > wont work. I know if I pull it out of PHP it works just fine but > I need it > part of the script as I have a loop that it runs under. > > echo (""); > > I considered and tried sending it to a js function but it doesn't like not > having the " but I need the quotes in the echo statement to read in the > variables passed to it. > > thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Returning values from functions
> function auth_user($logged_in) { > if (isset($logged_in)) { > list($s_username, $hash) = explode(',',$logged_in); > global $secret_word; > if (md5($s_username.$secret_word) == $hash) { > $username = $s_username; > return $username; > } else { > die ("You have tampered with your session."); > } > } else { > die ("Sorry, you are not logged in. Please log in and try again."); > } > } > auth_user($_SESSION['login']); > var_dump($username); $username = auth_user($_SESSION['login']); will actually assign the returned value to the variable $username. The $username variable in your function does not have global scope and only exist in the function. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Javascript multi text box form validation?
> 2. a sql_scrubber function to handle the apostrophes addslashes() http://www.php.net/manual/en/function.addslashes.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySQL/PHP problem.
Off the top of my head, try using OR in your query rather than AND day=\"2\" or day=\"3\" day probably won't equal both 2 and 3, which is why you are getting 0. Also, if you group by item name, you are going to get the total for each itemname, is that what you want, or just the overall total? > -Original Message- > From: Phillip Blancher [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 22, 2003 2:09 PM > To: PHP List > Subject: [PHP] MySQL/PHP problem. > > > I am trying to count in mySQL the number of entries in the field > "day" where day=2 or 3. > > Then I want to check just to see if that returned a value greater > than 0 or not. > > I am using the code below, but having a problem, I keep getting 0 > as the total > > What am i doing wrong. > > >$dbqueryshipping1 = "select *, COUNT(day) from > tempuserpurchase where day=\"2\" and day=\"3\" GROUP BY itemname"; > $resultshipping1 = > mysql_db_query($dbname,$dbqueryshipping1); > if(mysql_error()!=""){echo mysql_error();} >$shipping1 = mysql_fetch_array($resultshipping1); > > > > Thanks in advance, > > Phil > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.501 / Virus Database: 299 - Release Date: 7/14/2003 > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] newbY prob
> ! am trying to count the number of items in this table. The table > has one field in it. > > The code I am using is: > > $dbquerymeal = "select COUNT(*) from mealtype"; > $resultmeal = mysql_db_query($dbname,$dbqueryshipping1); > if(mysql_error()!=""){echo mysql_error();} > $mealcount = mysql_fetch_row($resultmeal); > echo $mealcount; > > The result I am getting is: > > Query was empty > Warning: mysql_fetch_row(): supplied argument is not a valid > MySQL result resource in search.php > > Any suggestions? Where is $dbqueryshipping1 set? I see $bdquerymeal, but not $dbqueryshipping1. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Include Problems
Without seeing what you have in your includes, it will be hard to determine where your scope is messed up. > $subnav = "home"; > include("incHeader.php"); > ?> > > > > The content would go here. > > > > > > Now, when I try to reference the subnav variable in the inHeader.php or > incFooter.php files, it comes up blank. I am basically trying to > adjust the > navigation on each page depending on the page I am on. I am just learning > PHP, have programmed in ColdFusion for years and in ColdFusion > this was not > a problem. Any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] File upload?
> $uploaddir = 'C:\Inetpub\wwwroot\pix'; > $filnamn=$_FILES['userfile']['name']; > I thought of just adding a backslash at the very end of the $uploaddir > variable but that just leaves me with this error-message instead: > > Parse error: parse error, unexpected T_STRING in > c:\inetpub\wwwroot\alterdb\upload2.php on line 25 > > Line 25 happens to be that $filnamn line you can see above. > > I'm at a loss as to what could be the problem so any suggestions > to where to > look? > Since a ' comes right after the \ it is escaping it. Instead escape the \ so it is interpreted as \ and not the escape character. $uploaddir = 'C:\Inetpub\wwwroot\pix\\'; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Bizarre SQl, if issue....
> Actually, what you see is *exactly* the code being used. Nothing > has changed > about it. And whether the variable is regarded as a string or a > number, it > gives me the same stupid issue. Not recognizing it as a True > statement. :\ > > Is there any way possible that this could be the client's server? > I had to > beg to get 'em to recompile to 4.1.2 from 4.0.3. There are using > a version > of Linux I don't recognize (it isn't redhat or mandrake), but it > looks like > their kernel is up to date. > > On my redhat server (with php 4.3.3), the same code responds > properly (i.e. > that $vthere ==0 is true). Database set up is the same on both servers? If they are using the same remote database server, do both webservers have perms to select from the database and table you are trying to use? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Weird Problem
> I have the following chunk of code: > > $sql = "SELECT setting from settings where name='display_rows'"; > include("connect.inc.php"); > print $sql; > $row = mysql_fetch_row($result); > $path = $row[0]; > print $path; > > It always prints out "1" > > But if I run the code at the sql command prompt, it prints out "25", > which is the correct value. > > Does anyone have any ideas why im having this problem?? > Are you actually executing the query? I don't see a mysql_query() anywhere and it would be anti-intuituve to have that in your connection include. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Weird Problem
> The only setting contained in that table is the one im calling for, > and its value is 25. > see what print_r($row) outputs, then you'll at least know what is in the array. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySQL query/PHP logic?
> select * from main > left join fof on main.id = fof.id > left join pub on main.id = pub.id > left join gov on main.id = gov.id > left join med on main.id = med.id > left join ngo on main.id = ngo.id > left join own on main.id = own.id > left join sup on main.id = sup.id [snip] > BUT, although it seems to be "joining" the tables correctly AND only > returning the ones with the correct date criteria, it does NOT return > the "id" or the "information_sent" fields correctly ( due to duplication > in the result ) > > Can this be done in one query without sub-selects, or should it > be broken up > (in which case I would still need help with the logic and to minimize the > amount of queries inside loops) > Instead of select * list out the fields you want to select and alias the duplicates, for example select fof.id as fof_id, pub.id as pub_id, gov.id as gov_id etc. Then when you do you mysql_fetch_array the indexes will be the aliases you gave the columns so nothing will get overwritten. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using link to submit a form
> Hi everyone, > > Can I replace "Submit" buttons on forms with a text button? > I need to be able to click on a link: > Edit > > and have it submit the form. The form only contains one > field...does anyone > know how to do this? I've been searching google for an answer, > but couldn't > find any info that really applies to my question. This was answered yesterday. http://marc.theaimsgroup.com/?t=10516067212&r=1&w=2 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Escaping nasty quotes
> I have this: > > $query = "LOAD DATA LOCAL INFILE '/home/data.txt' INTO TABLE > mytable FIELDS > TERMINATED BY ',' ENCLOSED BY '" . '"' . "' "; > $result = MYSQL_QUERY($query); > PRINT "$query2"; > > The query doesn't take ... but if I cut and paste the printed > response into > the mysql server manually ... works like a charm What error do you get from mysql_error()? Are you uusing the same user in both shell and script? If not does the script user have the proper permissions? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: include help please
> if (isset($page)) { > include $$_GET['page']; > } else { > $page = $home; > include $page; > } > > would that be right? > or should i use > > if (isset($page)) { > include $$_GET['page']; > } else { > include $home; > } > > hopefully that's right. if so, pretty good for a n00b > I don't think I'd let someone pass any page they wanted via a get and just include that page. If you have URL fopen wrappers on I can create a page on my server and include it to your page and pretty much execute any code I want on your server. example: http://www.yourdomain.com?yourscript.php?page=http://mydomain.com/myscript.p hp Now my code is included in your page and executed. Do you really trust me to only have nice code in my page? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] is there a way?
> Is there a way to have your html table represent one color, > Cause when I click the link it turnes purple, and I want it to stay > 336699 > no matter what state. > > I tried to use css, but it does the whole page. > And I want the 336699 to be in this table alone. > > Can anyone help me out with this small problem? Create a class specifically for that table and it's links. for example .yourtable {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 8pt; color: #ff;} A.yourtable:link { text-decoration: underline; font-weight: normal; color: #336699;} A.yourtable:visited { text-decoration: underline; font-weight: normal; color: #336699;} A.yourtable:hover { text-decoration: underline; font-weight: normal; color: #336699;} A.yourtable:active { text-decoration: underline; font-weight: normal; color: #336699;} -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Is there an easier way?
> if(!($rs = mysql_query($q))) // querying > { echo "Query failed". mysql_error(); exit; } > > >$n = 0; > while ($line = mysql_fetch_assoc($rs)) { //dumping into an array > foreach ($line as $field => $value) { > $data[$field][$n] = $value; > } > $n++; > } > > and this is how i use the arrays values (blah is the field name): > $blah1=$data['blah'][0]; > $blah2=$data['blah'][1]; > $blah3=$data['blah'][2]; This should work. Try it and see. $n = 0; while ($line = mysql_fetch_assoc($rs)) { //dumping into an array foreach ($line as $field => $value) { $tmp = $field.$n; $$tmp = $value; } $n++; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regular Expression
> Been working on this one for a while but can't get it working properly. > I need a regular expression to match if address is > > 1. PO Box > 2. P.O. Box > 3. P.O.Box > > I got it working with 1 & 2, but it's still not matching 3. Any > suggestions? > > if(preg_match( "/p[\.]o\.* +box/i", trim($_POST['address'])){ >echo "Address is P.O. BOX"; > } You are using a + as the modifier on the space between p.o. and box. + means 1 or more. Option 3 does not have a space. Try using * which is 0 or more, or ? which is 0 or 1. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Values from forms
> --- "Beauford.2005" <[EMAIL PROTECTED]> wrote: > > > > You misspelled method. :-) > > Hope that helps. > > Chris It seems like this exact same problem has been addressed before. http://marc.theaimsgroup.com/?l=php-general&m=105900603231518&w=2 http://marc.theaimsgroup.com/?l=php-general&m=105906453817129&w=2 Having the action attribute in there twice will mess stuff up. You might want to check all of your forms since this seems to be a re-occurring problem, it'll probably save you some time and frustration. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] setting function variables
> I am trying to specify a single php file to contain all the > variables and I > just call this file where necessary. What I am running into is > that I want > to do this for all the built in functions (i.e. mssql_query) as > well. I've > tried numerous attempts but can't get it to operate without wanting to run > the functions or return an error. Something like this: > > $runQuery = @mssql_query; > $qryResults = @mssql_result; > $getRow = @mssql_fetch_row; > $getRowNums = @mssql_num_rows; > > I've tried using the %, $, "",'', and the @ symbol without any > luck. Anyone > know of way to do this, so I can use a generic name for all the functions > and be able to distribute it to those using either SQL Server or MySQL > without them having to go through the code and manually change it? > > thanks Have you looked into variable functions? http://www.php.net/manual/en/functions.variable-functions.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] AOL Email client
> I am using php mail and setting all my $headers info to show From:, To:, What does your call to mail() look like? How are you formatting you headers? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] AOL Email client
> Here is what my header look like: > > $headers .= "MIME-Version: 1.0\r\n"; > $headers .= "Content-type: text/plain; > charset=us-ascii\r\n"; > $headers .= "From: ".$name." <".$email.">\r\n"; > $headers .= "To: ".$myname." <".$toAddress.">\r\n"; > $headers .= "Reply-To: ".$name." <".$email.">\r\n"; > $headers .= "X-Priority: 1\r\n"; > $headers .= "X-MSMail-Priority: High\r\n"; > $headers .= "X-Mailer: Just My Server"; > It appears to work fine in AOL 6.0 when I send from unix box using PHP 4.2.3 and sendmail, what version of AOL are you having problems with, what server platform and PHP version are you using to send? If you are using the php mail function you must be passing To as the first parameter since it is not optional, so why are putting it in your headers as well? If I remember correctly, RFC2822 states there should only be 1 to header. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Stop neurotic posting
Not to beat a dead horse, but... >From two separate responses: > And as for Google, I don't feel like I have time to wade through pages and > pages of irrelevant links until I find what I'm looking for when I have a > better resource right here. > > I've actually learned quite a few useful things from questions in > the past > couple of weeks since I joined this list that have obviously reappeared > several times. Now, I could spend hours trawling the archives to see if > there's anything of interest, but I don't really have the time - > and in any > event they're often things I wouldn't have thought about looking > up anyway. I love how the argument for not doing research is not having the time/not wanting to waste time. That is just lazy and selfish. Since you don't want to waste your time looking, it is perfectly acceptable for everyone else to waste time reading a question that's been posted 80 times in the last month, and possibly waste more time typing up the same answer that has probably been posted 80+ times. How is your time more important or valuable than everyone else's? This is not a personal attack on the two posters quoted, just my feelings on that general attitude. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] strtotime()
> > > strtotime( '+1 month', mktime( 0, 0, 0, 1, 1, 2003 )); > > > I get back the timestamp for 1/31/2003 and not 2/1/2003. > > Are you sure? > > Yeah, but I missed something in my above example. If I did this: > > strtotime( '+1 month GMT', mktime( 0, 0, 0, 1, 1, 2003 )); > > It came back with 1/31/2003 and not 2/1/2003. Removing the GMT > made it work. Are you somewhere behind GMT? I get an hour shift when using GMT that puts me in the previous day. I'm GMT -8. I can't think right now, but for some reason it seems like it's shifting in the wrong direction or at least the opposite of what I'd expect. I guess it is subtracting my 8 hours and then shifting, making it 16:00 of the previous day. It seems like it should add 8 hours since GMT is 8 ahead of me. This is making my head hurt, maybe someone else can make it make sense. # php X-Powered-By: PHP/4.2.3 Content-type: text/html 2003-01-01 00:00:00 2003-01-31 16:00:00 2003-02-01 00:00:00 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] bug in code - can't find it!
> Ok, here is my query and the bit of code I can't figure out: > > $query = "SELECT * from apt_user_t a, apt_company_t b "; > $query .= "WHERE a.user_cd = b.user_cd "; > $query .= "ORDER BY a.username"; > > $search_results = mysql_query($query) or die("Select > Failed!"); > while ($search_result2 = mysql_fetch_array($search_results)) > { > TYPE="checkbox" > NAME="" > SIZE="20" > MAXLENGTH="50" > VALUE=" 1){?>CHECKED"> > } > Nothing shows up with the echo or the value. I only included this > checkbox, but all of the other values show up fine. Can someone give me a > hint? Mysql does not prefix returned columns with table_name., so there's probably no "a.retired_flag" index in your array. A simple way to check this would be to print_r($search_result2). If you have a column named retired_flag in both table a and table b and you specifically want the one from table a in your result set you are going to have to alias it to a different name in your query, i.e. "SELECT *, a.retired_flag as r_flag" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] setting function variables
> Tried this and it returns errors of type: > > Warning: Wrong parameter count for mssql_result() in > c:\inetpub\wwwroot\webpage10\example\utilities\dsp_del_images.php > on line 78 > > Warning: mssql_result(): supplied argument is not a valid MS SQL-result > resource in > c:\inetpub\wwwroot\webpage10\example\utilities\dsp_del_images.php > on line 79 > > Lines 78 and 79 read like this: > > $img_numbers = $qryResults("SELECT COUNT(img_id) AS TotalImages > FROM images > WHERE category_id = '$row[0]'"); > $img_count = $qryResults($img_numbers,0,"TotalImages") > > The variables are specified as > > $runQuery = 'mssql_query'; > $qryResults = 'mssql_result'; > You are using mssql_result instead of mssql_query on line 78. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] strtotime()
> strtotime( '+1 month', mktime( 0, 0, 0, 1, 1, 2003 )); > > I get back the timestamp for 1/31/2003 and not 2/1/2003. > Are you sure? I tried it on my system (php 4.2.3 freeBSD 4.6.2) and this is the output I got... # php X-Powered-By: PHP/4.2.3 Content-type: text/html 2003-01-01 2003-02-01 What are you doing with the timestamp strtotime gives you? Could that be where the error is? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] discussion forum from j. meloni's book
> > // the query > > $verify = "select ft.topic_id, ft.topic_title from forum_posts as fp left > join forum_topics as ft on fp.topic_id = ft.topic_id where fp.post_id = > $_GET[post_id]"; > ... > > My question: why - or how can - the columns ft.topic_id and ft.topic_title > come from the table forum_posts? > > In the original schema, there is no column called topic_title in the table > called forum_posts. They don't. ft is aliased to forum_topics. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Commands out of sync; You can't run this command now
> Hi > > For a few days or maybe even a week or two I'm getting this error > message in my site. > This happens when i do : mysql_select_db() > > This doesn't happen all the time and there are pages that it happens > more than others > so it seems. > > I looked in the manual and the explanation there doesn't apply to me. > Any ideas? > > http://mickey.lcsc.edu/manual.html#Commands_out_of_sync > > Sincerely > > berber 1.) This has been asked on the mysql list and the this list a lot of times, search the archives http://marc.theaimsgroup.com/?l=mysql&w=2&r=1&s=commands+out+of+sync&q=b or http://marc.theaimsgroup.com/?l=php-general&w=2&r=1&s=commands+out+of+sync&q =b . From a brief search it appears it is a known bug in PHP 4.2.3, what version of PHP are you running? 2.) Are you using mysql 3.22.14-gamma? If not check the current manual at http://www.mysql.com as I'd imagine a lot has changed since the 3.22.14 gamma manula you are refrencing. If you are using 3.22 you should upgrade to at least 3.23.55 as there have been huge security patches and I don't think the 3.22 tree is still supported. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] discussion forum from j. meloni's book
> Anyway, in the textbook and the zip her mySQL query reads: > ... > $verify = "select ft.topic_id, ft.topic_title from forum_posts as fp left > join forum_topics as ft on fp.topic_id = ft.topic_id where fp.post_id = > $_GET[post_id]"; > . > > The part that I'm confused about is: > ... > select ft.topic_id, ft.topic_title from forum_posts > > > It seem that the alias of ft refers to forum_title - not forum_posts. ft refers to forum_topics "forum_topics as ft " > > In fact, I switched the query to read as follows: > > $verify = "select ft.topic_id, ft.topic_title from forum_topics as ft left > join forum_posts as fp on fp.topic_id = ft.topic_id where fp.post_id = > $_GET[post_id]"; > .. > > And that seems to run fine. > > Any explanations will be appreciated. You didn't switch the aliases around, you just switched the join order. This will provide unexpected results. In order to understand it, you should read up on left joins. http://www.mysql.com/doc/en/JOIN.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Question on class syntax
> I am currently using a php class that uses the following syntax: > > $value= htmlcleaner::cleanup($value); > > > What exactly is the :: used for? Is there a different syntax for :: ? The manual has an entire section on this (http://www.php.net/manual/en/keyword.paamayim-nekudotayim.php) have you read it and are still unclear and looking for further input? Or have you not read it yet? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Bug in Ereg?
> What is posted [ from phpinfo() ]: > > _POST["color-1"] on > _POST["color-4"] on > _POST["color-6"] on > > > Parser: > foreach($_POST as $ThisVar=>$ThisVal){ > if(ereg("color-", $ThisVar) AND $ThisVal=="on" OR $ThisVal==1){ > $newVarA=explode("-", $ThisVar); > $colors.="$newVarA[1]:"; > } > } > > Expected Output: > > $colors="1:4:6:"; > > Real Output: > > $colors=":1:4:6:"; Do you have anything else in _POST that's equal to 1? I didn't look up order of operation, so I may be off here, but your if condition might not be doing what you are expecting. Try using parentheses to group it like this if(ereg("color-", $ThisVar) AND ($ThisVal=="on" OR $ThisVal==1)){ (I'm guessing that's what you want). Why are you using ereg anyway? You're not using a regular expression so strstr would work just as well and be slightly faster. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with date('w')
> I have a problem with the date function > > $theday = date("Y-m-d", time()); > echo date((w), $theday); > ?> I'm pretty sure the optional second argument for date is a unix timestamp that you would generate by using either time or mktime or strtotime. You are passing it something in the form of Y-m-d, or 2003-08-23 when it is expecting 1061852640. http://www.php.net/manual/en/function.date.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Impossible error
> I have a 163 line file. I get a parse error on line 164. Ideas? > You're probably missing a } somewhere. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mac IE File download problem - any solutions?
This is not a MAC IE problem, it is the way browsers work. If the MIME type is mapped to an application, the browser will launch the application. IE does it inline, while Netscape tends to launch it separately. You can send false headers with a made up type and a missing file extension, but then the browser will not know what type of file it is and the save as is harder for the user as they have to put the right extension on. It is a work around, but a really poor one. header("Content-disposition: filename=$filenamewithoutextension"); header("Content-type:reallyreallyreallybigcsv"); -Original Message- From: Step Schwarz [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 11:49 AM To: Daniel Leighton; [EMAIL PROTECTED] Subject: Re: [PHP] Mac IE File download problem - any solutions? [...] > The problem: When downloading certain files on a Mac using IE 5.x, files are > displayed within a browser window instead of downloading. This seems to occur > mostly with quicktime files (.mov, .mp3). Some quicktime files work, while > others with the same extension do not. [...] Hi Daniel, I believe this is a browser setting, is it not? Using the default setup of Explorer 5.2 for Mac, a clicked .mov file will play in IE. To change this behavior, go to Explorer > Preferences... > File Helpers, select QuickTime Movie and click Change... then switch Handling from "View with Browser" to "Save to File". I would be surprised if a file header could override this.. but if you find a way, please let us know! -Step -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Backing Up Tables Using PHP
Most RDB programs come with an integrated backup solution. You might want to look into those. As far as why your code is not working, you are not looping through the result set, you are only pulling one result. A database does not store data in order, it puts it where ever there's a hole, so the 25th record could very well hold the first spot in the file. You have more problems than not looping, echo "$result_sql_daily[$count_daily]"; is just going to print "array()" if I am not mistaken. To fix the problem that you asked about though, take out the part where you fetch the first result and replace the for statement with while ($result_sql_daily = mysql_fetch_array($run_sql_daily)){ -Original Message- From: Guru Geek [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 2:12 PM To: [EMAIL PROTECTED] Subject: [PHP] Backing Up Tables Using PHP Hello, Trying to author my own PHP database table back up utility. A very simple one at that... Here's my sql statement to select everything in the table: $sql_daily = "SELECT * FROM dailytable"; $run_sql_daily = mysql_query($sql_daily); $result_sql_daily = mysql_fetch_array($run_sql_daily); Here's the code for showing me whats in the result array: for ($count_daily=0; $count_daily < count($result_sql_daily); $count_daily++) { echo ""; echo "$result_sql_daily[$count_daily]"; } exit; Does anyone out there know why it only prints one line of the table? It's a line in the middle of the table, it's not the first line, it's not the last line, it's in the middle of about 25 lines. Is this not the proper way to back up tables in a database? I'd like a back up copy of my tables on CD-ROM and I thought once this prints out correctly I'd just have it print to a text file and then place the text file on a cd Thanks, Roger -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] foreach statement
You don't. >From http://www.php.net/manual/en/control-structures.foreach.php "Note: foreach does not support the ability to suppress error messages using '@'." You should check the validity of your argument before passing it to foreach if(is_array($array)){ foreach($array as $key=>$val){ //do stuff } } -Original Message- From: shaun [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 3:23 PM To: [EMAIL PROTECTED] Subject: [PHP] foreach statement how do i surpress an error message for a foreach statement? -- 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] What am I not understanding about $GLOBALS['myvar'] vs global $myvar?
>Actually I didn't. ;-) >$GLOBALS[$key] is incorrect and depricated AFAIK. >$GLOBALS['$key'] (with the single quotes) is the proper way to write these Wouldn't it need to be $GLOBALS["$key"] because single quotes tell the parser not to expand variables? I think you are misinterpreting the part of the manual that says "You should always use quotes around an associative array index." Even though a variable may contain a string it is not a string and therefore does not need quoting because there is not danger of it being interpreted as a constant. Look at the manual page on arrays, it shows arrays with variable indices without quotes. http://www.php.net/manual/en/language.types.array.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with setcookie function
TRy URL Encoding the string. -Original Message- From: Tomás Liendo [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 26, 2003 2:46 PM To: [EMAIL PROTECTED] Subject: [PHP] Problem with setcookie function Hi people I'm a beginner... I'm trying to pass variables between pages, I need use a variable that I get in the first page, 3 or 4 pages later on. For this I'm using the setcookie function: setcookie("name", "Jhon Malbeck"); The problem is that I receipt only the value "Jhon" Why I don't receipt all the string Well, from already thank you very much, Tom. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using includes with page locations
You could just make all of your links relative to the webroot. "/index.php" instead of "index.php" and "/messages/index.php" and "messages/index.php" I don't know why you would want to use PHP to do this for you, it is a pretty basic HTML concept. -Original Message- From: Vernon [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 26, 2003 7:00 AM To: [EMAIL PROTECTED] Subject: [PHP] Using includes with page locations Please forgive the ignorance of this question but I am trying to use an include for a site navigation menu and am having a hard time figuring out how to point at the route of the site. For instance I may have home set as index.php, but if my users are in messages/index.php that will always bring that back to the same page. I know in ASP there is a way to set the root directory, how do I do that in PHP. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using includes with page locations
oops, it should read: "/messages/index.php" instead of (not and) "messages/index.php" That make make what I said really confusing -Original Message- From: Jennifer Goodie [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 26, 2003 4:45 PM To: Vernon; [EMAIL PROTECTED] Subject: RE: [PHP] Using includes with page locations You could just make all of your links relative to the webroot. "/index.php" instead of "index.php" and "/messages/index.php" and "messages/index.php" I don't know why you would want to use PHP to do this for you, it is a pretty basic HTML concept. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] auto_prepend_file
You're looping endlessly because SESSION is not getting registered anywhere. -Original Message- From: Kevin Heflin [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 26, 2003 5:16 PM To: php-general Subject: [PHP] auto_prepend_file Trying to use php_value auto_prepend_file /path/to/file/checkauth.php in an .htaccess file. I've used this before without problems, however with this instance, I keep getting a message in my browser which says: Redirection limit for this URL exceeded. Unable to load the requested page. my checkauth.php page looks like this Any suggestions would be appreciated. Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Uploading Files Via PHP
http://www.php.net/manual/en/features.file-upload.php >From the page listed above: "Related Configurations Note: See also the file_uploads, upload_max_filesize, upload_tmp_dir, and post_max_size directives in php.ini" I would read that manual page as it deals with file uploading support. -Original Message- From: Vernon [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 26, 2003 4:41 PM To: [EMAIL PROTECTED] Subject: [PHP] Uploading Files Via PHP Is there some thing that needs to be turned on in the php.ini in order to be able to upload photos VIA php? I have the same script on one machine with the right permissions on the upload dirs on one machine and am moving to another machine which is not being uploaded. Funny thing is I'm not getting any errors in the Apache logs. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Uploading Files Via PHP
A world writeable directory is a security risk. Why not just fix the owner/group and only give the permissions needed, 775 at most. -Original Message- From: Dan Rossi [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 1:45 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] Uploading Files Via PHP did u even read it ? chmod 777 + owned by httpd -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 9:40 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Uploading Files Via PHP On Thursday 27 March 2003 18:25, Marek Kilimajer wrote: > not necesserily both, either of them is enought: Not quite true :) If owned by 'httpd' then 'httpd' still needs write permission (o+w). > drwxrwxrwt2 root root 188416 Mar 27 11:23 /tmp > or > drwx--2 apache apache 188416 Mar 27 11:23 > /var/www/uploads > > daniel wrote: > >possibly a permissions problem , dir needs to be 777 and owned by httpd -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* In good speaking, should not the mind of the speaker know the truth of the matter about which he is to speak? -- Plato */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Uploading Files Via PHP
Or you could just do it correctly the first time and be done with it. :) -Original Message- From: Philip J. Newman [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 10:23 AM To: Jennifer Goodie; Dan Rossi; [EMAIL PROTECTED] Subject: Re: [PHP] Uploading Files Via PHP You could chnage the permissions when you want to write something then change it back when your done. Thats what i do. / Phil - Original Message - From: "Jennifer Goodie" <[EMAIL PROTECTED]> To: "Dan Rossi" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, March 28, 2003 6:17 AM Subject: RE: [PHP] Uploading Files Via PHP > A world writeable directory is a security risk. Why not just fix the > owner/group and only give the permissions needed, 775 at most. > > -Original Message- > From: Dan Rossi [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 27, 2003 1:45 AM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] Uploading Files Via PHP > > > did u even read it ? chmod 777 + owned by httpd > > -Original Message- > From: Jason Wong [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 27, 2003 9:40 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Uploading Files Via PHP > > > On Thursday 27 March 2003 18:25, Marek Kilimajer wrote: > > not necesserily both, either of them is enought: > > Not quite true :) > > If owned by 'httpd' then 'httpd' still needs write permission (o+w). > > > drwxrwxrwt2 root root 188416 Mar 27 11:23 /tmp > > or > > drwx--2 apache apache 188416 Mar 27 11:23 > > /var/www/uploads > > > > daniel wrote: > > >possibly a permissions problem , dir needs to be 777 and owned by httpd > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > -- > Search the list archives before you post > http://marc.theaimsgroup.com/?l=php-general > -- > /* > In good speaking, should not the mind of the speaker know the truth of > the matter about which he is to speak? > -- Plato > */ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] redirect using header
Read the manual section on headers. A header must be sent before any other output, including whitespace, so putting it in the middle of an HTML page is totally not going to work. http://www.php.net/manual/en/function.header.php -Original Message- From: David Banning [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 11:15 AM To: [EMAIL PROTECTED] Subject: [PHP] redirect using header I have been trying to do a redirect with header; Optex Staging and Services Inc. http://newwebpage.com'); ?> Stand By For Terminal... I keep getting the error; Warning: Cannot modify header information - headers already sent by (output started at /usr/hosting/optex/goterm/temp.html:8) in /usr/hosting/optex/goterm/temp.html on line I have tried the header statement in different postions, and also tried eliminating the existing section with no difference. What am doing wrong here? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Form Validation: Surnames with Apostrophe
That is because it is not saying that is all that can be in the string. The 'Re' matches that pattern. Put a ^ at the beginning to signify it must start with the pattern and a $ at the end to signify it must end there. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 1:19 PM To: John W. Holmes Cc: 'John Nichel'; [EMAIL PROTECTED] Subject: RE: [PHP] Form Validation: Surnames with Apostrophe I just tried your regexp: (preg_match("/[a-z](\\')?[a-z-]+/i",$_POST[Last_Name]) and it allows the following: O' [EMAIL PROTECTED] It seems to allow any number of characters and spaces between the O' and Re On Wed, 12 Mar 2003, John W. Holmes wrote: > > > preg_match ( "/[A-Za-z-']+/", $_POST['Last_Name'] ); > > > > > > [EMAIL PROTECTED] wrote: > > > > I have been trying to validate a form field Last_Name and have > been > > unable > > > > to find a regexp to account for the apostrophe (e.g., O'Reilly). > The > > > > following statement: > > > > > > > > preg_match('/^[[:alpha:]]+[-]?[[:alpha:]]+$/', $_POST[Last_Name]) > > > > > > > > accepts hyphenated surnames and I have tried escaping the > apostrophe: > > > > [\\'] and [\\\'] to no avail. Any idea what I am doing wrong? > > that could work but the user may now submit one or more apostrophes > > as the Last Name. > > Watch out for magic_quotes. If "O'Reilly" is submitted, unless you > stripslash() it, you're validating against "O\'Relly". > > preg_match("/[a-z](\\')?[a-z-]+/i",$_POST['Last_Name']) > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Include Question
If your include is located somewhere on the site you should refer to it as $_SERVER[DOCUMENT_ROOT]/pathtofile/filename.php so that your paths don't get messed up from chaning the includes etc. -Original Message- From: Beauford.2002 [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 2:28 PM To: James E Hicks III Cc: PHP General Subject: Re: [PHP] Include Question Just a typo, but now I have other problems as well which I think have to do with paths and includes. If I am in the root directory on page main.html and click on a link that is in /other - because this is a restricted page I include main.html with an error (which right now doesn't display) - but now the paths are all screwed up. If I click on the same link again I get file not found. Hope I am explaining this right as this is really getting on my nerves. TIA - Original Message - From: "James E Hicks III" <[EMAIL PROTECTED]> To: "Beauford.2002" <[EMAIL PROTECTED]> Sent: Thursday, March 27, 2003 4:15 PM Subject: RE: [PHP] Include Question > If checklogin.php is only below, you shouldnn't get those errors. Anyway, > is password just a typo below or does your code omit the $ too? > > > if (!$name || !password) { > $message = $enter_info; > include ("login.php"); > exit; > } > > -Original Message- > From: Beauford.2002 [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 27, 2003 4:07 PM > To: James E Hicks III > Subject: Re: [PHP] Include Question > > > Because I would get the error - headers already sent etc. > > - Original Message - > From: "James E Hicks III" <[EMAIL PROTECTED]> > To: "Beauford.2002" <[EMAIL PROTECTED]> > Sent: Thursday, March 27, 2003 3:53 PM > Subject: RE: [PHP] Include Question > > > > Why not try header("login.php") instead of include? > > > > James Hicks > > > > > > -Original Message- > > From: Beauford.2002 [mailto:[EMAIL PROTECTED] > > Sent: Thursday, March 27, 2003 3:47 PM > > To: PHP General > > Subject: [PHP] Include Question > > > > > > Hi, > > > > First, I fixed my other problem of the stack overflow by moving the files > > back to the root directory (although I would rather have them in a login > > directory). Anyway, I have a question regarding the include function. I > have > > a login script in a file called login.php - in this file it includes > > checklogin.php and loginerrors.php. If the user inputs an incorrect login > I > > assign $messages the appropriate error from loginerrors, then I re-include > > login.php where I want to show the error message, but no matter what I do > > the error message will not show up. > > > > Example. > > > > Login.php > > > > Enter your Name: > > Enter Your Password: > > if ($message) { echo $message; } > > > > Checklogin.php > > > > if (!$name || !password) { > > $message = $enter_info; > > include ("login.php"); > > exit; > > } > > > > Any help is appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Form Validation: Surnames with Apostrophe
This is what I use $LastName = stripslashes($_POST['LastName']); preg_match("/^\w+[\s\-\'\.\w]*$/i", $LastName) This is less strict than yours as I'm allowing whitespace, periods, underscores, hyphens, apostrophes, and numbers because I don't so much care if someone tacks on " Jr." or something like that to the end of their name. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 3:05 PM To: Jennifer Goodie Cc: John W. Holmes; 'John Nichel'; [EMAIL PROTECTED] Subject: RE: [PHP] Form Validation: Surnames with Apostrophe When I do that: (preg_match("/^[a-z](\\')?[a-z-]+$/i",$_POST[Last_Name]) it won't allow O'Reilly and seems to not allow anything at all On Thu, 27 Mar 2003, Jennifer Goodie wrote: > That is because it is not saying that is all that can be in the string. The > 'Re' matches that pattern. Put a ^ at the beginning to signify it must > start with the pattern and a $ at the end to signify it must end there. > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 27, 2003 1:19 PM > To: John W. Holmes > Cc: 'John Nichel'; [EMAIL PROTECTED] > Subject: RE: [PHP] Form Validation: Surnames with Apostrophe > > > > I just tried your regexp: > > (preg_match("/[a-z](\\')?[a-z-]+/i",$_POST[Last_Name]) > > and it allows the following: > > O' [EMAIL PROTECTED] > > It seems to allow any number of characters and spaces between the O' and > Re > > On Wed, 12 Mar 2003, John W. Holmes wrote: > > > > > preg_match ( "/[A-Za-z-']+/", $_POST['Last_Name'] ); > > > > > > > > [EMAIL PROTECTED] wrote: > > > > > I have been trying to validate a form field Last_Name and have > > been > > > unable > > > > > to find a regexp to account for the apostrophe (e.g., O'Reilly). > > The > > > > > following statement: > > > > > > > > > > preg_match('/^[[:alpha:]]+[-]?[[:alpha:]]+$/', $_POST[Last_Name]) > > > > > > > > > > accepts hyphenated surnames and I have tried escaping the > > apostrophe: > > > > > [\\'] and [\\\'] to no avail. Any idea what I am doing wrong? > > > that could work but the user may now submit one or more apostrophes > > > as the Last Name. > > > > Watch out for magic_quotes. If "O'Reilly" is submitted, unless you > > stripslash() it, you're validating against "O\'Relly". > > > > preg_match("/[a-z](\\')?[a-z-]+/i",$_POST['Last_Name']) > > > > ---John W. Holmes... > > > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > > today. http://www.phparch.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] post method with fopen
I've never tried with fopen, but I know you can with fsockopen. That doesn't really answer your question, but I thought it might help out. Here's an example with fsockopen; $fp = fsockopen($domain,80, $errno, $errstr, 30); if (!$fp){ //error handling stuff } else{ fputs ($fp, "POST $url?$postdata HTTP/1.0\r\nHost: $domain\r\n\r\n"); while (!feof($fp)) { $return .= fgets ($fp,1280); } fclose ($fp); } -Original Message- From: Lambert Antonio [mailto:[EMAIL PROTECTED] Sent: Monday, March 24, 2003 7:17 PM To: [EMAIL PROTECTED] Subject: [PHP] post method with fopen if it possible to send a post data when using fopen? -- Lambert Antonio Re:Site WebWorks and System Solutions -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Is there a PHP for Dummies?
That is a really, really, really poor example. Tha name says it all. It gets the magic quotes setting for gpc(get, post, cookie). You can figure out what most PHP functions do just by looking at their names, that's actually what I like about PHP. -Original Message- From: Beauford.2002 [mailto:[EMAIL PROTECTED] Sent: Friday, March 28, 2003 1:54 PM To: PHP General Subject: [PHP] Is there a PHP for Dummies? I'm really tired of trying to figure out the PHP manual and need something that explains things in plain straight forward English. Like get_magic_quotes_gpc() for example - the manual says how to use it and what it returns - but nowhere can I find out what it's for. Does it count sheep, do a quote of the day, or what - maybe I'm just stupid - but in any event I have spent more time in the last two weeks searching for things and getting no answers - Any help in pointing me a good straight forward tutorial/manual would be appreciated. B. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mySQL query - command "LIKE" OR "="
= does not take the wildcard (%). -Original Message- From: Harry.de [mailto:[EMAIL PROTECTED] Sent: Friday, March 28, 2003 2:38 PM To: [EMAIL PROTECTED] Subject: [PHP] mySQL query - command "LIKE" OR "=" Hi, i want to make a mySQL query where the result should be in $result1 any sting with a phrase of $search in $result2 any sting with the exact phrase of $search $result1 works fine, but $result2 gives out an empty sting $result1 = mysql_query("SELECT name FROM table WHERE name LIKE '%".strtolower($search)."% "); $result2 = mysql_query("SELECT name FROM table WHERE name = '%".strtolower($search)."% "); e.g. row 1 in name = "my big appletree in the garden" row 2 in name = "my big apple in the garden" so the result should be in $result2 with $search="apple" 2 Can anybody help me Harry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] issue with connecting to DB
Here is the code: $link = mysql_connect("xxx", "x", "x") or die("Could not connect: " . mysql_error()); print ("Connected successfully"); mysql_close($link);?> WhenI try to connect, I get the following error: Warning: mysql_connect() [function.mysql-connect]: Access denied for user: '[EMAIL PROTECTED]' (Using password: YES) in /xxx//x//testdb.php on line 2Could not connect: Access denied for user: [EMAIL PROTECTED]' (Using password: YES) I know the userid and password work because I can connect to the db via phpmyadmin, etc. version mysql 3.23.52 php 3 I have google searched and archived searched but I cannot find anything on this error. We recently changed the password. Does anyone have any idea what is happening? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Is there a PHP for Dummies?
>I tend to get more out of the users comments than the actual manual.. It is possible that is because you don't want to put the time into figuring things out for yourself. It's a lot easier to post a ton of RTFM questions than to actually read the manual or research your question. I seem to recall you having the same problem with the MySQL documentation. -Original Message- From: Beauford.2002 [mailto:[EMAIL PROTECTED] Sent: Friday, March 28, 2003 6:52 PM To: Leif K-Brooks Cc: PHP General Subject: Re: [PHP] Is there a PHP for Dummies? I found that after the fact, but my question was regarding tutorials, books, or other docs. This was just an example I used. In general I don't find the PHP manual very helpful - I tend to get more out of the users comments than the actual manual.. - Original Message - From: "Leif K-Brooks" <[EMAIL PROTECTED]> To: "Beauford.2002" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, March 28, 2003 9:49 PM Subject: Re: [PHP] Is there a PHP for Dummies? > After a quick search of the php manual, I came upon > http://www.php.net/manual/en/ref.info.php#ini.magic-quotes-gpc, which says: > > Sets the magic_quotes state for GPC (Get/Post/Cookie) operations. When > magic_quotes are on, all ' (single-quote), " (double quote), \ > (backslash) and NUL's are escaped with a backslash automatically. > > Seems to explain it pretty nicely. > > Beauford.2002 wrote: > > >No, the name explains absolutely squat. What is a magic quote? Sounds like > >something I smoked in the 60's. Maybe to you it makes sense as you know what > >it does. To me it means absolutely nothing - nor does the PHP manual explain > >it. > > > >B. > > > > > >- Original Message - > >From: "Jennifer Goodie" <[EMAIL PROTECTED]> > >To: "Beauford.2002" <[EMAIL PROTECTED]>; "PHP General" > ><[EMAIL PROTECTED]> > >Sent: Friday, March 28, 2003 5:07 PM > >Subject: RE: [PHP] Is there a PHP for Dummies? > > > > > > > > > >>That is a really, really, really poor example. Tha name says it all. It > >>gets the magic quotes setting for gpc(get, post, cookie). You can figure > >>out what most PHP functions do just by looking at their names, that's > >>actually what I like about PHP. > >> > >>-Original Message- > >>From: Beauford.2002 [mailto:[EMAIL PROTECTED] > >>Sent: Friday, March 28, 2003 1:54 PM > >>To: PHP General > >>Subject: [PHP] Is there a PHP for Dummies? > >> > >> > >>I'm really tired of trying to figure out the PHP manual and need something > >>that explains things in plain straight forward English. Like > >>get_magic_quotes_gpc() for example - the manual says how to use it and > >> > >> > >what > > > > > >>it returns - but nowhere can I find out what it's for. Does it count > >> > >> > >sheep, > > > > > >>do a quote of the day, or what - maybe I'm just stupid - but in any event > >> > >> > >I > > > > > >>have spent more time in the last two weeks searching for things and > >> > >> > >getting > > > > > >>no answers - Any help in pointing me a good straight forward > >> > >> > >tutorial/manual > > > > > >>would be appreciated. > >> > >>B. > >> > >> > >>-- > >>PHP General Mailing List (http://www.php.net/) > >>To unsubscribe, visit: http://www.php.net/unsub.php > >> > >> > >> > >> > > > > > > > > > > > > -- > The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. > > > -- 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] require/include from a different directory
If the includes are within the website, using $_SERVER[DOCUMENT_ROOT]/pathtofile/file is a good way to go. -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED] Sent: Saturday, March 29, 2003 2:10 PM To: 'Greg Macek'; [EMAIL PROTECTED] Subject: RE: [PHP] require/include from a different directory > > try using an absolute path. > > I've considered that route, but an issue I have with that is I do most > of my development work on a machine that a different directory structure > than the production server (currently a Cobalt RaQ4), so the paths are > different. Accommodating both would be a time consuming project for me. I always put it into a variable. $_CONF['path'] = '/home/web/www/'; and then use that variable in all of your includes or requires. I also make an HTML variable that's used in all links and images. $_CONF['html'] = 'http://www.mysite.com/'; Sure, you have to get used to using this variable everywhere, but it makes switching server pretty easy. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.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] if statment
if( $HTTP_GET_VARS["pr_ID"] == "nothing"){ echo "there are no products"; } http://www.php.net/manual/en/control-structures.php http://www.php.net/manual/en/ -Original Message- From: Tim Haskins [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 11:56 AM To: [EMAIL PROTECTED] Subject: [PHP] if statment I'm used to asp and not php, but what would the code be for and if statement that was like: if $HTTP_GET_VARS["pr_ID"] = "nothing" then "there are no products" end if Also does anyone know a great resource that lists different examples of php variables, if statements, and so on? Thanks so much! -- Tim Haskins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] if statment
so change it to "" -Original Message- From: Tim Haskins [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 12:12 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] if statment My bad, I actually meant that the "nothing" was like, if the pr_ID in the url is empty then show the following text. -- Tim Haskins "Jennifer Goodie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > if( $HTTP_GET_VARS["pr_ID"] == "nothing"){ > echo "there are no products"; > } > http://www.php.net/manual/en/control-structures.php > > http://www.php.net/manual/en/ > > -Original Message- > From: Tim Haskins [mailto:[EMAIL PROTECTED] > Sent: Monday, March 31, 2003 11:56 AM > To: [EMAIL PROTECTED] > Subject: [PHP] if statment > > > I'm used to asp and not php, but what would the code be for and if statement > that was like: > > if $HTTP_GET_VARS["pr_ID"] = "nothing" then > "there are no products" > end if > > Also does anyone know a great resource that lists different examples of php > variables, if statements, and so on? > > Thanks so much! > -- > Tim Haskins > > > -- 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] if statment
I'm pretty sure that if it was in a form but left blank isset() won't work because it is set in the globals, it is just empty. I've never used empty(), so I cannot comment on its behavior. -Original Message- From: Pete James [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 12:17 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] if statment Also, take a look at isset() and empty() http://php.net/empty http://php.net/isset Jennifer Goodie wrote: > so change it to "" > > -Original Message- > From: Tim Haskins [mailto:[EMAIL PROTECTED] > Sent: Monday, March 31, 2003 12:12 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] if statment > > > My bad, I actually meant that the "nothing" was like, if the pr_ID in the > url is empty then show the following text. > > -- > Tim Haskins > > "Jennifer Goodie" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>if( $HTTP_GET_VARS["pr_ID"] == "nothing"){ >>echo "there are no products"; >>} >>http://www.php.net/manual/en/control-structures.php >> >>http://www.php.net/manual/en/ >> >>-Original Message- >>From: Tim Haskins [mailto:[EMAIL PROTECTED] >>Sent: Monday, March 31, 2003 11:56 AM >>To: [EMAIL PROTECTED] >>Subject: [PHP] if statment >> >> >>I'm used to asp and not php, but what would the code be for and if > > statement > >>that was like: >> >> if $HTTP_GET_VARS["pr_ID"] = "nothing" then >>"there are no products" >>end if >> >>Also does anyone know a great resource that lists different examples of > > php > >>variables, if statements, and so on? >> >>Thanks so much! >>-- >>Tim Haskins >> >> >> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] if statment
Because not equal is !=, not <> I think I posted a link to the documentation a few eamils ago in this thread. Check it out, these are all really easy syntax questions, so you'll save yourself much hair pulling by just reading the section on basic syntax. -Original Message- From: Tim Haskins [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 12:27 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] if statment below is what I have currently its empty Now when I change the == to <> I receive the following error: Notice: Undefined index: id in c:\inetpub\wwwroot\_\users.php on line 103 Why would that not work - In asp it does, but I can't get it workin in php. If that doesn't make sense, I would like to have an if statement the says, if HTTP_GET_VARS["id"] is NOT empty then show something else Thanks for you guy's help and time -- Tim Haskins "Tim Haskins" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Wow, that's weird- I had just tried it and that didn't work, so I thought it > might be some special php thing goin on- thanks for your help! > > -- > Tim Haskins > > > > "Jennifer Goodie" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > so change it to "" > > > > -Original Message- > > From: Tim Haskins [mailto:[EMAIL PROTECTED] > > Sent: Monday, March 31, 2003 12:12 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP] if statment > > > > > > My bad, I actually meant that the "nothing" was like, if the pr_ID in the > > url is empty then show the following text. > > > > -- > > Tim Haskins > > > > "Jennifer Goodie" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > > > > if( $HTTP_GET_VARS["pr_ID"] == "nothing"){ > > > echo "there are no products"; > > > } > > > http://www.php.net/manual/en/control-structures.php > > > > > > http://www.php.net/manual/en/ > > > > > > -Original Message- > > > From: Tim Haskins [mailto:[EMAIL PROTECTED] > > > Sent: Monday, March 31, 2003 11:56 AM > > > To: [EMAIL PROTECTED] > > > Subject: [PHP] if statment > > > > > > > > > I'm used to asp and not php, but what would the code be for and if > > statement > > > that was like: > > > > > > if $HTTP_GET_VARS["pr_ID"] = "nothing" then > > > "there are no products" > > > end if > > > > > > Also does anyone know a great resource that lists different examples of > > php > > > variables, if statements, and so on? > > > > > > Thanks so much! > > > -- > > > Tim Haskins > > > > > > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Question on response time, SQL vs. PHP
It is faster to do a count(*) -Original Message- From: Liam Gibbs [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 1:31 PM To: php list Subject: [PHP] Question on response time, SQL vs. PHP I'm trying to do a count(*) in SQL. Would it be faster to do a or b below? a: just do a simple query, and use mysql_num_rows() to return the row count; or b: do the count(*) and use mysql_fetch_row() to return the result. I guess it would have to do more with SQL response time (is it faster to grab the count and then the row, or all rows in question and then do a count in PHP). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Command line php
Try sending a control d to signify EOF, because fread will only read to end of file. But I wouldn't do 255 because you might want to enter more. Maybe stick a while !EOF in there. > -Original Message- > From: John Nichel [mailto:[EMAIL PROTECTED] > Sent: Tuesday, April 01, 2003 6:01 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Command line php > > > I did that orginally, but it waits for me to enter 255 characters before > closing the freadno matter how many times I hit enter. > > > Benny Pedersen wrote: > > > >> On Wednesday 02 April 2003 03:17, John Nichel wrote: > >> > >>> if I do a... > >>> $name = fread ( STDIN, sizeof ( STDIN ) ); > >> > >> > >> > >> $name = fread ( STDIN, 255 ); > >> > >> tryit :) > >> > >> > > > > > > > > -- > 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] Making it so the .php isn't needed
You can accomplish this by enabling multiviews in your httpd.conf > -Original Message- > From: Teren Sapp [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 02, 2003 3:18 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Making it so the .php isn't needed > > > Hi, I had it setup on my server before i reloaded it, but what i > need to have happen is so that when i'm passing variables to a > php file, I don't have to include the .php in the link...so i can have > > http://www.my-domain.com/page1?var1=3&var2=4 > instead of > http://www.my-domain.com/page1.php?var1=3&var2=4 > > Anybody know how i can make this work? THanks > > Teren > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php 3 to 4.3
Has anyone had issues with their php scripts not working after upgrading php from 3 to 4.3? I have simple page that inserts data into mysql db. The scripts worked fine until after the upgrade. Below is one of my php scripts. When I hit submit, nothing is added to the db :( Add Record // code that will be executed if the form has been submitted: if ($submit) { // connect to the database include 'pwinfo.php'; $db = MYSQL_CONNECT($host,$user,$password); mysql_select_db("DB", $db); $sql = "INSERT INTO DB (value1, value2) VALUES ('$value1', '$value2')"; $result = mysql_query($sql); print ("Thank you! Information entered.\n"); MYSQL_CLOSE($db); } else { // else show the form to submit new data:?> value1: value2: Female Male } ?> thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] no worky :|
Have you checked to make sure your query works, the syntax looks really odd. I've never seen INSERT ... WHERE > -Original Message- > From: Sebastian [mailto:[EMAIL PROTECTED] > Sent: Thursday, April 03, 2003 2:20 PM > To: php list > Subject: [PHP] no worky :| > > > Hello, > > This form is really giving me a fight. > > I am connected to the database, yet it won't submit, Is the form and > $_POST's Okay? > > echo " > > reason: > > > > "; > > if($_POST[reason]) { > $result = $db->sql("INSERT INTO comments (reported, reportedby, reason) > VALUES ('1', '$username', '$_POST[reason]') WHERE id = '$id'"); > > if($result) { >echo "message sent to moderators. href=\"$_SERVER[HTTP_REFERER]\">return to your previous > page."; > >} > } > > > cheers, > - Sebastian > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] no worky :|
Since you are using a database abstraction layer, I do not know what type of database you are using, but if your object has debugging, why don't you turn it on and see if the database is throwing up an error. If it does not have debugging, I would suggest printing out the query instead of trying to run it, so you can see what is wrong with it. > -Original Message- > From: Sebastian [mailto:[EMAIL PROTECTED] > Sent: Thursday, April 03, 2003 2:33 PM > To: Jennifer Goodie; php list > Subject: Re: [PHP] no worky :| > > > thanks for pointing that out yeah, you're right it was wrong, > should be > "UPDATE news_comments SET WHERE ..." > > since there was already a row. > > ... still can't get it to post to the database though. > > cheers, > - Sebastian > > > - Original Message - > From: "Jennifer Goodie" <[EMAIL PROTECTED]> > > > | Have you checked to make sure your query works, the syntax looks really > odd. > | I've never seen INSERT ... WHERE > | > | > -Original Message- > | > From: Sebastian [mailto:[EMAIL PROTECTED] > | > Sent: Thursday, April 03, 2003 2:20 PM > | > To: php list > | > Subject: [PHP] no worky :| > | > > | > > | > Hello, > | > > | > This form is really giving me a fight. > | > > | > I am connected to the database, yet it won't submit, Is the form and > | > $_POST's Okay? > | > > | > echo " > | > > | > reason: > | > > | > > | > moderation\"> > | > "; > | > > | > if($_POST[reason]) { > | > $result = $db->sql("INSERT INTO comments (reported, > reportedby, reason) > | > VALUES ('1', '$username', '$_POST[reason]') WHERE id = '$id'"); > | > > | > if($result) { > | >echo "message sent to moderators. | > href=\"$_SERVER[HTTP_REFERER]\">return to your previous > | > page."; > | > > | >} > | > } > | > > | > > | > cheers, > | > - Sebastian > | > > | > > | > > | > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Which PHP version is stable with apache 2.0.39
http://www.php.net/manual/en/install.apache2.php > -Original Message- > From: Jason Smith [mailto:[EMAIL PROTECTED] > Sent: Thursday, April 03, 2003 5:22 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Which PHP version is stable with apache 2.0.39 > > > Hi, > > Need some information as I cant seem to find it in the manual or online. > > We are running apache 2.0.39 on redhat 7.3 and would like to run PHP on > the same server. > I am having trouble finding out if there is a stable version that runs > with Apache 2.0.39 > > Any help appreciated > > Cheers > jason > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Quick Sessions ?
Your cookie path is "" not "/" so your cookie is only readble by the directory it was set in. Check your session.cookie_path http://www.php.net/manual/en/ref.session.php > -Original Message- > From: Anthony [mailto:[EMAIL PROTECTED] > Sent: Friday, April 04, 2003 12:03 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Quick Sessions ? > > > I have an issue. For some reason I can't pass session data to > pages within > different folders. What I have is a page in like > mydomain.com/something/somepage.php This page creates session information > and holds it correctly. The app collects user data and then > eventualy sends > a location header to ../index.html <- in this file there is php that check > to see if the session data is there and. no longer there!!! So what > gives? Can I not pass session info from pages in folders? I'm > not changing > the domain, so I shouldn't loose the cookie I'm lost Please help > me out :) > > - Anthony > > > > -- > 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] Includes confusion
PHP parses includes inline, so whatever the scope is where the file is included, is the scope of the variables that the include contains. You can declare the variables global in your fuction and it will use what was included, that would be the quick fix, you could also switch your include to use DEFINE instead of just instantiating variables. Constants have global scope. > -Original Message- > From: Mike Tuller [mailto:[EMAIL PROTECTED] > Sent: Friday, April 04, 2003 12:25 PM > To: php mailing list list > Subject: [PHP] Includes confusion > > > I can't figure this out. I have a line where I include a file > > include "/Library/WebServer/includes/database_connection.inc"; > > I want to have this declared in one location, so that I don't have to > change multiple lines if I ever move the application, everything works > fine except inside functions. So if I have the following: > > include "/Library/WebServer/includes/database_connection.inc"; > > function list_search_results() > { > // my code that lists search results > } > > The functions returns an error, but if I do this: > > > function list_search_results() > { > include "/Library/WebServer/includes/database_connection.inc"; > // my code that lists search results > } > > Everything works fine. Shouldn't the function be able to use the > include file when it is declared outside the function? > > 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] Quick Sessions ?
You want it to be / so they are readable by the entire site. From your syptoms a bad path seemed to be the problem, but it looks like it is something else. > -Original Message- > From: Anthony [mailto:[EMAIL PROTECTED] > Sent: Friday, April 04, 2003 12:37 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Quick Sessions ? > > > Thanks for the response. I think I might just not totaly understand this > switch. This is right out of my php.ini file: > > ; The path for which the cookie is valid. > session.cookie_path = / > > I tried deleting the / and got no change in behavior. It seems to me that > what I need is something like > session.cookie_path = /, ../ > but that doesn't work. Any other ideas? > > - Anthony > > "Jennifer Goodie" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Your cookie path is "" not "/" so your cookie is only readble by the > > directory it was set in. Check your session.cookie_path > > > > http://www.php.net/manual/en/ref.session.php > > > > > -Original Message- > > > From: Anthony [mailto:[EMAIL PROTECTED] > > > Sent: Friday, April 04, 2003 12:03 PM > > > To: [EMAIL PROTECTED] > > > Subject: [PHP] Quick Sessions ? > > > > > > > > > I have an issue. For some reason I can't pass session data to > > > pages within > > > different folders. What I have is a page in like > > > mydomain.com/something/somepage.php This page creates session > information > > > and holds it correctly. The app collects user data and then > > > eventualy sends > > > a location header to ../index.html <- in this file there is php that > check > > > to see if the session data is there and. no longer > there!!! So what > > > gives? Can I not pass session info from pages in folders? I'm > > > not changing > > > the domain, so I shouldn't loose the cookie I'm lost Please > help > > > me out :) > > > > > > - Anthony > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] dynamic IF statement
HTTP_GET_VARS["id"] is probably empty so this won't work, stick a $ in front of it. > -Original Message- > From: Leif K-Brooks [mailto:[EMAIL PROTECTED] > Sent: Friday, April 04, 2003 12:38 PM > To: Tim Haskins > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] dynamic IF statement > > > If I understand you right, you want: > > if (HTTP_GET_VARS["id"] == $row_rsProducts['prID']){ > ...do stuff... > } > > > Tim Haskins wrote: > > >How does one create a statement that basically says: > > > > $row_rsProducts['prID']; ?>" ) > >{ ?> > > > >Basically, I want to say, "show if url value is equal to this database > >record's ID value - The last part is what I can't seem to get to > work- any > >ideas??? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Heredoc question
> Can one use within the heredoc syntax or is there > another way?? I'm trying to dynamically generate email from > generic text but with obvious additions, like this: http://us4.php.net/types.string says that heredoc acts just like double quoted, which would mean it expands variables, so I would try just throwing them in there like this... $message = <get_id()} has been approved. Here is the link to the lot: my_message; There's an example of almost exactly like this on that page. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Heredoc question
> That's fine for that but I have several places that use if's and else's... > > Sparky > > http://us4.php.net/types.string says that heredoc acts just like double > > quoted, which would mean it expands variables, so I would try just Than I would suggest reading the manual page (the link I gave) to see if you can do that. Would you put an if or an else inside a double quoted string and expect it to work? I wouldn't. Maybe I'm wrong though. Read the manual. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] [FYI] phpbooks.com
> I mean if someone is into programming/php they will have enough > brains (most of the time) to do that much right? By that logic they'd also have enough brains to look at the documentation before asking questions on the mailing list, or to not reply to spam on the list, etc., etc. and we all know that isn't true. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What's wrong with this code??
> Problem lines > > if ($mo == 06 and $dy > 01 and $dy < 09) { $wd = "8"; } > if ($mo == 06 and $dy > 08) { $wd = "9"; } > but if I change my date to 06/02 then no matter what I > try, $wd always gets the value of 9 (it should be 8 on this > date). It should > not get the value 9 until the 9th of June. If the first if is true, so is the second, unless $dy == 8. In this case, the number is 2, which is greater than 1 and less than both 8 and 9, making both statements true. Check your logic. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Code Help Please
> I need to find if table1.username = table2.domain/table2.username is If you are using mySQL you can use CONCAT table1.username = CONCAT(table2.domain,'/',table2.username) http://www.mysql.com/doc/en/String_functions.html#IDX1174 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] insert loop logic
> When i get these values I want to enter them into the database but > 1)I should enter only the first 5 (and ignore the rest) into the database > 2)it has to enter 1 record for every every "id" picked > eg: > if id[1], id[2],id[3] and id[4] were picked it should enter this as 4 > differient records > > > How do i do this? I have tried using a for loop but somewhere the logic is > very very bad :-) and so i deleted the whole damn thing. Obviously the query is not all there and needs fleshing out, I don't know what all you are inserting. I didn't really test, so it might have a bug or something. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Warning Spammer
> so do they get the emails from the archive ? ?if so password protect > please !! Which one? This list is archived on numerous sites. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Quickie array question
> > foreach($newlines as $newline) { > > #how do I get the index of the array each time $newline is printed out? > > echo ??; > } foreach($newlines as $id=>$newline){ echo $id.''.$newline; } read the documentation http://us3.php.net/manual/en/control-structures.foreach.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php