[PHP] mailing forms and input into MySQL
Hi all, I have a current php script that allows me to add/remove customer information from a particular MySQL Database. What I would like to do, is when an employee adds a customer, have some (if not all) of that information e-mailed to a particular e-mail address. I've created scripts that e-mail info, and ones that just enter info into a database, but have not attempted combining them. Anyone have any ideas, or is anyone doing this? If so, could you give me a quick how-to or point me in the direction of some online documentation? Thanks, Scott Miller
[PHP] One form - two db's?
Is it feasible to have a php form update two different MySQL DB's at the same time, with all info going to one DB, and just certain info going to the second? Just dreaming of ways to make my life easier. Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Ticket Master-type script
I'm looking for some sort of script/software that will allow website viewers to purchase seats at events. Mainly I'm donating space and a site to the local Fair committe, building the site to sell reserved seating tickets at the local rodeo. Any help as to where I can start looking would be greatly appriciated. Thanks, Scott Miller -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Simple Selection Box
I"m attempting to create a simple selection box in PHP, but to no avail. It keeps giving me an error: You have an error in your SQL syntax near '; City='Eureka/'' at line 6 Here's a snip from my code: Add New User New user added'); } else { echo('Error adding new user: ' . mysql_error() . ''); } ?> Add another User Return to Users list Enter the new User: First Name: Last Name: UserName: Password: Phone: City: Eureka Rexford Trego Fortine Other City I've read and read - searched through other's posts, but haven't come up with what I'm doing wrong. If anyone could give me a hand, I would greatly appriciate it. Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple Selection Box
AAHH - stupid mistake - thanks! Guess I better re-read PHP-101 Thanks, Scott - Original Message - From: "Jay Blanchard" <[EMAIL PROTECTED]> To: "Scott Miller" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, September 08, 2003 1:54 PM Subject: RE: [PHP] Simple Selection Box > [snip] > You have an error in your SQL syntax near '; City='Eureka/'' at line 6 > > $sql = "INSERT INTO My_Table_Name SET > First_Name='$fname', > Last_Name='$lname', > Username='$username', > Password='$password', > Phone_Number='$phone'; > City='$city'"; > [/snip] > > You left out a comma > > Phone_Number='$phone'; > should be > Phone_Number='$phone', -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question about fopen()
Hi, Does fopen() work similar to open in CGI ? If the file doesn't exist will it create it? What is the best way to test if the file was created? TIA Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Confused overSimple PHP mySQL date question
Hi, I have checked the recent list archives and looked up various PHP functions. I know what I want should be simple but, apparently not simple enought for me. I have a mysql database that has a date field and a time field. I want users to be able to enter a date and a time in text boxes on an html form and have them end up in the database. I am having no trouble connecting to the database and running queries against the database but I cannot get the dates and times into the database. Of course I also want to search for the database for an entered date on another form. I am not having trouble with SQL statements or mysql_connect() or anything like that just taking a date as a string from a text box and getting into a DATE field in a mysql database. What obvuios thing did I miss? Note I am not using the system date or time stamp, these are entered dates. Regards, Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Read Last Lines of a Text File
I have a text file (log file) that I want to be able to read the last 30 or 40 lines of. I've created the code below, but since this file is so large (currently 8 MB) it won't work. The code works on smaller files, but not this one. Can someone look at this below and tell me where I went wrong? Thanks, Scott Miller -- Outgoing mail is certified Virus Free. Checked by AVG Anti-Virus (http://www.grisoft.com). Version: 7.0.251 / Virus Database: 263.3.2 - Release Date: 6/15/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Read Last Lines of a Text File
> * Thus wrote Scott Miller ([EMAIL PROTECTED]): > > I have a text file (log file) that I want to be able to read the last 30 or > > 40 lines of. I've created the code below, but since this file is so large > > (currently 8 MB) it won't work. The code works on smaller files, but not > > this one. Can someone look at this below and tell me where I went wrong? > > > > ... > > > > $fcontents = file($filename); > > This will make your script consume lots of memory, and is very > inefficient. > > You'd be better of using the unix tail command: > > $fp = popen("/usr/bin/tail -$limit $file", 'r'); > if (! $fp ) { > echo 'unable to pipe command'; > } > while (!feof($fp) ) { > $line = fgets($fp); > print $line; > } > > Of course if you're simply going to output the results a simple: > > system("/usr/bin/tail -$limit $file"); > > Would do the job nicely. > > > Curt > -- > First, let me assure you that this is not one of those shady pyramid schemes > you've been hearing about. No, sir. Our model is the trapezoid! > > -- I've changed my script to the following: And now get the following errors: Warning: Wrong parameter count for fgets() in /var/www/html/logs2.php on line 10 I get this over and over and over (like it's producing the error once per line in the log file). Thanks, Scott -- Outgoing mail is certified Virus Free. Checked by AVG Anti-Virus (http://www.grisoft.com). Version: 7.0.251 / Virus Database: 263.3.2 - Release Date: 6/15/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Read Last Lines of a Text File
- Original Message - From: "Oliver Hankeln" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, June 17, 2004 9:13 AM Subject: Re: [PHP] Read Last Lines of a Text File > Scott Miller wrote: > > >>* Thus wrote Scott Miller ([EMAIL PROTECTED]): > >> > >>>I have a text file (log file) that I want to be able to read the last 30 > > > > or > > > >>>40 lines of. I've created the code below, but since this file is so > > > > large > > > >>>(currently 8 MB) it won't work. The code works on smaller files, but > > > > not > > > >>>this one. Can someone look at this below and tell me where I went > > > > wrong? > > > >>>... > >>> > >>>$fcontents = file($filename); > >> > >>This will make your script consume lots of memory, and is very > >>inefficient. > >> > >>You'd be better of using the unix tail command: > >> > >>$fp = popen("/usr/bin/tail -$limit $file", 'r'); > >>if (! $fp ) { > >> echo 'unable to pipe command'; > >>} > >>while (!feof($fp) ) { > >> $line = fgets($fp); > >> print $line; > >>} > >> > >>Of course if you're simply going to output the results a simple: > >> > >> system("/usr/bin/tail -$limit $file"); > >> > >>Would do the job nicely. > >> > >> > >>Curt > >>-- > >>First, let me assure you that this is not one of those shady pyramid > > > > schemes > > > >>you've been hearing about. No, sir. Our model is the trapezoid! > >> > >>-- > > > > > > I've changed my script to the following: > > > > > > > $file ="/var/log/radius.log"; > > > > $fp = popen("/usr/bin/tail -$limit $file", 'r'); > > if (! $fp ) { > > echo 'unable to pipe command'; > > } > > while (!feof($fp) ) { > > $line = fgets($fp); > > print $line; > > } > > ?> > > > > And now get the following errors: > > > > Warning: Wrong parameter count for fgets() in /var/www/html/logs2.php on > > line 10 > > > > I get this over and over and over (like it's producing the error once per > > line in the log file). > > prior to PHP 4.2 you had to use a second parameter for fgets. This > parameter is the maximum length per line to read. > $line = fget($fp,4096); > will probably work. > > HTH, > Oliver Changed that line as shown above, and now get the following error: Fatal error: Call to undefined function: fget() in /var/www/html/logs2.php on line 11 Thanks, Scott -- Outgoing mail is certified Virus Free. Checked by AVG Anti-Virus (http://www.grisoft.com). Version: 7.0.251 / Virus Database: 263.3.2 - Release Date: 6/15/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Read Last Lines of a Text File
- Original Message - From: "Oliver Hankeln" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, June 17, 2004 9:29 AM Subject: Re: [PHP] Read Last Lines of a Text File > Scott Miller wrote: > > >>>I've changed my script to the following: > >>> > >>> >>> > >>>$file ="/var/log/radius.log"; > >>> > >>>$fp = popen("/usr/bin/tail -$limit $file", 'r'); > >>>if (! $fp ) { > >>> echo 'unable to pipe command'; > >>>} > >>>while (!feof($fp) ) { > >>> $line = fgets($fp); > >>> print $line; > >>>} > >>>?> > >>> > >>>And now get the following errors: > >>> > >>>Warning: Wrong parameter count for fgets() in /var/www/html/logs2.php on > >>>line 10 > >>> > >>>I get this over and over and over (like it's producing the error once > > > > per > > > >>>line in the log file). > >> > >>prior to PHP 4.2 you had to use a second parameter for fgets. This > >>parameter is the maximum length per line to read. > >>$line = fget($fp,4096); > >>will probably work. > >> > >>HTH, > >>Oliver > > > > > > Changed that line as shown above, and now get the following error: > > > > Fatal error: Call to undefined function: fget() in /var/www/html/logs2.php > > on line 11 > > Sorry. I mean fgets ... > That worked perfectly - now I at least get this: ==> standard input <== ==> /var/log/radius.log <== Thu Jun 17 09:21:01 2004: Auth: Login OK: [flasht999] (from nas Cisco AS5300/S0) socket 0 (0 sec) Thu Jun 17 09:22:22 2004: Auth: Login OK: [crbm] (from nas Cisco AS5300/S0) socket 0 (0 sec) Thu Jun 17 09:22:23 2004: Auth: Login OK: [tleec] (from nas Cisco AS5300/S0) socket 0 (0 sec) Thu Jun 17 09:23:19 2004: Auth: Login OK: [ziegen] (from nas Cisco AS5300/S0) socket 0 (0 sec) Thu Jun 17 09:23:24 2004: Auth: Login OK: [ziegen] (from nas 10.1.4.21/S0) socket 0 (0 sec) Thu Jun 17 09:23:42 2004: Auth: Login OK: [indiantrails] (from nas Cisco AS5300/S0) socket 0 (0 sec) Thu Jun 17 09:24:38 2004: Auth: Login OK: [kdglover] (from nas Cisco AS5300/S0) socket 0 (0 sec) Thu Jun 17 09:25:39 2004: Auth: Login OK: [altron] (from nas Cisco AS5300/S0) socket 0 (0 sec) Thu Jun 17 09:26:06 2004: Auth: Login OK: [altron] (from nas 10.1.4.21/S0) socket 0 (0 sec) Thu Jun 17 09:26:37 2004: Auth: Login OK: [nc3] (from nas 10.1.4.21/S0) socket 0 (0 sec) Now, how can I force a \n; to make it look like this: ==> standard input <== ==> /var/log/radius.log <== Thu Jun 17 09:21:01 2004: Auth: Login OK: [flasht999] (from nas Cisco AS5300/S0) socket 0 (0 sec) Thu Jun 17 09:22:22 2004: Auth: Login OK: [crbm] (from nas Cisco AS5300/S0) socket 0 (0 sec) Thu Jun 17 09:22:23 2004: Auth: Login OK: [tleec] (from nas Cisco AS5300/S0) socket 0 (0 sec) Thu Jun 17 09:23:19 2004: Auth: Login OK: [ziegen] (from nas Cisco AS5300/S0) socket 0 (0 sec) Thu Jun 17 09:23:24 2004: Auth: Login OK: [ziegen] (from nas xx.xx.xx.xx/S0) socket 0 (0 sec) Thu Jun 17 09:23:42 2004: Auth: Login OK: [indiantrails] (from nas Cisco AS5300/S0) socket 0 (0 sec) Thu Jun 17 09:24:38 2004: Auth: Login OK: [kdglover] (from nas Cisco AS5300/S0) socket 0 (0 sec) Thu Jun 17 09:25:39 2004: Auth: Login OK: [altron] (from nas Cisco AS5300/S0) socket 0 (0 sec) Thu Jun 17 09:26:06 2004: Auth: Login OK: [altron] (from nas xx.xx.xx.xx/S0) socket 0 (0 sec) Thu Jun 17 09:26:37 2004: Auth: Login OK: [nc3] (from nas xx.xx.xx.xx/S0) socket 0 (0 sec) Thanks, Scott -- Outgoing mail is certified Virus Free. Checked by AVG Anti-Virus (http://www.grisoft.com). Version: 7.0.251 / Virus Database: 263.3.2 - Release Date: 6/15/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Read Last Lines of a Text File
- Original Message - From: "Oliver Hankeln" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, June 17, 2004 10:01 AM Subject: Re: [PHP] Read Last Lines of a Text File > Scott Miller wrote: > > > - Original Message - > > From: "Oliver Hankeln" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Thursday, June 17, 2004 9:29 AM > > Subject: Re: [PHP] Read Last Lines of a Text File > > > > > > > >>Scott Miller wrote: > >> > >> > >>>>>I've changed my script to the following: > >>>>> > >>>>> >>>>> > >>>>>$file ="/var/log/radius.log"; > >>>>> > >>>>>$fp = popen("/usr/bin/tail -$limit $file", 'r'); > >>>>>if (! $fp ) { > >>>>> echo 'unable to pipe command'; > >>>>>} > >>>>>while (!feof($fp) ) { > >>>>> $line = fgets($fp); > >>>>> print $line; > >>>>>} > >>>>>?> > >>>>> > >>>>>And now get the following errors: > >>>>> > >>>>>Warning: Wrong parameter count for fgets() in /var/www/html/logs2.php > > > > on > > > >>>>>line 10 > >>>>> > >>>>>I get this over and over and over (like it's producing the error once > >>> > >>>per > >>> > >>> > >>>>>line in the log file). > >>>> > >>>>prior to PHP 4.2 you had to use a second parameter for fgets. This > >>>>parameter is the maximum length per line to read. > >>>>$line = fget($fp,4096); > >>>>will probably work. > >>>> > >>>>HTH, > >>>>Oliver > >>> > >>> > >>>Changed that line as shown above, and now get the following error: > >>> > >>>Fatal error: Call to undefined function: fget() in > > > > /var/www/html/logs2.php > > > >>>on line 11 > >> > >>Sorry. I mean fgets ... > >> > > > > That worked perfectly - now I at least get this: > > > [snip] > > Now, how can I force a \n; to make it look like this: > > Simply add one. print $line."\n"; should work. Or if your output is html > print $line.""; > > Oliver The following works perfectly: "; } ?> I've tried bumping up the 4096 to a higher number because it currently only shows me 10 lines - I'd like to see about 30. No matter what I change the number to, it still only shows 10 lines. What do I need to do to get more that the 10 lines? Thanks, Scott -- Outgoing mail is certified Virus Free. Checked by AVG Anti-Virus (http://www.grisoft.com). Version: 7.0.251 / Virus Database: 263.3.2 - Release Date: 6/15/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Read Last Lines of a Text File
> [snip] > > $file ="/var/log/radius.log"; > > > $fp = popen("/usr/bin/tail -$limit $file", 'r'); > if (! $fp ) { > echo 'unable to pipe command'; > } > while (!feof($fp) ) { >$line = fgets($fp, 4096); > print $line.""; > > > } > ?> > > I've tried bumping up the 4096 to a higher number because it currently > only > shows me 10 lines - I'd like to see about 30. No matter what I change > the > number to, it still only shows 10 lines. What do I need to do to get > more > that the 10 lines? > [/snip] > > I am jumping in late so I might have missed it. What is $limit set > too? is it set to 30? > I actually don't have limit set anywhere - I added: $limit="30"; directly under $file = ... and got exactly what I need. Thanks for all the help! Scott -- Outgoing mail is certified Virus Free. Checked by AVG Anti-Virus (http://www.grisoft.com). Version: 7.0.251 / Virus Database: 263.3.2 - Release Date: 6/15/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php