[PHP-DB] formatting a date from mysql
I need to figure out how to format the date format: year-month-day (2005-12-06). It is a date(8) field in a mysql table that i pulled out of the table with php 5.0.5. I need it in the format: Tue December 6, 2005 (or in mysql's formatting: 6-12-2005). I am using the reformatting for display only. So it would be something like this: echo $journal['Date']; //with whatever formatting needed If possible I need php to do the formatting for me. Thanks... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] getting rows by an ID field or by another field in a table
I have a table with the fields: CREATE TABLE `journal` ( `Date` date NOT NULL, `subject` varchar(100) NOT NULL, `entry` longtext NOT NULL ) TYPE=MyISAM COMMENT='Journal table'; I was wondering if I should get the rows out by an ID field of some kind or maybe do a select on the subject? what would be the real best way? I am trying to get the date/subject to list on a webpage in a table and then when someone clicks on the subject (it will be a link), it will take them to a popup window (target=_blank) and then display the whole entry date/subject/entry. whats the best practice for that sort of thing? thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] test email
just a test email -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Current web page being displayed
Ron Piggott wrote: What is the correct $_SERVER that tells me what page is currently being displayed? Ron http://www.php.net/reserved.variables Never used it, but I'm going to guess script_filename or script_name ? HTH, Roger -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Question on Registration Method
> I'm getting an error using the > "mysql_num_rows($result)" > Warning: mysql_num_rows(): supplied argument is not a > valid MySQL result resource in > /home/lurkkcom/public_html/lurktivate.php on line 7 Did you happen to remember to change "fields" in the query string to your table column names, and then "table" to your table name? > Why am I counting the number of rows in the table? > Shouldn't I be looking to see if the code I was passed > exists within the table ? If a result is returned, i.e. the number of rows returned is greater than 0, the page received a valid code and the user exists. -JC -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] $_SERVER['HTTP_REFERRER']
For some reason I cannot get this to work. I'm trying to use the referrer to redirect at the end of a form processing script, but it wont recognize the referrer. I read that it just wont work with some browsers, isps, and/or security settings. If this is the case, does anyone know a work around? Thanks in advance! Jeff -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] FW: db design - which is better
> There just seems to be times when non-normalized table structures are easier > to work with. There are times when de-normalizing is acceptable. One of the more common uses of denormalized data is in data warehousing. Such as pre-summing sales, and storing pre-calculated aggregate information to relieve the db of doing heavy or complex calculations when summary data is going to be queried on a frequent basis. Often php-based message boards will use columns of pre-sumed data as part of a "normal" table (for example, a count of total user posts stored in the user table, that is incremented/decremented when a user adds/deletes a post, or the total number posts in a given thread stored in the topic table). This helps to allieviate the need for a count() whenever a message thread is built and you want to show the number of posts each user in the thread has, etc. So there are some acceptable situations :) Cheers, Keith. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] .DOC to PDF on line
Hi: My name is Sergio Barreira, i want to know if there are any method (in PHP) for to convert any .DOC to PDF on line and show it. Thank You! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] how obtain last id past insert?
Hi: How i obtain inmediatly the id of last insert ? For example i have a forum, when the user post a question, i send a mail to administrator, but i want to refer the id from this insert, how i do this ? Well i think to make a select max(id) inmediatly but i beliebe that must have any colision from other user that post other question. Thank you. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Error connecting with Mysql
Hi: I understand that this list is about PHP but, may be, any webmaster can help me. Linux Suse 8.2. I was installed apache, php and mysql, all working fine. from prompt i write mysql and run correctly, i create the database, tables and grant permisions to users. all right. but, when i run the php source have the follow error: Warning: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /usr/local/apache2/htdocs/foros/forodecla/index.php on line 4 i write rcmysql status and say running. What is hapenning ? Thank You.
[PHP-DB] PLEASE HELP !!!!!!!
PLEASE HELP !!! HOW I CAN GET CONNETCTION TO REMOTE HOST IN OTHER SERVER WITH mysql_connect(); e.g. my php file is in www.abc.com/index.php mysql server is localhost on cgi.xyz.com can i do something like this mysql_connect("http://cgi.xyz.com:localhost:3306";, username, password); PLEASE ANSWER to [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PLEASE HELP mysql_connect()!!!
PLEASE HELP !!! HOW I CAN GET CONNETCTION TO REMOTE HOST IN OTHER SERVER WITH mysql_connect(); e.g. my php file is in www.abc.com/index.php mysql server is in cgi.xyz.com on localhost PLEASE ANSWER to [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] currency formating
Yea i have read that but did not think it was what i needed considering it is for an automated billing system and the customer may not like it if they are charged and extra .50 cents or so every month. Their has got to me another alternative. "Shooter" <[EMAIL PROTECTED]> wrote in message 002f01c19242$6d2f5580$3701a8c0@lan">news:002f01c19242$6d2f5580$3701a8c0@lan... U could use round. if u looked @ the php.net website. & searched you would of found it. heres the url http://www.php.net/manual/en/function.round.php an example is below. basically. its round($number,$deciminal_places); EXAMPLE $foo = round(1.95583, 2); // $foo == 1.96 Shooter Webmaster <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have the following > > $number=47.7 > > I need this to be = 47.70 > > it must include the 2 didgets after the . how can i accomplish this > > > > > -- > 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]
[PHP-DB] currency formating
I have the following $number=47.7 I need this to be = 47.70 it must include the 2 didgets after the . how can i accomplish this -- 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-DB] Top 5 list of the visited pages [PHP-DB]
I need a script that produces a top 5 list of the visited pages at my website.. $result = mysql_query(" SELECT artikel, count(*) from artikel_vist group by artikel ORDER BY artikel DESC LIMIT 5 ", $link); $num_rows = mysql_num_rows($result); while ($raekke = mysql_fetch_array($result)) { extract($raekke); $nr = $nr+1; echo "$nr. Artikel: $artikel antal: $num_rows "; } Tabelname: artikel_vist Column: 1) nr 2) artikel 3) ip 4) time Kind regards Christian http://www.venstre-odense.dk/
[PHP-DB] PHP redirect?
I have a form and based off of this form if my user selects option a then I want them to be redirected to another page. If they select option B then I want to continue with my php scrips as it does now. Does any one have any ideas on how I can accomplish this? -- 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-DB] Cookies
How can I request a persistant cookie from the clients computer (to make a autologin) this doesnt work :echo $HTTP_COOKIE_VARS["nameCookie"] code to set cookie: setcookie("newsLogin",$value,time()+ 3348000); if i ask from the same page I get the values I need but not from a different page... thx
RE: [PHP-DB] Sending the user their forgotten password via emal??
What I've done is I set up an INPUT box on the site, where you type in your e-mail address. Upon hitting submit, I query the database looking for the persons e-mail address. If it's there, I send it to them, if not I inform them that they aren't in the database. This is the code I use for http://www.sohh.com/wireless Hope this helps. if ($email) { $db = "vb114"; include("../application_db_connect.php"); $query_checkemail = "SELECT user.* FROM user WHERE user.email = '$email'"; $result_checkemail = mysql_query($query_checkemail); if (!$result_checkemail) { echo("Error performing query: " . mysql_error()); exit; } $recordcount_checkemail = mysql_num_rows($result_checkemail); if ($recordcount_checkemail) { while($row_checkemail = mysql_fetch_array($result_checkemail)) { $username = $row_checkemail["username"]; $password = $row_checkemail["password"]; $mail_to = trim($email); $mail_headers = "From: [EMAIL PROTECTED]\r\nReply-to: [EMAIL PROTECTED]"; $mail_subject = "Your login details for SOHH.com:"; $mail_body .= "Username = $username\n"; $mail_body .= "Password = $password\n\n"; $mail_body .= "Don't forget that they are case sensitive!\n\n"; $mail_body .= "To sign up to SOHH Wireless, go to:\n"; $mail_body .= "http://www.upoc.com/sohh/\n\n";; $mail_body .= "Yours,\n\n"; $mail_body .= "SOHH.com Team\n\n"; mail($mail_to, $mail_subject, $mail_body, $mail_headers); $message = "Your e-mail address, $email, is already in our database. This means you are already a member of SOHH.com and can join SOHH Wireless.You're ready to sign up for SOHH Wireless!For future reference, we have sent your username and password to $email."; } } else { $message = "Your e-mail address, $email, is not in our database. This means you are not a member of SOHH.com. You should join now!"; } } else { $message = "You didn't enter your e-mail address!"; } -Original Message- From: DC [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 26, 2001 12:04 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Sending the user their forgotten password via emal?? Hi all I would like to offer my users the chance to have their username and password sent to them via the email address stored. As i see it i have two issues (1) how do i do the verify email thing where the script send a click here to confirm email address on registration application (2) how do i then send their details (username / password) to the confirmed stored email address. I have looked around but cqnt find the answer. 5 books on the shelf give no clue either Any help is most apreciated Thanks in Advance Dave C -- 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]
[PHP-DB] Insert Variables Into A Passed String
Hey, I'm trying to figure out how to make a custom message. What I have is a form with a TEXTAREA named MAILFROM. I want to be able to write an e-mail in that section like so: Dear $username. When I press submit, I want the query to cycle through a list of names (got this part) and where it finds the variables in the text, replaces them with the proper content. Like: Dear steven How can I do something like this? Thanks. Steven -Original Message- From: B. van Ouwerkerk [mailto:[EMAIL PROTECTED]] Sent: Monday, April 23, 2001 10:26 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] can't connect to mysql At 06:45 19-4-01 -0500, johndmiller wrote: >I just looked at my mysql.sock file and it has a length of zero. Is this >the right size, I don't think it is. If not, do I have to reinstall MySQL >to get the file back or can I get it from somewhere else. Length of zero.. thats perfectly normal. Bye, B. -- 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]
[PHP-DB] Insert Variables Into A Passed String
Hey, I'm trying to figure out how to make a custom message. What I have is a form with a TEXTAREA named MAILFROM. I want to be able to write an e-mail in that section like so: Dear $username. When I press submit, I want the query to cycle through a list of names (got this part) and where it finds the variables in the text, replaces them with the proper content. Like: Dear steven How can I do something like this? Thanks. Steven -Original Message- From: B. van Ouwerkerk [mailto:[EMAIL PROTECTED]] Sent: Monday, April 23, 2001 10:26 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] can't connect to mysql At 06:45 19-4-01 -0500, johndmiller wrote: >I just looked at my mysql.sock file and it has a length of zero. Is this >the right size, I don't think it is. If not, do I have to reinstall MySQL >to get the file back or can I get it from somewhere else. Length of zero.. thats perfectly normal. Bye, B. -- 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]
RE: [PHP-DB] Help Me Fix My User Defined Funtion
Ok, fair enough. Basically the top had all my MySQL calls and then it's followed by - However, since posting my question, I have solved it by doing the following: Which works but what if I wanted to use the results to do something else? Like take the string ($link) and count the lenght of it (just an example). Steven -Original Message- From: Mark Roedel [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 19, 2001 11:21 AM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Help Me Fix My User Defined Funtion > -Original Message- > From: SOHH.com Webmaster [mailto:[EMAIL PROTECTED]] > Sent: Thursday, April 19, 2001 3:32 PM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] Help Me Fix My User Defined Funtion > > > I created a funciton to pass two variables and create a > dynamic link. It doesn't give me an error, but it doesn't > give me the results either. What am I missing in my > function? (It's down below) The function itself looks fine to me...is it possible there's a problem in the way you're calling it? (How 'bout a code snippet showing that as well...) --- Mark Roedel ([EMAIL PROTECTED]) || "There cannot be a crisis next week. Systems Programmer / WebMaster || My schedule is already full." LeTourneau University ||-- Henry Kissinger -- 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-DB] Help Me Fix My User Defined Funtion
I created a funciton to pass two variables and create a dynamic link. It doesn't give me an error, but it doesn't give me the results either. What am I missing in my function? (It's down below) Steven Samuel function generatesectionlink($sectionID,$contentID) { if ($sectionID == 4) { $link = "http://www.sohh.com/thewire/read.php?contentID=$contentID"; } else if ($sectionID == 3) { $link = "http://www.sohh.com/react/read.php?contentID=$contentID"; } else if ($sectionID == 2) { $link = "http://www.sohh.com/sohhlive/read.php?contentID=$contentID"; } else { $link = "http://www.sohh.com/thecore/read.php?contentID=$contentID"; } return ($link); } -- 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] Web based adminisration
I've written a Content Publishing Tool for my site. http://www.sohh.com Steven -Original Message- From: Mike [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 18, 2001 1:48 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Web based adminisration Are there any other web based administration tools for mysql written in php besides phpMyAdmin?Links? Mike P [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] -- 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] Re: Help please
> I assume that the username field is text. You need to add single quotes > around the field. > > $validate = mysql_query("SELECT username, user_password FROM users > WHERE username='".$uname."'",$db); > Actually, it did help, and it didn't ;p It would seem there is a scoping issue with the $db parameter. its giving a not valid SQL-link because it no longer sees the db connection. It has to do with the way the page calls itself I think... though it isn't very clear to me. If I include the connect code for the db in the else block it connects fine, and the simple select I have in the code sample works. But I don't wanna have the db connect code in there if possible...I want the connect code in one file only, and included on the header for the page...oh well :) If I figure out what is happening I will post it to this list. Thanks for helping, Keith. > OR simply: > > $validate = mysql_query("SELECT username, user_password FROM users > WHERE username='$uname'",$db); > > Hope this helps. > > Dan > > -- > 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]
[PHP-DB] Help please
Hi all, I have a website that I am trying to develop a "add news" page for. Basically people who have the authority to add news for the site can type in their username, password, the title of the article, and the article itself and submit it to the site (which then verifies the username and password and if successfull adds it to the DB so the news will appear the next time somone browses to the website. This file is an included file into the main page...the $db variable is valid, and works with all the other pages so far... I am really stumped and getting frustrated. I apologise in advance if I am including too much code in my examplethe place with the error is a couple lines from the bottom of the code sample. My problem is that I am getting an error when i try to submit the form, code sample is below. The error is: Warning: Supplied argument is not a valid MySQL-Link resource in /usr/www/kyid/public_html/addnews.php on line 42 "; if(!$submit){ echo "\n"; echo " \n"; echo "\n"; echo "\n"; echo "* UserName\n"; echo "\n"; echo "\n"; echo "\n"; echo "* Password\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "* Headline\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "* Story\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n\n"; echo "\n"; echo "\n"; echo "\n"; }else{ /* More stuff would go in here, but this isn't working. */ / THE LINE BELOW THIS IS THE ERROR LINE / $validate = mysql_query("SELECT username, user_password FROM users WHERE username=".$uname,$db); } echo ""; Thanks in advance for any help, or please let me know if this should be on php-general instead... Again, thanks Keith Young. -- 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-DB] PHP 4.04 install binary Win32 and MSQL 7.0
I've installed and correctly configured (I suppose) the binary version of PHP 4.04 on a Win NT server with Microsoft IIS. I'm using CGI version of IIS. when I try to connect my script with Microsoft SQL 7.0 DB I get this error "Fatal error: Call to undefined function: sybase_pconnect() in ./db/sybase.php on line 17" This means that the binary version of PHP doesn't support SQL 7.0?? Must I compile the source code of PHP? Thanks a lot Luca
RES: [PHP-DB] Autonomous Mass Mail List System (Broadcast Email)
jeez, dump it all in a database. than learn a couple of lines of php. majordomo is perl... other discussion list. good luck # -Mensagem original- # De: Jason Beebe [mailto:[EMAIL PROTECTED]] # Enviada em: Wednesday, January 10, 2001 10:49 PM # Para: [EMAIL PROTECTED]; [EMAIL PROTECTED] # Assunto: [PHP-DB] Autonomous Mass Mail List System (Broadcast Email) # # # Hey Everyone, # # I'm working a project for one of the company's websites. they # have a subscription mailing list that the user signs up their # email address to receies periodical emailings. # # The email addresses are stored in a flat txt file. 1 email per # line. I could also convert it to a coma delimited txt file if it # would be easier. # # So, they've had problem with people who no longer want to receive # emails, and one's that bounce for whatever reason, generally a # bad email address. # # What I am trying to find out if who has some information to set # up a system where we will send out our emails to the subscribers # with our mailing list manager. when i customer respondes with a # certain command in the body or subject (like unsubscribe) or if # the mail bounces, I'd like it to search out the email address and # delete it. # # Now, I know there's lists like majordomo that do something # similar. But I'm looking for something a little more straightforward. # # I also know this may be more along the lines of shell scripting, # but I thought some of you ingenious people may have already done # something similar or have some ideas on where to start. thanks. # -- 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]