Re: [PHP] Displaying Results
You're part way there: SELECT COUNT(matches) FROM table GROUP BY matches; - Original Message - From: Jason Soza <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, April 16, 2002 5:49 PM Subject: [PHP] Displaying Results Suppose I want a script that goes into a table, looks up all records in a given field, and groups and displays the results like so: match1 (1) match2 (5) match3 (6) So basically it looked at the field 'matches' and found a total of 12 records, 1 record for match1, 5 records for match2, and 6 records for match3. It would also be handy for the output to be a link so when you clicked on it, it would pass a query on to the database querying for just that particular field, like: SELECT * FROM table WHERE match="match1" Can someone point me in the right direction for this? Or show me an example script that would accomplish this? Any help would be great. Thanks a lot! Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql quickie..
I've seen other responses to your request answer with some VERY UGLY methods to get the last id. Instead, use mysql_insert_id() which was created specifically for the info you need. - Original Message - From: Kelly Meeks <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, April 17, 2002 1:15 PM Subject: [PHP] mysql quickie.. Hi folks, I need to get the next auto_increment value of a mysql table thru php. Looking at my mysql manual, it makes reference to a last_insert_id() function? How would I use this via php, or is there some other way to do it? Thanks Kelly -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql quickie..
- Original Message - From: Robert Cummings <[EMAIL PROTECTED]> To: Richard Emery <[EMAIL PROTECTED]> Cc: Kelly Meeks <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, April 17, 2002 1:49 PM Subject: Re: [PHP] mysql quickie.. Richard Emery wrote: >> >> I've seen other responses to your request answer with some VERY UGLY methods >> to get the last id. > Hey my method wasn't ugly, perhaps not optimal, but definately not ugly! > So *ptht* ;) ROFL... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sorting an array.
Perhaps you could store $row in an array of arrays; store only $row within 100 miles. Add another field, Distance, to each row that holds the calculated distance. Then, after creating the array, sort the final array by Distance. - Original Message - From: Mike Mike <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, April 18, 2002 8:51 AM Subject: [PHP] Sorting an array. Hello, Here's what i'm working with. I'm figuring the distance between to points based on latitude and longitude. while ($row = mysql_fetch_array($result)) { file://calculate distance between the two cities. $Lat2 = $row["Latitude"]; $Lon2 = $row["Longitude"]; $x = 69.1 * ($Lat2 - $Lat1); $y = 53 * ($Lon2 - $Lon1); $Distance = sqrt($x * $x + $y * $y); $Distance = ceil($Distance); if ($Distance < 100){ echo $row["CompanyName"].""; echo $row["Address"].""; echo $row["City"].""; echo $row["State"].""; echo $row["ZipCode"].""; echo $row["PhoneNumber"].""; echo $row["FaxNumber"].""; echo "Approximant Distance = $Distance Miles"; } } Here is where my question comes to play. How do I sort the $Distance so that 4 Miles will come up first 10 second 30 third ext.. I have tried useing sort() function but it doesn't work quite the way I want it to. Thanks for your help --Mike __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: [PHP] If else question
OK...this has dragged on... Jennifer, show us your ACTUAL code, including database access statements. We can't help you if you expect us to read your mind... - Original Message - From: Jennifer Downey <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, April 23, 2002 12:17 PM Subject: Re: [PHP] If else question No this is the first if statement but there are nested if's after that. I'd post the code but everyone yells at me about my coding style. If you promise not to yell I will post it. Jennifer "-Bd-" <[EMAIL PROTECTED]> wrote in message 001d01c1eae9$d58f4360$[EMAIL PROTECTED]">news:001d01c1eae9$d58f4360$[EMAIL PROTECTED]... > Is this a nested if? (inside another if statement?) > > > > > - Original Message - > From: "Jennifer Downey" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, April 23, 2002 1:05 PM > Subject: Re: [PHP] If else question > > > > > > I just looked at my hosting service thinkg it may have been because they > > just upgraded to 4.1 php. so I dumped my database and loaded it to my > > machine at home and find that it does the same thing. > > > > I have 4.06 php on win me my hosting service is 4.1 php on redhat linux so > > I'm thinking that is not the case. > > > > I have used this code through out my site and this is the only part it > does > > this on and I am not understanding why. > > > > Jennifer > > > > > > > > > > "Natalie Leotta" <[EMAIL PROTECTED]> wrote in message > > 7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC4@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC4@SSIMSEXCHNG... > > > My officemate and I talked about this and the only thing he could come > up > > > with was a possible problem with your parser. Are you using a beta > > version > > > or something unusual? I don't know if you have a way to know this - the > > > programmers didn't set up PHP where I work, but I know our web server is > > > apache and it's on a unix box. I've never run into this problem before. > > > Have you had it happen in other programs? Have you ever used this code > in > > > another program? If it's consistently incorrect then it may be a > problem > > > with your parser. That's not really my area of expertise, but it's > > > something you could look into if no one else has any better ideas :-) > > > > > > -Natalie > > > > > > -Original Message- > > > From: Jennifer Downey [mailto:[EMAIL PROTECTED]] > > > Sent: Tuesday, April 23, 2002 12:26 PM > > > To: [EMAIL PROTECTED] > > > Subject: Re: [PHP] If else question > > > > > > > > > It shows both. > > > > > > "Natalie Leotta" <[EMAIL PROTECTED]> wrote in message > > > 7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC3@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024ABFC3@SSIMSEXCHNG... > > > > Does it show the message and the form or just the message? > > > > > > > > -Natalie > > > > > > > > -Original Message- > > > > From: Jennifer Downey [mailto:[EMAIL PROTECTED]] > > > > Sent: Tuesday, April 23, 2002 12:23 PM > > > > To: [EMAIL PROTECTED] > > > > Subject: Re: [PHP] If else question > > > > > > > > > > > > > > > > > If and else expect to be followed by exactly 1 statement. To > > > > > aggregate multiple statements as one, surround them with {curly > > > > > braces}. I'm guessing you didn't do that, and you're seeing the > > > > > execution of all but the first of the statements following the else. > > > > > > > > > > So it should be: > > > > > > > > > > if ($var<1) > > > > > echo "can't be found"; > > > > > else > > > > > { > > > > > echo "first line of form"; > > > > > echo "second line of form"; > > > > > } > > > > This is what I have: > > > > > > > > if($quantity < 1) > > > > { > > > > echo "Sorry I can't seem to locate this item"; > > > > } > > > > else > > > > { > > > > do this > > > > } > > > > So yes I have done exactly as you have stated and it still shows the > > > > form. > > > > > > > > Jennifer > > > > > > > > > > > > --- > > > > Outgoing mail is certified Virus Free. > > > > Checked by AVG anti-virus system (http://www.grisoft.com). > > > > Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 > > > > > > > > > > > > > > > > -- > > > > PHP General 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.351 / Virus Database: 197 - Release Date: 4/19/2002 > > > > > > > > > > > > -- > > > PHP General 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.351 / Virus Database: 197 - Release Date: 4/19/2002 > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > --- Outgoing mail is certified Virus Free. C
Re: [PHP] If else question
Now, we're getting somewhere!!! First, have you printed out $query to ensure it contains what you expected? Show us. Second, are you certain the mysql_query() is successful? I ask, because you don't have the "or die()" that SHOULD be on all queries. Third, have you printed out all the values fetched via mysql_fetch_array() to ensure they contain valid data? - Original Message - From: Jennifer Downey <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, April 23, 2002 12:48 PM Subject: Re: [PHP] If else question Ok you asked for it. Don't say I didn't warn you. session_start(); $query = "SELECT name FROM {$config["prefix"]}_users WHERE uid={$session["uid"]}"; $ret = mysql_query($query); while($row = mysql_fetch_array($ret)) { $user = $row['name']; $query = "SELECT uid, id, iname, image, quantity, type FROM {$config["prefix"]}_my_items WHERE uid={$session["uid"]} AND id = '$id' ORDER BY id"; $ret = mysql_query($query); while($row = mysql_fetch_array($ret)) { $uiid = $row['uid']; $iid = $row['id']; $image = $row['image']; $iname = $row['iname']; $quantity = $row['quantity']; $type = $row['type']; // this is the problem if statement. Please don't yell at me for my style. It is easy for me to read so I'm sorry if it's not for you. if($quantity < 1) { echo "Sorry I can't seem to locate this item"; } else { session_register("uiid"); session_register("iid"); session_register("image"); session_register("iname"); session_register("quantity"); session_register("type"); if($iid == $id) { $display_block .="$iname$quantity$type"; echo "$display_block"; if($type == "food") file://if the item food is present then set an option and include in the form later { $thisoption="Feed my pet\n"; } else { file://if book or weapon is present then set a blank $thisoption=""; } } } } } file://check if form has been submitted if($submit) { } else { file://if the form has not been submitted run the following echo ""; echo ""; echo "$thisoption"; echo "Put in my shop"; echo "Put into my Footlocker"; echo "Discard this item"; echo "Donate this item"; echo ""; echo ""; echo ""; } Jennifer --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Attachments
GOOGLE found this on first try http://www.zend.com/zend/spotlight/sendmimeemailpart1.php - Original Message - From: The_RadiX <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, April 24, 2002 7:22 AM Subject: [PHP] Attachments I have read briefly through past topics.. Just wanted to know: A) How do you use attachments in the: mail() function B) how using attachments would I compose an email to batch off using text/html as a optional item if the client supports it or use the default text/plain ?? Thx a heap ::: : Julien Bonastre [The-Spectrum.org CEO] : A.K.A. The_RadiX : [EMAIL PROTECTED] : ABN: 64 235 749 494 : QUT Student :: 04475739 ::: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upload
The PHP Manual has complete instructions for this. Did you look there yet? - Original Message - From: Gabriele Biondo <[EMAIL PROTECTED]> To: ML PHP <[EMAIL PROTECTED]> Sent: Wednesday, April 24, 2002 8:00 AM Subject: [PHP] Upload Hi, guys! Does anyone know how to write a php script to upload a file from my browser? Moreover; how could i avoid security errors? Thanx in advance Gabriele -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upload
I would try the chapter titled, "Handling file uploads" I'm sorry...I gotta ask...did you do any research on your own? Why did you not check the manual when I suggested it? - Original Message - From: Gabriele Biondo <[EMAIL PROTECTED]> To: Richard Emery <[EMAIL PROTECTED]> Sent: Wednesday, April 24, 2002 8:20 AM Subject: R: [PHP] Upload nope - to be honest, i didn't think to seek in the manual. Do you know where specifically? Thanks Gabriele -----Messaggio originale- Da: Richard Emery [mailto:[EMAIL PROTECTED]] Inviato: mercoledì 24 aprile 2002 14.11 A: [EMAIL PROTECTED]; ML PHP Oggetto: Re: [PHP] Upload The PHP Manual has complete instructions for this. Did you look there yet? - Original Message - From: Gabriele Biondo <[EMAIL PROTECTED]> To: ML PHP <[EMAIL PROTECTED]> Sent: Wednesday, April 24, 2002 8:00 AM Subject: [PHP] Upload Hi, guys! Does anyone know how to write a php script to upload a file from my browser? Moreover; how could i avoid security errors? Thanx in advance Gabriele -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail responders
You must have control over the Message Transfer Agent (MTA), such as SendMail. Or, if your host uses qmail MTA, you set it up using the dot-qmail files in your user directory. - Original Message - From: Dennis Gearon <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, April 26, 2002 12:05 PM Subject: Re: [PHP] Mail responders How is that done on the box? Miguel Cruz wrote: > > On Fri, 26 Apr 2002, Dennis Gearon wrote: > > All these lists that have addresses to subscribe, unsubscribe, etc, how > > do they work? Are they using a cron job to poll the mail inbox through > > sendmail? Does all mail not to a specific address at the site go to a > > 'catchall' address, which is then polled? > > Usually the mail is delivered directly to a program rather than to a > mailbox. The program receives the incoming message as input and handles it > as it pleases. > > miguel -- If You want to buy computer parts, see the reviews at: http://www.cnet.com/ **OR EVEN BETTER COMPILATIONS**!! http://sysopt.earthweb.com/userreviews/products/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Counter ?
This list is to answer questions for programming problems. Write the script yourself. If it fails, post the code and we'll be glad to help. sheesh - Original Message - From: CMS <[EMAIL PROTECTED]> To: PHP General <[EMAIL PROTECTED]> Sent: Friday, April 26, 2002 4:25 PM Subject: [PHP] Counter ? I am looking for a php counter, that can do this: ___ Total Visits: 8,585,230 Visits Today: 2,521 Today Date: Friday Jan 1, 2002 __ And the kicker, to have the ability to put this counter, on any page, to have it count that page sperate Thanks- Richard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirecting
Since you haven't posted your code, let me see if I can divine it... Nope...can't do it...my MindReader.exe vers 1.01 is on the blink. POST YOUR CODE - Original Message - From: Liam MacKenzie <[EMAIL PROTECTED]> To: PHP <[EMAIL PROTECTED]> Sent: Friday, April 26, 2002 10:46 PM Subject: [PHP] Redirecting Hey all, Just curious as to what the best way is to move someone off your site, apart from bringing up a picture of male pornography... Seriously, I've tried using header("Location: http://www.php.net/";); but it returns an error saying that the headers are already set. The situation I'm in is as follows: Need to send a user to http://www.examplesite.com/ from a PHP script in http://forums.examplesite.com/ Thanks for the help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date problem
First, the timestamp that is retrieved from mysql is NOT the same as is required for PHP. Second, do you REALLY wan the Day of the Week (Mon, Tue, Wed) or the date of the month (1,2,3,4,5,6,...)? Third, let Mysql do the conversion for you. For instance if you timestamp field is named "mydate": SELECT DATE_FORMAT(mydate,"%e %b %Y") AS thedate FROM mytable - Original Message - From: Nick Wilson <[EMAIL PROTECTED]> To: php-general <[EMAIL PROTECTED]> Sent: Sunday, April 28, 2002 7:48 AM Subject: [PHP] date problem -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all I have a field in MySQL db like this: date TIMESTAMP, and it looks pretty regular like this: 20020428011911 when I come to use php date("D M Y", $myTimeStamp) though I get TUE JAN 2038! I see something in the manual re this date but I'm afraid I still can't work it out so some advice/help would be greatly appreciated :-) - -- Nick Wilson // www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD4DBQE8y++SHpvrrTa6L5oRAh3xAJ9lfFdB1VW3KUHCWxnnksN+Uw950QCYpfg6 OCdApC0Nh/8hi8MYQY3OTQ== =FnlM -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] failed query results
If no customers are found, then: if (mysql_num_rows($result1)==0) { print "theres no such customer!"; } - Original Message - From: baldey_uk <[EMAIL PROTECTED]> To: Php-General <[EMAIL PROTECTED]> Sent: Sunday, April 28, 2002 7:48 AM Subject: [PHP] failed query results Hello all, i am trying to query a mysql database to see if a customer all ready exists in a database and if so then use there customer id to insert data into another table. Can anyone tell me what valuse mysql returns if the query returns no value? i have the following code: $customer_id_check=("SELECT id FROM $customer_table WHERE firstname = '$firstname' && lastname = '$lastname' && email = '$email'"); $result1=mysql_query($customer_id_check); if (!$result1) { print "theres no such customer!"; } which i thought should echo 'theres no such customer!' if a customer didnt exist who fitted the query, however it doesnt and if i echo $result1 i get 'Resource id #2 not what i was expecting (was more expecting something along the lines of NULL). Thanks for any help in advance!!! Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Changing field size
First, your question belongs on the mysql mailing list, not PHP Second, did you try it yourself before asking? I guess not. Third, the data would not be effected - Original Message - From: Anthony Rodriguez <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, April 28, 2002 8:09 AM Subject: [PHP] Changing field size I've a VARCHAR(4) field that I want to change to a VARCHAR(6) field. What would happen to the existing data in MySQL db? Thanks! Tony ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Removing empty elements from an array
unset() ??? - Original Message - From: Craig Westerman <[EMAIL PROTECTED]> To: php-general-list <[EMAIL PROTECTED]> Sent: Sunday, April 28, 2002 9:36 AM Subject: [PHP] Removing empty elements from an array I have an array that contains several empty elements. What is simplest way to remove these elements? Array ( [0] => [1] => [2] => [3] => 16/Mar/02 [4] => [5] => 17/Mar/02 [6] => 18/Mar/02 [7] => 19/Mar/02 [8] => 20/Mar/02 [9] => 21/Mar/02 [10] => 22/Mar/02 [11] => 23/Mar/02 [12] => [13] => 24/Mar/02 [14] => 25/Mar/02 [15] =>) Thanks Craig ><> [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Unable to Install PHP 4.2 into RH7.0/Apache 1.3
I am unable to install PHP 4.2 functionality into my RH 7.0/Apache 1.3 environment. I downloaded the 4.2 source. The INSTALL file provides 2 options: DSO and static. I was unable to create the DSO version because the file "apxs" is nowhere to be found on my system. I should mention that I installed the original Apache/PHP/mysql combination from the RH 7.0 RPM binaries. If I infer correctly, according to the PHP INSTALL file, it appears that I would need to create Apache from source in order to retrieve this "apxs" file. Is this true? FYI: per the instructions, my system does have the mod_so.c module. To create the static version of PHP to be run by Apache, it also appears I need to create Apache from scratch. I created PHP 4.2 with the following configuration statement ./configure --enable-discard-path --enable-safe-mode --enable-ftp --enable-m bstring --enable-overload --enable-shmop --enable-sockets --enable-sysvsem - -enable-sysvshm --with-mysql --with-readline --with-regex This created a stand-alone PHP binary which executes correctly from the command line (I first moved the binary PHP to /usr/sbin). However, when I execute PHP scripts from within Apache, it uses the older 4.0.1p12 version which came from the RPM. Question: where to from here? Must I install Apache from source to create the DSO or static version (I prefer DSO, because that's what I've been running)? Or, since I do not have the apxs file, is that something that somebody can send to me? Or am I SOL... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Last time Append line to text file
The answer is: $file_pointer = fopen('/public_html/emails.txt', "a") or exit; The " || " is a binary operation. You want "or", the logical operation. - Original Message - From: Rodrigo <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; 'Miguel Cruz' <[EMAIL PROTECTED]>; 'John Holmes' <[EMAIL PROTECTED]> Sent: Sunday, April 28, 2002 10:55 PM Subject: [PHP] Last time Append line to text file Ok, but I'm trying the following code wich is basicaly the same Miguel sent me and I still get the same message. Please excuseme for being so repetitive but Í don't seem to see where is the mistake, Sorry guys for the trouble. Warning: Supplied argument is not a valid File-Handle resource in /home/restricted/home/h4ck3r/public_html/write.php on line 4 Warning: Supplied argument is not a valid File-Handle resource in /home/restricted/home/h4ck3r/public_html/write.php on line 6 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php and XML
It's already been done many times. Go to Google and search for it. Also, try sourceforge and hotscripts save yourself the aggravation... - Original Message - From: Philip Yeo <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, April 29, 2002 7:14 AM Subject: [PHP] Php and XML Hi there, I would like to create an XML parser using Php. Any good references for doing this?? Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] return multiple value from function
- Original Message - From: sanjay <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, April 29, 2002 9:11 AM Subject: [PHP] return multiple value from function Hi List, I am new to php programming and wanted to know if it is possible to return multiple value from a function like cgi programs. How can I get the following result using php. ($var1, $var2) = myfunction($a,$b); function myfunction($c,$d) { // code // code return ($e,$f); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] build array dinamicaly
$query = "SELECT name,address FROM tbl"; $result = mysql_query($query); while($myarray[] = mysql_fetch_array($result); - Original Message - From: Rodrigo Peres <[EMAIL PROTECTED]> To: PHP <[EMAIL PROTECTED]> Sent: Monday, April 29, 2002 9:20 AM Subject: [PHP] build array dinamicaly Hi list, I want to buil an multidimensional array with the results of Mysql, but I don't know how to do it. What I need is: "SELECT name,adress from tbl_." array name will receive the names array adress will receive the adresses and array clientes will contain both, so when i try to access i will have something like $cliente['nome'][0] or $clientes['adress'][1] and so on. Someone can help??? Thank's in advace Rodrigo Peres -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: [PHP] create textfile if not existing?
Did you even try to develop this application? It's to easy. Do so. If you have problems, then post the code and we'll help you. - Original Message - From: Hawk <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, April 29, 2002 3:49 PM Subject: [PHP] create textfile if not existing? lets say I have 30 lines of text and I want to store it in a folder called "txt" with the filename $name.txt and, if $name.txt exists, create a $name1.txt or similiar? Håkan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Database Duplication
Every time a user logs in, you want to duplicate the database Must be a very small database...not one with several hundred-thousand records. It's a SQL question. You didn't specify what database you are using, so nobody can provide you with specifics. - Original Message - From: Liam Gibbs <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, April 29, 2002 3:21 PM Subject: [PHP] Database Duplication I'm not sure if this is possible in PHP (maybe it's even an SQL problem, I dunno), but is there a command that will duplicate a database? I need to make a 'mirror' of it that I can dispose of after my user logs out that won't change the source database at all. __ Do You Yahoo!? Yahoo! Health - your guide to health and wellness http://health.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Database Duplication
I'm going to guess you are using mysql. Before starting a test, dump your database with the mysqldump command. Edit this file to create/use your test database. Load your test database with this file. This is too obvious and too easy...therefore, I assume you already did this and it did not provide what you needed. What additional functionality are you seeking? - Original Message - From: Liam Gibbs <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, April 30, 2002 8:57 AM Subject: Re: [PHP] Database Duplication Maybe I should explain myself a little better. Sorry for leaving out what turned out to be crucial details. What is happening is I want to make a test user so that, whenever I log in with that user, I can muck up the database and not worry about what others will see or permanent changes. In the past, whenever I tested the site, I had to quickly reset any changes I'd done to the database, which sometimes involved an hour or more of work for hidden bugs that I ended up overlooking. The test user (whom only I know of) is needed to test the Web site (make sure things are being deleted as needed, etc.). What I envisioned is that, when I log in as 'testuser', the database will be duplicated and I'll use that. While I'm testing my site, mucking things up, screwing up the data, I don't have to worry about other users coming along and seeing these changes, because they'll be seeing the original, , unscrewed data (which is why I need to use a muckable, duplicate database), making changes, etc. This way, that hour of work I mentioned would be eliminated. When I log out, the database is useless because it's only really test data (with enough real-life data already populated in the database), and so it doesn't matter what changes users have done in the meantime. What I may do is just duplicate the database and have a permanent, screwable database to play with, because that seems like less of a load on the system. I just wanted to have up-to-date data in my screwable database. The above method looks like a lot of processor time, etc., so just making a permanent test data database may be the best option, so it doesn't have to keep recopying. I just thought I'd throw out the question and see if it was smaller than I thought it would be. __ Do You Yahoo!? Yahoo! Health - your guide to health and wellness http://health.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with array
show the form. - Original Message - From: Carlos Fernando Scheidecker Antunes <[EMAIL PROTECTED]> To: PHP-GENERAL <[EMAIL PROTECTED]> Sent: Tuesday, April 30, 2002 10:11 AM Subject: [PHP] Problem with array Hello All, I've got a form that creates checkboxes based on the number of rows on a table. The user has to check some of the boxes and then click submit. The boxes are named RG1, RG2, RG3, If there are 4 checkboxes and the user selects them all or selects the first, second and fourth, or the first third and fourth my code works. But if the user selects the second, third and fourth (He does not checks the first one) no information is recorded on my array. Here's the code that I have to search the $HTTP_POST_VARS and then fill a array variable called $RG. function SearchRGs() { global $HTTP_POST_VARS; global $RGs; // fills the array variable RGs with the values of checked checkboxes that start with the name RG# (where # goes from 1,2,3,). // returns the qty of checked RGs and size of the $RGs array. $index = count($HTTP_POST_VARS); $count = 0; for ($i=1; $i < $index; $i++) { if (isset($HTTP_POST_VARS["RG$i"])) { $RGs[] = $HTTP_POST_VARS["RG$i"]; $count++; } } return $count; } Can anyone help me with this? Why if I do not check the first checkbox on the form the array is not filled. Thank you, Carlos Fernando. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parse error
When constructing $Query, end each line with a period (.) not a comma(,). Same applies to $Query2. $Query = "INSERT into $TableName values('0', '$Guestbook[dateadd]'. '$Guestbook[name]', '$Guestbook[town]', '$Guestbook[email]'. '$Guestbook[website]','$Guestbook[favsong]', '$Guestbook[comments]')"; $Query2 = "INSERT into $TableName2 values('0', '$Guestbook[dateadd]'. '$Guestbook[name]', '$Guestbook[email]'); - Original Message - From: Jule <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, April 30, 2002 12:48 PM Subject: [PHP] parse error Hey guys, i'm writing this guestbook script for my site, and i'm getting a random parse error where i think everything is normal, it gives it on line 26 which is echo "Your entry will be posted!"; my script follows Jule --SCRIPT-- mailto:[EMAIL PROTECTED]\";>me and I will fix the problem."; } if (isset($Guestbook[mailinglist])) { if (mysql_db_query ($DBName, $Query2, $Link2)) { echo "Your e-mail address was sucessfully added to our mailinglist"; } else { echo "There was an error in during the posting, please contact mailto:[EMAIL PROTECTED]\";>me and I will fix the problem."; } } mysql_close ($Link); mysql_close ($Link2); ?> -- Jule Slootbeek [EMAIL PROTECTED] http://blindtheory.cjb.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: [PHP] date
When/If you read the PHP manual, you'll discover that the second parameter MUST be a timestamp; not a text string. - Original Message - From: Norman Zhang <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, May 02, 2002 2:17 PM Subject: [PHP] date Hi, I am doing a test with the date function, $mydate="2002-05-02" $tdate=date("d M Y", "$mydate"); echo "$tdate" I should expect 02 May 2002. But I get a strange result "31 Dec 1969". Why? How can I correct this? Regards, Norman -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] "What date/time was it 7 hours ago"?
If you are using mysql, you can perform the calculations in mysql during the SELECT, such as: SELECT date_field - INTERVAL 7 HOUR FROM my_table; - Original Message - On Monday, April 15, 2002, at 09:50 AM, Torkil Johnsen wrote: > "What date/time was it 7 hours ago"? > > I'm just trying to make a log using mysql/php > This log is kinda supposed to show the time, local to the user. > > So I store datetime on the format -MM-DD HH:MM:SS in a datetime > field. > Using the php date function to get the date. > > This will store the time that right then ON THE SERVER. > > Now, when fetching data from the mysql table, I want to display what the > time WAS, LOCALLY (where I'm at, not the server) when the log entry was > made. > > So. How do I make a function that takes in -MM-DD HH:MM:SS and > spits out > the -MM-DD HH:MM:SS minus... for instance, 7 hours? > > "What date/time was it 7 hours ago"? > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fw: [PHP-DB] Arrays
You are getting "array" because that's what $eventdate is. Now, WHAT do you REALLY want to insert? - Original Message - From: Alex Francis <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, April 15, 2002 3:13 PM Subject: [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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php