[PHP-DB] mail() function
I have set up my pc as a test server Windows 98 running Apache as a service, PHP and MySQL but cannot get the mail() function to work. After a long wait, I get an error Warning: Failed to Receive in c:\phpdev\www\assets\submit_users.php on line 17. Is there something I should be changing in the PHP.ini. I used the default settings for this. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Where have my errors gone?
If I had a syntax error, I used to get a message back telling me. Now I just get a blank page. I have tried adding error_reporting=E_ALL; to the page, but still no errors. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Where have my errors gone?
Got it . My ISP had upgraded PHP and left error reporting off. They have now fixed it for me. Alex Francis [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] If I had a syntax error, I used to get a message back telling me. Now I just get a blank page. I have tried adding error_reporting=E_ALL; to the page, but still no errors. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Apache Problem
Please bear with me, I am a complete newbie. I am trying to use an in house server for test purposes and am having some problems. I get an Internal Server error and when I look at the error log the error is as follows: Premature end of script headers: /apache/php/php.exe. I have tried the Apache site, but can't find anything about it. Can someone point me to where I may get help or information. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Echo with extra characters
I have the following code in my page as a header. ? if ($mainarea==Language) { header(Location:add_5-14_material.php?mainarea=$mainarea); } else { } ? When I echo $mainarea I get \'Language\'. I think it is something to do with my quotation marks but need some help. How do I get rid of the ' and \ so that I am left with my variable?. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: blob
Why not upload the PDF file to a files directory and just put the path and filename in your database. Natividad Castro [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi to all, I want to be able to load PDFs into mysql DB, but I'm not very familiar with the blob data type? Can someone point me on the right direction how to do this? Thanks in advance Nato -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Using ifelse to go to another page
I have dropdown lists on one page which were working fine. However I need to make a slight alteration and add another 2 ifelse statements to go to another page instead of carrying out the $SQL statement. I have added the last 2 ifelse statements but I still get the SELECT statement working. Can someone help please. ? if ($level==All Levels) { $SQL = SELECT * FROM courses where department='$department'; } elseif ($level!=All Levels) { $SQL = SELECT * FROM courses where department='$department' and level='$level'; } elseif ($department==5-14 Curriculum) { A HREF 'add_5-14_material.php'/A; } elseif ($level==5-14 Curriculum) { A HREF 'add_5-14_material.php'/A; } $retid = mysql_db_query($dbname, $SQL, $link); if (!$retid) { echo( mysql_error()); } else { // the rest creates a table with the information from the SELECT statement. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Using ifelse to redirect to another page
I have dropdown lists on one page which were working fine. However I need to make a slight alteration and add another 2 ifelse statements to go to another page instead of carrying out the $SQL statement. I have added the last 2 ifelse statements but I still get the SELECT statement working. Can someone help please. ? if ($level==All Levels) { $SQL = SELECT * FROM courses where department='$department'; } elseif ($level!=All Levels) { $SQL = SELECT * FROM courses where department='$department' and level='$level'; } elseif ($department==5-14 Curriculum) { A HREF 'add_5-14_material.php'/A; } elseif ($level==5-14 Curriculum) { A HREF 'add_5-14_material.php'/A; } $retid = mysql_db_query($dbname, $SQL, $link); if (!$retid) { echo( mysql_error()); } else { // the rest creates a table with the information from the SELECT statement. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Passing selection to next page
I have a drop down list created using the following code and am having trouble passing my selection to the next page. Can anyone help? ? $query = select distinct department from courses order by department; $result = mysql_query($query); echo SELECT ID='Category Combo Box' NAME='department'; echo OPTION VALUE=' ' SELECTEDSelect Department/OPTION; While ($row = mysql_fetch_assoc($result)) { echo OPTION VALUE='; echo stripslashes($row[department]); echo ' ; echo stripslashes($row[department]); echo /OPTION; } echo /SELECT; mysql_free_result($result); ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Now not selecting enough
I am using the following script which I have used with minor variations, several times before without any trouble. I have 3 items in my database but the script only returns 1. I can change which one by leaving off the order by filter, but can't get all three. Where am I going wrong. (PHP and MySQL). $SQL = 'SELECT id, DATE_FORMAT(meetingdate, %D %M %Y)as mtgdate FROM boardprevious order by meetingdate desc '; // execute SQL statement $ret = mysql_db_query($dbname,$SQL,$link); if (!$ret) { echo( mysql_error()); } else { // retrieve values while ($row = mysql_fetch_array($ret)) { $meetingdate = $row[mtgdate]; $id = $row[id]; } } echo (h5A HREF=\minutes_detail.php?id=$id\$meetingdate/A/h5); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Now not selecting enough
That was quick - Works alright now thank you Jason Selph [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Try putting this: echo (h5A HREF=\minutes_detail.php?id=$id\$meetingdate/A/h5); in your while loop. Right now it is just popping out the last record. Cheers Jason -Original Message- From: Alex Francis [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 18, 2002 11:00 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Now not selecting enough I am using the following script which I have used with minor variations, several times before without any trouble. I have 3 items in my database but the script only returns 1. I can change which one by leaving off the order by filter, but can't get all three. Where am I going wrong. (PHP and MySQL). $SQL = 'SELECT id, DATE_FORMAT(meetingdate, %D %M %Y)as mtgdate FROM boardprevious order by meetingdate desc '; // execute SQL statement $ret = mysql_db_query($dbname,$SQL,$link); if (!$ret) { echo( mysql_error()); } else { // retrieve values while ($row = mysql_fetch_array($ret)) { $meetingdate = $row[mtgdate]; $id = $row[id]; } } echo (h5A HREF=\minutes_detail.php?id=$id\$meetingdate/A/h5); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Selecting more than asked for
Thanks to everyone for your help. It was my own stupidity which was collecting the wrong data. I wasn't passing the value of unit_id to my table. Andre gemünd [EMAIL PROTECTED] wrote in message 000b01c2a3af$753d2160$596d8550@lithium3">news:000b01c2a3af$753d2160$596d8550@lithium3... You shouldnt get any syntax errors i think use $sql = SELECT * FROM resources WHERE unit_id='$unit_id' AND unit_id IS NOT NULL ORDER BY level; as far as your unit_id is DEFAULT NULL. Otherwise try using WHERE unit_id0 AND unit_id'' or something like this, depending on your type of variable. If this isn't solving your problem, show us more source-code and the table-columns definition. greets ag - Original Message - From: Alex Francis [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, December 14, 2002 8:37 PM Subject: [PHP-DB] Selecting more than asked for When using the statement below, as well as getting the data corresponding to $unit_id, I also get any data where unit_id field is blank. I have tried various permutations of unit_id IS NOT NULL, but get syntax errors. Can someone help to get the syntax correct. $SQL = SELECT * FROM resources where unit_id='$unit_id' order by level ; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Selecting more than asked for
I am using PHP and MySQL and in one section I am trying to SELECT for a table where unit_id = $variable. In that column I have several blank items. When I select a particular variable I get that plus all the blanks. I presume there is some way of getting just those which meet my criteria. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Apache, PHP and MySQL
DN Sorry, I cant find this Action line. If you mean the DLLs being copied to the Windows\System directory, I have done that. Is there a better tutorial for installing Apache and PHP, and if so should I try to uninstall and start again. I could even reformat if necessary - all my backups on the server are on a separate hardfile. I am running Apache 1.3.24 for Win32 Dl Neil [EMAIL PROTECTED] wrote in message 142701c29f16$204ba340$c900a8c0@jrbrown">news:142701c29f16$204ba340$c900a8c0@jrbrown... Alex, I am trying to set up a test server to test updates before changing my uploaded pages. I have running Windows 98. I have Apache installed and running, and thought I have PHP installed properly. (Installed it as Welling and Thomson). However when I try to run my test.php file which should give phpinfo I get a message telling me that I am downloading a file from localhost. I presume Apache is not recognising the file type. I have added .php to the AddType application section of httpd.conf Since WT published a ClearModuleList has been added to the Apache conf file. Make sure that your brave addition doesn't get 'undone'. (shouldn't there be an Action line too? p799) Also, you aren't running Apache 2.n.n are you? =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Apache, PHP and MySQL
DN, Thank you, I found the line you were referring to, however I still have a problem. My browser comes back with page cannot be found. I created a small test html file, put it in the same directory and it worked alright. When I first add the action it couldn't find the extension dlls, but this was due to my directory structure. Here are some snippits fron my httpd.conf file My Apache route is as follows ServerRoot C:/Program Files/Apache Group/Apache PHP is in C:/PHP The IP address of this server on my network is: 192.168.1.1 ServerName http://192.168.1.1 My document root is (where I have been placing my test files) is: DocumentRoot C:/Program Files/Apache Group/Apache/htdocs Should I have changed something in the following options? # This may also be None, All, or any combination of Indexes, # Includes, FollowSymLinks, ExecCGI, or MultiViews. # # Note that MultiViews must be named *explicitly* --- Options All # doesn't give it to you. # Options Indexes FollowSymLinks MultiViews ScriptAlias ScriptAlias /cgi-bin/ C:/Program Files/Apache Group/Apache/cgi-bin/ ScriptAlias /php/ c:/php/ AddType: # AddType allows you to tweak mime.types without actually editing it, or to # make certain files to be certain types. # AddType application/x-tar .tgz AddType application/x-httpd-php .php AddType application/x-httpd-php .php3 AddType application/x-httpd-php .phtml AddType application/x-httpd-php /php/php.exe Action ( I presume I have put this in the right place) # Action lets you define media types that will execute a script whenever # a matching file is called. This eliminates the need for repeated URL # pathnames for oft-used CGI file processors. # Format: Action media/type /cgi-script/location # Format: Action handler-name /cgi-script/location # Action application/x-httpd-php ./php/php.exe # I hope that is not too much for you to look through . Dl Neil [EMAIL PROTECTED] wrote in message 147901c29f67$93bf9790$c900a8c0@jrbrown">news:147901c29f67$93bf9790$c900a8c0@jrbrown... Alex, Sorry, I cant find this Action line. =can't find it where? It's on the page number that I quoted for WT's book (unless there's a new edition out?). If it's not in the conf file then it must be added - review p799 and around - they have a section about setting up Apache in one place, and then later when talking about setting up PHP they come back to making additions to Apache's conf file - some possibility for confusion there if you think 'been there, done that'... If you mean the DLLs being copied to the Windows\System directory, I have done that. =good stuff Is there a better tutorial for installing Apache and PHP, and if so should I try to uninstall and start =there are many tutorials around. On the PHP site there is a page of links. Pick one, eg PHPBuilder, and then scout around for what you want. Alternatively, there's been plenty of discussion here on the lists (probably more on PHP-General and PHP-Win, cf this one PHP-DB = really for database-related topics) so a charge through the archives will unearth treasures. again. I could even reformat if necessary - all my backups on the server are on a separate hardfile. =totally unnecessary to reformat. =have you tested 'pure Apache' by placing an HTML file in the/an appropriate folder and asking for it to be served through Apache (cf through the file system) - and did that work? =from this/the wrong end of the telescope, it sounds more like a conf issue for PHP than anything else (calling for refinement not brute force!) I am running Apache 1.3.24 for Win32 =a good vintage, if not the latest nouveau. =if you follow WT's instructions and it still fails, come back with the relevant snippets from the conf file and we'll work from there. =dn Dl Neil [EMAIL PROTECTED] wrote in message 142701c29f16$204ba340$c900a8c0@jrbrown">news:142701c29f16$204ba340$c900a8c0@jrbrown... Alex, I am trying to set up a test server to test updates before changing my uploaded pages. I have running Windows 98. I have Apache installed and running, and thought I have PHP installed properly. (Installed it as Welling and Thomson). However when I try to run my test.php file which should give phpinfo I get a message telling me that I am downloading a file from localhost. I presume Apache is not recognising the file type. I have added .php to the AddType application section of httpd.conf Since WT published a ClearModuleList has been added to the Apache conf file. Make sure that your brave addition doesn't get 'undone'. (shouldn't there be an Action line too? p799) Also, you aren't running Apache 2.n.n are you? =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Form TextArea Formatting
You would be easier reformatting when you take it out of the database. After getting your variable representing the text in the text box do this: $variable = nl2br($variable); Then when you display your variable the all your original new lines are retrieved. John W. Holmes [EMAIL PROTECTED] wrote in message 000301c29f7a$de69b010$7c02a8c0@coconut">news:000301c29f7a$de69b010$7c02a8c0@coconut... I've created a web form that includes a textarea input box called MessageText. The data from this form will be inserted into a mysql table. My problem is that the form users will be inserting formatted text into this textarea and I need to be able to transfer the formatting as well as the content into the database. Right now, all formatting is lost in the transfer. Any ideas or suggestions? If you're talking about spaces and tabs and newlines, the formatting isn't lost. It just that HTML doesn't render tabs or newlines or more than one space. You need to convert your plain text to HTML so it renders correctly. Newlines are br, spaces are nbsp;, etc... These URLs may help: www.php.net/nl2br www.php.net/htmlentities ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] More Apache Installation problems
At last I have Apache and PHP running on my server. My server IP is 192.168.1.1 and I have set ServerName 192.168.1.1 in my httpd.conf file. I can access my test files from the server using either http://localhost or http://192.168.1.1, however if I try the same on my main workstation I can't find the server. Is there something else I need to do. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] More Apache Installation problems
It seems like a network problem. I can access the network through windows network neighborhood but can't ping it, any suggestions? Gene Dymarskiy [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... make sure both your server and workstation can see each other. try pinging the server: ping 192.168.1.1 -Original Message- From: Alex Francis [mailto:[EMAIL PROTECTED]] Sent: Monday, December 09, 2002 1:39 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] More Apache Installation problems At last I have Apache and PHP running on my server. My server IP is 192.168.1.1 and I have set ServerName 192.168.1.1 in my httpd.conf file. I can access my test files from the server using either http://localhost or http://192.168.1.1, however if I try the same on my main workstation I can't find the server. Is there something else I need to do. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] More Apache Installation problems
Sorry, you have lost me. I have a hub with my cable modem connected and also my workstation and server. I only connect to the internet from my workstation since I need to allow my IP address to be set by my ISP and they will only allow one IP address per connection. That,s as far as I can go with the information. I don't know if I can ping anything else since I don't know how to. As you will realise I am a complete newbie who is trying to run before I can walk. Adam Williams [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... can you ping your router? is it filtering ICMP? can you ping anything? is your cat 5 cable crimped properly and you have link lights on your switch/hub/router and network card? Adam On Mon, 9 Dec 2002, Alex Francis wrote: It seems like a network problem. I can access the network through windows network neighborhood but can't ping it, any suggestions? Gene Dymarskiy [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... make sure both your server and workstation can see each other. try pinging the server: ping 192.168.1.1 -Original Message----- From: Alex Francis [mailto:[EMAIL PROTECTED]] Sent: Monday, December 09, 2002 1:39 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] More Apache Installation problems At last I have Apache and PHP running on my server. My server IP is 192.168.1.1 and I have set ServerName 192.168.1.1 in my httpd.conf file. I can access my test files from the server using either http://localhost or http://192.168.1.1, however if I try the same on my main workstation I can't find the server. Is there something else I need to do. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] More Apache Installation problems
Adam, You are correct. I had two NICs, set up exactly as you describe, but kept getting problems (I would lose my internet connection and have to reboot to get it back. I think I will try againand if that fails, buy a cable modem router. Adam Williams [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... No I think he has his WS with a real IP from his ISP and then his web server plugged into the same hub as his WS but with 192.168.1.1. He'll either need to get a 2nd NIC and give it an ip like 192.168.1.2 or get a cable modem router. Or change his WS to linux and add eth0:0 with 192.168.1.2 :) Adam On Mon, 9 Dec 2002, Gene Dymarskiy wrote: I am a bit confused. Your WS is connected to cable modem and gets public IP assigned by your ISP. Your WS is also connected to a hub shared with your web server. does it mean you have two network cards, one connected to cable modem, and the other to the hub? -Original Message- From: Alex Francis [mailto:[EMAIL PROTECTED]] Sent: Monday, December 09, 2002 2:20 PM To: Gene Dymarskiy Subject: RE: [PHP-DB] More Apache Installation problems I need to have a server assigned IP address on my workstation for my cable modem. -Original Message- From: Gene Dymarskiy [mailto:[EMAIL PROTECTED]] Sent: Monday, December 09, 2002 8:06 PM To: Alex Francis; [EMAIL PROTECTED] Subject: RE: [PHP-DB] More Apache Installation problems I'd check IP address of your workstation. make sure both the WS and the server are on the same subnet. Your WS should have 192.168 address, too. good luck -Original Message- From: Alex Francis [mailto:[EMAIL PROTECTED]] Sent: Monday, December 09, 2002 2:00 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] More Apache Installation problems It seems like a network problem. I can access the network through windows network neighborhood but can't ping it, any suggestions? Gene Dymarskiy [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... make sure both your server and workstation can see each other. try pinging the server: ping 192.168.1.1 -Original Message----- From: Alex Francis [mailto:[EMAIL PROTECTED]] Sent: Monday, December 09, 2002 1:39 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] More Apache Installation problems At last I have Apache and PHP running on my server. My server IP is 192.168.1.1 and I have set ServerName 192.168.1.1 in my httpd.conf file. I can access my test files from the server using either http://localhost or http://192.168.1.1, however if I try the same on my main workstation I can't find the server. Is there something else I need to do. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Apache, PHP and MySQL
I am trying to set up a test server to test updates before changing my uploaded pages. I have running Windows 98. I have Apache installed and running, and thought I have PHP installed properly. (Installed it as Welling and Thomson). However when I try to run my test.php file which should give phpinfo I get a message telling me that I am downloading a file from localhost. I presume Apache is not recognising the file type. I have added .php to the AddType application section of httpd.conf -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Single occurance of data
I have two tables in my database with a department name. One table (department), the name only appears once and it includes all departments in the school. In the other table, (courses) department can appear several times, but not all departments will be in the table. I used the following code to try to get the names of the departments from the courses table, but unfortunately I get all occurences of the department. Can someone help me get ony one occurrence of each department from the courses table. $query = select departments.department, courses.department from departments, courses where departments.department=courses.department; $result = mysql_query($query); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Pausing a script
Instead of exiting the following script after Use your Browser Back Button to choose another I would like to simply pause it until some clicks a link to allow them to upload the file even if it already on the server. I have been playing about with break but I can't seem to get that to do what I want. Ideally I would like 2 buttons, one to go back to the already filled in form and the other to upload the file. $upfile = ../files/$userfile_name; if (file_exists($upfile)) { echo The file $userfile_name already exists; echo Use your Browser Back Button to choose another; exit; } if ( !copy($userfile, $upfile)) { echo Error: Could not save file. br.mysql_error()); exit; } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] File Download - Complete Newbie
I am trying to download file stored in a directory on my server. The information and the path to the file are stored in a MySQL database. This information is then displayed in a table. I now need to link to the correct file to download it and hav'nt a clue how to do it. Can someone help or point me to a tutorial which shows how to do this. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Value from drop down list not being passed to database
I have a table with a combi box drawing values from one table in a database and this should be inserted into another table along with other information: FORM NAME=Table1FORM ACTION=submit_new_unit.php METHOD=POST TABLE ID=Table1 BORDER=1 BGCOLOR=#CC CELLSPACING=3 CELLPADDING=1 WIDTH=100% TR TD WIDTH=142 P ALIGN=RIGHTBCourse ID :/B/P /TD TD WIDTH=365 P SELECT ID=Forms Combo Box1 NAME=FormsComboBox1 ?include (../config.inc.php); mysql_select_db(grange) or die (unable to access database:.mysql_error());? ?php $results = mysql_query(select course_id from courses) or die(Unable to process queries at this time: . mysql_error()); echo(option value=''other/option\n); echo(option value='' Select Course/option\n); while ($crs = mysql_fetch_array($results)) { $course= $crs[course_id]; echo(option value='$course'$course /option\n); } ? /SELECT /TD /TR TR TD WIDTH=142 P ALIGN=RIGHTBUnit ID :/B/P/TD TD WIDTH=365 PINPUT ID=Forms Edit Field4 TYPE=TEXT NAME=unit_id VALUE= SIZE=44 MAXLENGTH=44/TD /TRTR TD WIDTH=142 P ALIGN=RIGHTBUnit Name :/B/P/TD TD WIDTH=365 PINPUT ID=Forms Edit Field5 TYPE=TEXT NAME=unit_name VALUE= SIZE=44 MAXLENGTH=44/TD /TR TR TD WIDTH=142 P ALIGN=RIGHTBUnit Outcomes :/B/P /TD TD WIDTH=365 PTEXTAREA WRAP=PHYSICAL ID=Forms Multi-Line1 NAME=unit_outcomes ROWS=3 COLS=42/TEXTAREA/TD/TR TRTD WIDTH=142P ALIGN=RIGHTBRequirements :/B/P/TD TD WIDTH=365PINPUT ID=Forms Edit Field7 TYPE=TEXT NAME=requirements VALUE= SIZE=44 MAXLENGTH=44/TD /TR TRTD WIDTH=142P ALIGN=RIGHTTABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=0 NOF=TE TRTD ALIGN=LEFTINPUT TYPE=SUBMIT NAME=FormsButton3 VALUE=Clear Form ID=Forms Button3/TD/TR /TABLE/TD TD WIDTH=365PTABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=0 NOF=TETR TD ALIGN=RIGHTINPUT TYPE=SUBMIT NAME=FormsButton4 VALUE=Enter Unit ID=Forms Button4/TD/TR /TABLE/TD/TR /TABLE /FORM Information passes to a submit page to insert the code into the database: ?include (../config.inc.php); ? ?php //receive and handle data generated by enter_unit.php $query = insert into units (course_id, unit_id, unit_name, unit_outcomes, requirements) values ('.$course.', '.$unit_id.', '.$unit_name.', '.$unit_outcomes.', '.$requirements.'); echo (The query is: BR$queryP\n); if (mysql_db_query ($dbname, $query, $link)){ echo (The unit was successfully inserted. BR\n); } else { echo (mysql_error()); } mysql_close ($link); ? My problem is that all the data is being inserted correctly except the data from the drop down box. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Mail Again
Problem is!!! PHP.INI is at my ISP. Is there a way to make it think it has been changed. -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. David Robley [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... Got almost everything to work. Thank you all for your input. Code as follows: ?include (../config.inc.php); ? ?php // setup SQL statement to retrieve link $SQL = SELECT * FROM $tablename1 ; $SQL = $SQL . WHERE id = $id ; // execute SQL statement $ret = mysql_db_query($dbname,$SQL,$link); if (!$ret) { echo(ERROR: . mysql_error() . \n$SQL\n); } echo (PB Email Sent/B/P\n); // retrieve values $row = mysql_fetch_array($ret); $email = $row[email]; $title = $row[title]; $comments = $row[comments]; $title = $row[title]; mail($email, $title, $comments, $emailaddress); mysql_close($link); ? $emailaddress is set in the config.inc.php file and comes in alright as a header in the note. However, the mail is sent from the following: nobody [[EMAIL PROTECTED]] Is there a way to tell the PHP Server where the mail is coming from. There is an item in your php.ini sendmail_from string Which From: mail address should be used in mail sent from PHP under Windows. If you look at the docs for mail(), you'll see that there are also examples of using the fourth argument to mail() for extra headers, including the From: header. I am not sure whether using From: under Windows works in lieu of the php.ini entry. -- David Robley Temporary Kiwi! Quod subigo farinam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Mail Again
Got it at Last Thank you -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. Lisi [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... You can also add the following line to your code: $header = From: Your Name [EMAIL PROTECTED]\n; and write your mail statement like this: mail($email, $title, $comments, $header); You can just stick the variable $emailaddress into whichever variable is relevant - what was that for if not the from address? -Lisi There is an item in your php.ini sendmail_from string Which From: mail address should be used in mail sent from PHP under Windows. If you look at the docs for mail(), you'll see that there are also examples of using the fourth argument to mail() for extra headers, including the From: header. I am not sure whether using From: under Windows works in lieu of the php.ini entry. -- David Robley Temporary Kiwi! Quod subigo farinam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Passing on an ID
I am trying to pass an ID to a third page as follows: I have a list of stories to be checked and edited. When one is selected it is passed to a detail page and is edited and comments are added before posting the edit form back to itself to update the database. At this stage I would like to give tthe opportunity to email the comments back to the writer. I am having difficulty passing on the ID of the story to the feedback page. Can someone help please. -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Passing on an ID
The code for updating the database with any story editing and added comments is: // processed when form is submitted back onto itself if ($REQUEST_METHOD==POST) # setup SQL statement $SQL = UPDATE $tablename1 SET; $SQL = $SQL . date = '$date',; $SQL = $SQL . name = '$name', ; $SQL = $SQL . teach = '$teach', ; $SQL = $SQL . email = '$email', ; $SQL = $SQL . title = '$title', ; $SQL = $SQL . story = '$story', ; $SQL = $SQL . comments = '$comments', ; $SQL = $SQL . approved = 'Y' ; $SQL = $SQL . WHERE id = $id ; // execute SQL statement $result = mysql_db_query($dbname,$SQL,$link); // check for errors if (!$result) { echo(ERROR: . mysql_error() . \n$SQL\n); } echo (PB Link Updated/B/P\n);? FORM METHOD=link ACTION=feedback.php??'id=$id'? INPUT TYPE=submit VALUE=Email Comments ? } else { # display edit form (not post method) // setup SQL statement to retrieve link that we want to edit $SQL = SELECT * FROM $tablename1 ; $SQL = $SQL . WHERE id = $id ; # execute SQL statement $ret = mysql_db_query($dbname,$SQL,$link); // retrieve values $row = mysql_fetch_array($ret); $name = $row[name]; $date = $row[date]; $teach = $row[teach]; $email = $row[email]; $title = $row[title]; $story = $row[story]; $comments = $row[comments]; $approved = $row[approved]; The button Email Comments links to the following page: ?include (../config.inc.php); ? ?php // setup SQL statement to retrieve link that we want to edit $SQL = SELECT * FROM $tablename1 ; $SQL = $SQL . WHERE id = $id ; // execute SQL statement $ret = mysql_db_query($dbname,$SQL,$link); // retrieve values $row = mysql_fetch_array($ret); $email = $row[email]; $title = $row[title]; $comments = $row[comments]; $title = $row[title]; else {echo(mysql_error()); I get an error at $row = mysql_fetch_array($ret); -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... On Monday 22 April 2002 18:05, Alex Francis wrote: I am trying to pass an ID to a third page as follows: I have a list of stories to be checked and edited. When one is selected it is passed to a detail page and is edited and comments are added before posting the edit form back to itself to update the database. At this stage I would like to give tthe opportunity to email the comments back to the writer. I am having difficulty passing on the ID of the story to the feedback page. Can someone help please. What is the difficulty you're having? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Keep the phase, baby. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Mail
I'm still having problems with the mail function. I have installed PHP in a Windows 2000 test server. Is there something I should do to allow this function to work. I am a complete newbie and installed with the default settings. I get a Failed to connect Error when I call the mail() function. // retrieve values $row = mysql_fetch_array($ret); $email = $row[email]; $title = $row[title]; $comments = $row[comments]; $title = $row[title]; mail($email, $title, $comments); -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Mail
Here is the section from my PHP.INI [mail function] ; For Win32 only. SMTP = localhost ; For Win32 only. sendmail_from = [EMAIL PROTECTED] ; For Unix only. You may supply arguments as well (default: 'sendmail -t -i'). ;sendmail_path = I presume you mean the SMTP server set in my mail account. That is at my ISP. -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. Dl Neil [EMAIL PROTECTED] wrote in message 049e01c1ea16$8a0cf690$0600a8c0@jrbrown">news:049e01c1ea16$8a0cf690$0600a8c0@jrbrown... Alex, I'm still having problems with the mail function. I have installed PHP in a Windows 2000 test server. Is there something I should do to allow this function to work. I am a complete newbie and installed with the default settings. I get a Failed to connect Error when I call the mail() function. // retrieve values $row = mysql_fetch_array($ret); $email = $row[email]; $title = $row[title]; $comments = $row[comments]; $title = $row[title]; mail($email, $title, $comments); Mail is controlled by settings in the php.ini file. Please post the [mail function] section (changing any confidential names to protect the guilty). Setup for Windows differs from *NIX - hence confusion in many tutorials/books... this matter is frequently discussed - see archives. Regards, =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Mail
Can I set this to use the SMTP Server at my ISP but still use the database and PHP files in house. I don't want to make any changes to either the php pages or the database at the ISP until I have got it all working. Although I suppose I could set up another site and database at my ISP. Alex Francis Cameron Design 35, Drumillan Hill, Greenock, PA16 0XD Tel / Fax 01475 798106 http://www.camerondesign.co.uk email: [EMAIL PROTECTED] This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. ---BeginMessage--- Alex, That's the info in question! Here is the section from my PHP.INI [mail function] ; For Win32 only. SMTP = localhost ; For Win32 only. sendmail_from = [EMAIL PROTECTED] ; For Unix only. You may supply arguments as well (default: 'sendmail -t -i'). ;sendmail_path = I presume you mean the SMTP server set in my mail account. That is at my ISP. The SMTP= entry must be pointing at an SMTP server. Have you installed SMTP on the local box? In any case, others have had major problems using localhost, cf a machine name. FWIW, I recommend using the SMTP svr at your ISP. Because you can set up this line to be exactly the same as you have in your email package - and thus reduce variable factors, if you can get email OUT using your email client, you should be able to have high confidence that your PHP infrastructure will work! (so even if you have set up a local SMTP server, I'd get going on the ISP, and once proven switch back in-house) Regards, =dn I'm still having problems with the mail function. I have installed PHP in a Windows 2000 test server. Is there something I should do to allow this function to work. I am a complete newbie and installed with the default settings. I get a Failed to connect Error when I call the mail() function. // retrieve values $row = mysql_fetch_array($ret); $email = $row[email]; $title = $row[title]; $comments = $row[comments]; $title = $row[title]; mail($email, $title, $comments); Mail is controlled by settings in the php.ini file. Please post the [mail function] section (changing any confidential names to protect the guilty). Setup for Windows differs from *NIX - hence confusion in many tutorials/books... this matter is frequently discussed - see archives. Regards, =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Mail
Lisi I realised that just after my last post. I also realised that I would never get it to work until I make some alterations to my network. I have a broadband cable modem connected to a Windows 98 system which I use for everything. For test purposes I added a Windows 2000 system and at the moment I am reluctant to spend the time changing over the modem and I can't seem to get the Windows 2000 PC to connect through the Modem on the Windows 98 mc. I may just get as far as I can and take a chance on working on the ISP. Thank you for your help Alex Francis Cameron Design 35, Drumillan Hill, Greenock, PA16 0XD Tel / Fax 01475 798106 http://www.camerondesign.co.uk email: [EMAIL PROTECTED] This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. ---BeginMessage--- Yep, that's exactly how it works. Just like the email you send from Eudora or Outlook is all stored on your hard drive, but uses the SMTP server of your ISP, same here. -Lisi At 07:17 PM 4/22/02 +0100, Alex Francis wrote: Can I set this to use the SMTP Server at my ISP but still use the database and PHP files in house. I don't want to make any changes to either the php pages or the database at the ISP until I have got it all working. Although I suppose I could set up another site and database at my ISP. Alex Francis Cameron Design 35, Drumillan Hill, Greenock, PA16 0XD Tel / Fax 01475 798106 http://www.camerondesign.co.uk email: [EMAIL PROTECTED] This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. From: DL Neil [EMAIL PROTECTED] To: Alex Francis [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] References: [EMAIL PROTECTED] 049e01c1ea16$8a0cf690$0600a8c0@jrbrown [EMAIL PROTECTED] Subject: Re: [PHP-DB] Mail Date: Mon, 22 Apr 2002 18:53:58 +0100 Message-ID: 060401c1ea26$fcebc050$0600a8c0@jrbrown MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 X-UIDL: jj`!!6LA!QlX!!e7!! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Mail Again
Got almost everything to work. Thank you all for your input. Code as follows: ?include (../config.inc.php); ? ?php // setup SQL statement to retrieve link $SQL = SELECT * FROM $tablename1 ; $SQL = $SQL . WHERE id = $id ; // execute SQL statement $ret = mysql_db_query($dbname,$SQL,$link); if (!$ret) { echo(ERROR: . mysql_error() . \n$SQL\n); } echo (PB Email Sent/B/P\n); // retrieve values $row = mysql_fetch_array($ret); $email = $row[email]; $title = $row[title]; $comments = $row[comments]; $title = $row[title]; mail($email, $title, $comments, $emailaddress); mysql_close($link); ? $emailaddress is set in the config.inc.php file and comes in alright as a header in the note. However, the mail is sent from the following: nobody [[EMAIL PROTECTED]] Is there a way to tell the PHP Server where the mail is coming from. -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] dates in MYSQL
This may be a stupid question but I am a complete newbie. I am trying to automatically drop events from a noticeboard when the date has passed. I have stored the date of the event in the database in the form -MM-DD and wish to SELECT From the database WHERE date = todays date. Is this possible or do I need to INSERT todays date into the database first. -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Dates in MYSQL
Tried the following as suggested - Still no dates showing $query = ' SELECT id, eventheading, DATE_FORMAT(eventdate, %D %M %Y)as evdt FROM notices WHERE TO_DAYS(eventdate) = TO_DAYS(now()) order by eventdate'; $result=mysql_db_query($dbname, $query, $link); if (!$result) { echo( mysql_error()); } else while ($row = mysql_fetch_array($result)) $entername = $row[entername]; $eventdate = $row[evdt]; $eventheading = $row[eventheading]; $id = $row[id]; Database table notices as follows id int NULL autoincrement entername text NOT NULL enterdate text NOT NULL eventdate text NOT NULL eventheading text NOT NULL eventbody text NOT NULL -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. Dl Neil [EMAIL PROTECTED] wrote in message 0b8401c1e62e$03072ad0$0600a8c0@jrbrown">news:0b8401c1e62e$03072ad0$0600a8c0@jrbrown... Hi Alex, Got my select statement to work as follows: $query = ' SELECT * FROM notices WHERE TO_DAYS(eventdate) = TO_DAYS(now()) order by eventdate'; =well done! However the TO-DAYS calls do seem a bit OTT. Please post the schema for tbl:notices - specifically the datatype for eventdate. Now trying to get the date more user friendly and tried: $query = ' SELECT id, eventheading, DATE_FORMAT(eventdate, %D %M %Y)FROM notices WHERE TO_DAYS(eventdate) = TO_DAYS(now()) order by eventdate'; ... When I echo ($eventdate) I get nothing. Not even an error. The problem is that $eventdate = $row[eventdate]; (which doesn't need the around the whole of the RHS (some would put them around eventdate), BTW) doesn't tie up with: DATE_FORMAT(eventdate, %D %M %Y) Recommend you change them to: DATE_FORMAT(eventdate, %D %M %Y) AS evdt and $eventdate = $row[evdt]; See how the SQL and PHP tie together? Now you need to reconsider the other $row[] assignments. =Keep it coming! =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Dates in MYSQL
Mike, I have just tried it again (that was the first way I tried to do the query) and get the error Unknown column '$todaysdate' in 'where clause' -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. Mike [EMAIL PROTECTED] wrote in message 001b01c1e658$6f483c00$[EMAIL PROTECTED]">news:001b01c1e658$6f483c00$[EMAIL PROTECTED]... Alex, enterdate text NOT NULL eventdate text NOT NULL First, I think I would change the above to a date or datetime or one of the other date time fields used by mysql instead of text fields. Second I don't think you really need to use TO DAYS and now. This is what I do. use php date function to get the current date, $todaysdate = date(Ymd); then do the query, $query = SELECT id, eventheading, DATE_FORMAT(eventdate, %D %M %Y) as evdt FROM notices WHERE eventdate = $todaysdate ORDER BY eventdate; Mike - Original Message - From: Alex Francis [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, April 17, 2002 5:26 PM Subject: Re: [PHP-DB] Dates in MYSQL Tried the following as suggested - Still no dates showing $query = ' SELECT id, eventheading, DATE_FORMAT(eventdate, %D %M %Y)as evdt FROM notices WHERE TO_DAYS(eventdate) = TO_DAYS(now()) order by eventdate'; $result=mysql_db_query($dbname, $query, $link); if (!$result) { echo( mysql_error()); } else while ($row = mysql_fetch_array($result)) $entername = $row[entername]; $eventdate = $row[evdt]; $eventheading = $row[eventheading]; $id = $row[id]; Database table notices as follows id int NULL autoincrement entername text NOT NULL enterdate text NOT NULL eventdate text NOT NULL eventheading text NOT NULL eventbody text NOT NULL -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. Dl Neil [EMAIL PROTECTED] wrote in message 0b8401c1e62e$03072ad0$0600a8c0@jrbrown">news:0b8401c1e62e$03072ad0$0600a8c0@jrbrown... Hi Alex, Got my select statement to work as follows: $query = ' SELECT * FROM notices WHERE TO_DAYS(eventdate) = TO_DAYS(now()) order by eventdate'; =well done! However the TO-DAYS calls do seem a bit OTT. Please post the schema for tbl:notices - specifically the datatype for eventdate. Now trying to get the date more user friendly and tried: $query = ' SELECT id, eventheading, DATE_FORMAT(eventdate, %D %M %Y)FROM notices WHERE TO_DAYS(eventdate) = TO_DAYS(now()) order by eventdate'; ... When I echo ($eventdate) I get nothing. Not even an error. The problem is that $eventdate = $row[eventdate]; (which doesn't need the around the whole of the RHS (some would put them around eventdate), BTW) doesn't tie up with: DATE_FORMAT(eventdate, %D %M %Y) Recommend you change them to: DATE_FORMAT(eventdate, %D %M %Y) AS evdt and $eventdate = $row[evdt]; See how the SQL and PHP tie together? Now you need to reconsider the other $row[] assignments. =Keep it coming! =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.330 / Virus Database: 184 - Release Date: 2/28/02 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Arrays
I am trying to insert event dats into a database and to make sure the user puts the date in the correct format. I am now trying to collect the information from the three fields and insert it into one field. code as follows: $eventdate = array (eventyear, eventmonth, eventday); when I insert it into the database like: $query = INSERT INTO $tablename4 VALUES ('0', '$entername', '$date', '$eventdate', '$eventheading', '$eventbody' ); for the $eventdate variable the word array is inserted. Could someone please tell me where I am going wrong. -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Arrays
Got it now, Thank you -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. Steve Cayford [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Your $eventdate variable is an array, not a string so you can't just drop it into an sql query string like that. If you have separate fields in the db for year, month and day then you probably want something like: $query = insert into ... values ( ... , '$eventdate[0]', '$eventdate[1]', '$eventdate[2]', ...); Otherwise, if they're all supposed to go into the same field then do something like: $eventdatestring = join(-, $eventdate); $query = insert into ... values ( ..., '$eventdatestring', ...); This should insert the date in the form eventyear-eventmonth-eventday; -Steve On Monday, April 15, 2002, at 03:13 PM, Alex Francis wrote: I am trying to insert event dats into a database and to make sure the user puts the date in the correct format. I am now trying to collect the information from the three fields and insert it into one field. code as follows: $eventdate = array (eventyear, eventmonth, eventday); when I insert it into the database like: $query = INSERT INTO $tablename4 VALUES ('0', '$entername', '$date', '$eventdate', '$eventheading', '$eventbody' ); for the $eventdate variable the word array is inserted. Could someone please tell me where I am going wrong. -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Access to Mysql
I am a complete newbie at this so please excuse me if I seem stupid. I have a guestbook on one site which was created using ASP and an Access database. I have created a new site using the much more friendly PHP and wish to get the data into my mysql database. Can I do this easily, and if so can anyone point me to the required information -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Adding to an empty field
I have an empty field in a mysql database table which needs to have text inserted when my client answers an email. The code is as follows $query = 'UPDATE submissions SET answers = $array[answer] where id = $id '; // $query = $query . where id = $id ; // echo (The query is: BR$queryP\n); if (mysql_db_query ($dbname, $query, $link)){ echo (The answer was successfully inserted!BR\n); } else { echo (The answer could not be inserted! . mysql_error () . BR\n); } mysql_close ($link); The query seems to work alright, no errors showing up and The answer was successfully inserted! displayed. However, the table is not updated and I cannot see why. The same happens on another page when I try to insert a 'Y'. This script was copied from a third page which works alright. I hope someone can help. I am going mad!!!. -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. -- PHP Database 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-DB] Adding to an empty field
Still having problems $array[answer] is passed from a previous page with this page. p align=rightAnswer: TEXTAREA NAME=array[answer] ROWS=8 COLS=60/TEXTAREABR ? echo (TDA HREF=\submit_answer.php?id=$idtask=submit\Submit Answer/A/TD);?/TR Have tried changing to array[$answer] on both pages without any luck. Changed the code to: $query = UPDATE submissions SET answers = \.$array[$answer].\ where id = \$id\; and added the following: echo mysql_affected_rows(); affected rows returns 0 although query returns the correct id Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. Rick Emery [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... What is $array[answer]. Should that be $array[$answer] ? Second, change to: $query = 'UPDATE submissions SET answers = \.$array[$answer].\ where id = \$id\; Ya gotta quote that text. -Original Message- From: Alex Francis [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 31, 2002 8:07 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Adding to an empty field I have an empty field in a mysql database table which needs to have text inserted when my client answers an email. The code is as follows $query = 'UPDATE submissions SET answers = $array[answer] where id = $id '; // $query = $query . where id = $id ; // echo (The query is: BR$queryP\n); if (mysql_db_query ($dbname, $query, $link)){ echo (The answer was successfully inserted!BR\n); } else { echo (The answer could not be inserted! . mysql_error () . BR\n); } mysql_close ($link); The query seems to work alright, no errors showing up and The answer was successfully inserted! displayed. However, the table is not updated and I cannot see why. The same happens on another page when I try to insert a 'Y'. This script was copied from a third page which works alright. I hope someone can help. I am going mad!!!. -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 [EMAIL PROTECTED] http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. -- PHP Database 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 Database 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]