[PHP] php and mysql
I have a db with events in it. i would like to pull the events out via php, but i would like them to be ordered by month number (1-12). When I do this (Select blah blah From blah Order By Month_Start ASC) it orders the months by number, but it starts with october (month 10) I am pretty sure it is doing this because I have no events until april (month 4). So how can i get it to order the months by their numbers starting with january (1) and going to december (12) even if I do not have events until april (4)? _ The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] image upload question
I want to be able to resize an image to 331x248 when I upload it and also create a thumbnail. All of these pics are coming from a digital camera set on 800x600 so the dimension above should be fine and i would like the thumbnail to be 77x58. I know the code to upload the image, but I am not sure how to resize them. Please help! Thanks in advance. _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] image upload question
Nothing really. I did happen across a couple of tutorials from phpbuilder.com http://www.phpbuilder.com/columns/michael20020712.php3?print_mode=1 and http://www.phpbuilder.com/columns/bealers2904.php3?page=3print_mode=1 may be able to piece something together from these two articles. let me know if you find out anything. thanks, TD Hey Tyler, Did you get any progress on this? I'm trying to do the same thing. Johnny _ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] updating pages with php
I have a web page with a simple introductory paragraph on it. I was going to store the paragraph in a mySQL DB and create an administration page so people could easily edit the paragraph itself or change it all together. The problem I ran into is that mySQL will not allow certain punctuation inside of a record (no comma's). So now I am left trying to figure out how I can have the user update the paragraph without having it in a db. Can someone shoot me in the proper direction? Thanks in advance, your help is greatly appreciated. bk _ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] updating pages with php
When I take the comma's out it works. then I try to put them back in and it will not work. What I have discovered is that I can manually type it in the mysql server with whatever characters I want, but when I try to update it with a sql file or via the webpage I created with the comma's it gives me errors. I take them out of the sql text and webpage and it works fine. From: John W. Holmes [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: 'Tyler Durdin' [EMAIL PROTECTED],[EMAIL PROTECTED] Subject: RE: [PHP] updating pages with php Date: Wed, 5 Mar 2003 13:23:00 -0500 I have a web page with a simple introductory paragraph on it. I was going to store the paragraph in a mySQL DB and create an administration page so people could easily edit the paragraph itself or change it all together. The problem I ran into is that mySQL will not allow certain punctuation inside of a record (no comma's). So now I am left trying to figure out how I can have the user update the paragraph without having it in a db. Can someone shoot me in the proper direction? Thanks in advance, your help is greatly appreciated. MySQL will allow any characters; the problem is in your code. ---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 _ The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] updating pages with php
$Query = UPDATE $TableName SET Intro_Title = '$Intro_Title', Intro = '$Intro' WHERE ID = '$ID'; From: Liam Gibbs [EMAIL PROTECTED] To: php list [EMAIL PROTECTED] Subject: Re: [PHP] updating pages with php Date: Wed, 5 Mar 2003 13:33:11 -0500 What I have discovered is that I can manually type it in the mysql server with whatever characters I want, but when I try to update it with a sql file or via the webpage I created with the comma's it gives me errors. I take them out of the sql text and webpage and it works fine. The problem can't be with the commas. Post the query here, or try an SQL list. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] updating pages with php
They are all text fields. Intro title is just a line of text that says Welcome to this website... Intro, is the text of the introduction. You are correct and it is apostophe's and not comma's that cause the error. What do I do to get around that? From: Liam Gibbs [EMAIL PROTECTED] To: php list [EMAIL PROTECTED] Subject: Re: [PHP] updating pages with php Date: Wed, 5 Mar 2003 13:44:40 -0500 $Query = UPDATE $TableName SET Intro_Title = '$Intro_Title', Intro = '$Intro' WHERE ID = '$ID'; But what's being sent to SQL? What's contained in $TableName, $Intro_Title, etc.? And what data types are all those fields? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php and mysql
When using a php script to pull recorda from a db how can I cut the records at 1/4 of the total and arrange them alaphabetically according to a certain field? Thanks in advance. _ MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] basic question
What is the most secure way to access a mysql db with a php script? And could someone provide an example? What are the best password practices for the script to connect to the mysql db? Also, how should I set the directory permissions for the html pages with php scripts? _ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Upload file
I am using PHP 4.2.1 and have noticed that I can only upload files with a php script when I have the php.ini file set with register globals on. Is there a way to use the file upload scripts without having to turn the register globals on? How about newer versions of PHP? _ The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php and databases
Is there anyway to have php convert a database from mySQL to Access via a webpage? I have a couple of people here who use Access to do mail merging things with word and it would make my life a ton easier if I did not have to convert the db's everytime they want the info. If anyone has any thoughts on how to go about this it would be greatly appreciated. Thanks in advance. Bobby _ Surf the Web without missing calls! Get MSN Broadband. http://resourcecenter.msn.com/access/plans/freeactivation.asp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL ?
Why not just let such a simple question go then? Especially since your reply is also off topic? Also, the question I asked was part of a reply from a previous topic. Thanks to all who answered my simple question. It is greatly appreciated. From: Analysis Solutions [EMAIL PROTECTED] To: PHP List [EMAIL PROTECTED] Subject: Re: [PHP] SQL ? Date: Mon, 12 Aug 2002 10:26:55 -0400 On Mon, Aug 12, 2002 at 02:15:23PM +, Tyler Durdin wrote: SELECT *, IF (answer = 'a', TRUE, FALSE) AS Answer-A What does the As Answer-A mean and what does it do? Why not examine the manual for the answer to such a basic question, especially one that is off topic for the list you posted to? Assuming you're using MySQL read http://www.mysql.com/doc/en/SELECT.html and you'll quickly come across the meaning of AS. --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL ?
My question as to what the AS statement did was just that, a question. It works perfectly, but I was curious if I was not completely understanding of what it did or if I could make better use of it. As for my reply i feel it was completely justified in that my post was on topic. I understand that Dan is on here alot just trying to be helpful, but in this case he had no intention of being helpful when he posted his reply. The fact is the message was on topic and if he had no useful information he should not have posted at all. It was never my intention to irritate anyone, just defend my post as it was a justified. If we have nothing nice or helpful to post to one another, then we should post nothing at all. From: DL Neil [EMAIL PROTECTED] To: Tyler Durdin [EMAIL PROTECTED],[EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: [PHP] SQL ? Date: Mon, 12 Aug 2002 15:49:45 +0100 Now then, let's all play nicely together! Dan: relevance It is a PHP question because whereas the SQL query SELECT fred FROM tbl produces an array element back in PHP such as $row[ fred ], this convention/mapping comes well unstuck if you submit something like SELECT IF ( answer = 'a', TRUE, FALSE )... or even SELECT fred+barney... Accordingly the need to create an alias column name (Answer-A) and thereafter in PHP to access the returned data with something like $row[ Answer-A ]. Tyler: appreciation and politeness I thought this looked familiar, and it is part of something I sent to you 36 hours ago to perform cross-totalling on a survey or exam results type database. Since then there has been no comment from you, except to others. If the suggestion doesn't work, please have the courtesy to come back to me, at least by cc:, for correction or amplification. NB If you had tested it at the MySQL (?) command line or using a management tool (recommended testing procedure before implementing in PHP), then you would have observed the result. Dan is often here, being helpful. Did you really mean to irritate two people by thoughtlessness if not deed, during the course of a single conversation? =dn Why not just let such a simple question go then? Especially since your reply is also off topic? Also, the question I asked was part of a reply from a previous topic. Thanks to all who answered my simple question. It is greatly appreciated. On Mon, Aug 12, 2002 at 02:15:23PM +, Tyler Durdin wrote: SELECT *, IF (answer = 'a', TRUE, FALSE) AS Answer-A What does the As Answer-A mean and what does it do? Why not examine the manual for the answer to such a basic question, especially one that is off topic for the list you posted to? Assuming you're using MySQL read http://www.mysql.com/doc/en/SELECT.html and you'll quickly come across the meaning of AS. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] records in db
If I have a field in my DB that can have 4 different answers, lets say a,b,c and d. How can I count the number of each in that field. So if there are 4 a's 1 b 0 c's and 12 d's how can I get php to count this? _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sessions
I have a login page using sessions the old way. I have switched it to using $_SESSION['valid_user']and was wondering how to switch this (below) part of my code. In the if statement I am checking to see if the session is registered, but using $_SESSION[''] I do not understand how to do this or the isset statement. As of now my login page will login anyone and log them in as whatever they type in the username and password fields even if the are not in the DB. if (session_is_registered(valid_user)) { blah blah... } else { if (isset($userid)) { echo Could not log you on; } else { echo You are not logged in; } //this is where I created my login form that submits to itself and runs through the code _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] inserting info into db
I have a DB that will take answers to an 82 question survey, but i have the survey divided into 4 html pages(forms) of 20 or so question per page. The people taking the survey are not required to fill out every question on the survey. i was wondering how i can insert the data into the db this way. For example, the first html page goes to question #24 the next starts at 25 an goes to 47. How can i enter 25 to 47 into the db and keep it all in numerical order when 1-24 are entered first? One more question, does anyone have any recommendations on how i can make it so the users can take page one of the survey and then come back and finish pages 2 (or something similar to this where they finish one of the pages and come back to finish the others later) later? Thanks in advance. _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] comparing a variable to value in DB
I have a column in my DB named username and i am trying to compare a session ID called $username to the field in my DB called username. The way i had done it before was SELECT * from tablename WHERE Tablename.username == $username, but this does not seem to be working is there a better way to do this? Also, I would like to know how to tell if a field is blank. For example, if my SELECT statement comes back and there is no data in the username column how can i check for this? _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] still on sessions
Alright this is my last question. I have closed the session, but can i make sure it is closed? i want to use something like if the session is closed then print a message session closed. _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: sessions
So doing it the new way ($_SESSION['variable']) how do you close or unregister a session? _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: sessions
Still the same message. It has been actually logging me out all along, but it will not run through that if statement. Could you trye if (!empty($HTTP_SESSION_VARS['valid_user']) use $HTTP_SESSION_VARS _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: sessions
Still getting the same message. This script used to work perfectly in an older version of php. Could it be a problem with how I am setting the sessions. Has anything changed with how we code sessions? It's because you are unregistering the valid_user variable, but, the old_user var you defined early on still exists. So, if (!empty($old_user)) will equal FALSE, giving you the result you are getting. Change it to if (!empty($valid_user)). Monty _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sessions
Here is the code that starts and registers the session. It is login page that logs in to itself so the form that produces $_POST[username] is actually on the same page, but nothing happens until the user logs in. It there is something in this code that is not correct or making the other code from the previous mssages not work please let me know. Thanks again for all of the help. ? session_start(); $username = $_POST[username]; $password = $_POST[password]; if ($username $password) { //user has just tried to login $db_conn = mysql_connect(server, user, pass); mysql_select_db(DB_name, $db_conn); $query = SELECT * FROM members WHERE username='$username'and password='$password'; $result = mysql_query($query, $db_conn); if (mysql_num_rows($result) 0 ) { //if they are in the db register the username $valid_user2 = $username; session_register(valid_user2); } } ? _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sessions
I used this logout page using sessions a while ago and it used to work great, but now it doesn't work. The only thing i have changed is my version of php. Can someone take a look and see what i have to change? ? session_start(); $old_user = $valid_user; $result = session_unregister(valid_user); session_destroy(); ? then a little further down i have this php? if (!empty($old_user)) { if ($result) { echo Logged out.br; } else { echo Could not log you out.br; } } else { echo You have not logged in; therefore, you cannot logout.br; } ? It seems to log me out still, but it always gives me the you have not logged in; therefor, you cannot logout message. i also checked it with a script to see if my original sessions were actually registering and it seemed that they were. i am stumped. Any ideas would be greatly appreciated. Thanks. _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sessions
yes they are off. I did just recently discover this whole form thing, but i did not know about the session variables. I put the session registration code up in another post, if you would not mind looking at that and recommending changes. in the mean time I'll try and get up to speed on the new stuff. I really appreciate the help. If you upgraded to the new version and overwrote your old php.ini file then they are off. If you have access to the php.ini file you can open it and search for register_globals and see if it is set to On or Off. If you do not have access to the php.ini you can use : $reg_glob = get_cfg_var(register_globals); print $reg_glob; I think it will display a 1 for on and a 0 for off. If they are off you can either get used to the new, more secure way of doing things, or you can turn them back on in the php.ini file or in a .htaccess file in your directory. If you choose the .htaccess method you only need to add the following line to your .htaccess file: php_flag register_globals on If you decide to use the new, more secure method session vars will be in one of two new global arrays: $_SESSION --OR-- $HTTP_SESSION_VARS more info about that can be found here: http://www.php.net/manual/en/ref.session.php So, in your case, $valid_user would become $_SESSION['valid_user'] or $HTTP_SESSION_VARS['valid_user']. With register globals set to off you will find that forms will no longer work the way you think. example: if you had a form with input name=var value=testing in it and you submitted it on the next page you would expect that $var would be testing but it is not! Now you must use either $_POST['var'] for form method=post and for query strings in URL's or method=get forms you would use $_GET['var'] If you have any more questions I'll help you out. _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php redirect
I already tried that and i got an error that said Cannot add header information - headers already sent by (another snippet of code I have in the page. Use the header() function http://www.php.net/manual/en/function.header.php * _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sessions
I don't know. Tell me where I would find it and I'll look : -) Sorry, pretty new to all of this. Do you have register globals off? Jim Grill Support Web-1 Hosting http://www.web-1hosting.net - Original Message - From: Tyler Durdin [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, July 26, 2002 12:33 PM Subject: [PHP] sessions I used this logout page using sessions a while ago and it used to work great, but now it doesn't work. The only thing i have changed is my version of php. Can someone take a look and see what i have to change? ? session_start(); $old_user = $valid_user; $result = session_unregister(valid_user); session_destroy(); ? then a little further down i have this php? if (!empty($old_user)) { if ($result) { echo Logged out.br; } else { echo Could not log you out.br; } } else { echo You have not logged in; therefore, you cannot logout.br; } ? It seems to log me out still, but it always gives me the you have not logged in; therefor, you cannot logout message. i also checked it with a script to see if my original sessions were actually registering and it seemed that they were. i am stumped. Any ideas would be greatly appreciated. Thanks. _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] still on sessions
alrigh I have switched everything over to the $_Session['variable'] style of session. Next question, I have a little script that used to check if the session was registered and if it was not it would redirect to the login page. How do i accomplish this now that i cannot check if the session is registered? Here is what i have. ? session_start(); if (session_registered(valid_user2')) { echo you are registered; } else { header(Location: http://loginpage.com;); } ? How do I check if a session is active/registered or whatever it is so i cn still redirect or assign variables? _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] pulling records from mysql
I have a column in my table named firstname with twenty records in it. How can i use php to pull out individual records (say for ex. record 16)? Also, how could i pull out all records upto number 15? Thanks in advance. _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] printing results from mysql fetch array
If I select all from my db how can I print the individual results? For example, say i want to print record number 16 from the firstname column into a table. How can i accomplish this? I have all of my db access coded and have it selecting all from the db, but i want to print individual records into my table. Can I set the records to variables and use something like ?php echo {whatever would go here} ? I am really lost here please help! _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php