[PHP] PHP Search Engine?
Hello, I've picked up a book called the PHP Developer's Cookbook, specifically for the search engine that was featured in it. It required the use of PEAR's File/Find.php, which my host hasn't installed, ..and very likely will not. Is there another way of coming up with a search engine in PHP that doesn't require the use of subscription services? Laurie M. Landry http://www.lmlweb.com voicemail/fax: (604) 693-1120 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Search Engine?
I don't think my server even has PEAR installed, so even if I just put the script on my own directory, it still needs the PEAR.php - will I need to do that too? > -Original Message- > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] > Sent: Saturday, March 23, 2002 1:56 PM > To: lmlweb > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] PHP Search Engine? > > > So just put that file in your own directory and use it from > there. It is just a PHP script. > > On Sat, 23 Mar 2002, lmlweb wrote: > > > Hello, > > > > I've picked up a book called the PHP Developer's Cookbook, > > specifically for the search engine that was featured in it. It > > required the use of PEAR's File/Find.php, which my host hasn't > > installed, ..and very likely will not. > > > > Is there another way of coming up with a search engine in PHP that > > doesn't require the use of subscription services? > > > > Laurie M. Landry > > http://www.lmlweb.com > > voicemail/fax: (604) 693-1120 > > > > > > > > -- > > 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] PHP Search Engine?
My correction - there is a Pear, and it was just a matter of finding the location (/root/php-4.1.2/pear/File/Find.php) - so I tried to use the full path - owrked, but then the Find.php required the PEAR.php, which was one level. So what I've done so far is to put the Find.php in my directory, and then make the path to the PEAR.php in the Find.php. I don't know if this will work for the search application from the PHP Dev's Cookbook but so far it seem to be working this way. > -Original Message----- > From: lmlweb [mailto:[EMAIL PROTECTED]] > > I don't think my server even has PEAR installed, so even if I > just put the script on my own directory, it still needs the > PEAR.php - will I need to do that too? > > > -Original Message- > > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] > > Sent: Saturday, March 23, 2002 1:56 PM > > Subject: Re: [PHP] PHP Search Engine? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PEAR installation correct?
How do I know if my web hosting server installed PEAR correctly? I'm trying to create a Search Engine from the PHP Developer's Cookbook, and so far, here's what I know: PHP has the PEAR installed ('--with-pear' according phpinfo.php) And having telnetted into my server, was able to find the PEAR location at /usr/local/bin/, where it is simply called "pear". In the Find.php file, I set it so that it calls a require_once '/usr/local/bin/pear'; Originally it was pear.php, but it didn't find it, so I set it as shown above. Now, if I run the file, I get this message: #!/usr/local/bin/php -Cq Fatal error: Failed opening required 'PEAR.php' (include_path='') in /usr/local/bin/pear on line 45 How do I know if PEAR is installed correctly? (The web hosting hasn't installed Pear before until I requested it) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php form mail - what am I doing wrong?
I'm suffering eye fatique, and after reading the code for the maybe millionth of time, I still can't figure out what I'm doing wrong in this one. Ideally, you get to this registration form by clicking on a link in a previous page, so the registration form automatically enters in the event name. The registrant then fills in the information. When you click on submit, you should be getting the "thank you" screen, but instead, it's being redirected back to the previous page, the events listings page. I'm sure I'm missing something but I cant figure out what it is. The email form code is from Aitsh (as indicated) and is shown here: http://www.w3.org/TR/REC-html40/loose.dtd";> Register for an Event http://specialneedslaw.lmlweb.com/includes/breadcrumb.js"; type="text/javascript"> Home http://specialneedslaw.lmlweb.com/includes/today.inc";) ?> HomeAbout Us> About Us> Contact UsLegal Resources> Legal Cases> International Law> Need a Lawyer or Advocate?Health Resources> Health ResourcesSpecial Education> Special EducationEvents> Events Links> Links Registration Form 0) { ?> All fields marked with an asterisk (*) must be filled in before the events details can be submitted. Please make sure you've filled in all of the required fields below. *First Name: *Last Name: *Address: *City: *Province/State: - Select Province/State - Alberta British Columbia Manitoba New Brunswick Newfoundland Northwest Territories Nunavut Nova Scotia Ontario Prince Edward Island Quebec Saskatchewan Yukon - Alabama Alaska Arizona Arkansas California Colorado Connecticut Delaware Florida Georgia Hawaii Idaho Illinois Indiana Iowa Kansas Kentucky Louisiana Maine Maryland Massachusetts Michigan Minnesota Mississippi Missouri Montana Nebraska Nevada New Hampshire New Jersey New Mexico New York North Carolina North Dakota Ohio Oklahoma Oregon Pennsylvania Puerto Rico Rhode Island South Carolina South Dakota Tennessee Texas Utah Vermont Virginia Washington Washington D.C. West Virginia Wisconsin Wyoming Other *Phone: Email: ","$form[subject]","", "From: $form[contact_person] <$form[email]>\nReply-To: $form[contact_person] <$form[email]>\nContent-type: text/html\nX-Mailer: PHP/" . phpversion()); /* end of html formatted email set up */ } else { /* the real meat of the email form */ mail("$recipientname <$final_recipient>","$form
[PHP] Re: Has anyone looked at phpinfo today?
who the heck was that :) "James Arthur" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > > > Notice anything different? > > --jaa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can I use variable appended to the end of a link if I'm not using it for SQL query?
For example, on a page, I have this link: http://www.website.com/register.html?select=$title";>$title where $title is whatever the database spits up on a previous query. Now I want to be able to carry that $title onto the next page, which is a form mail for registering for the events, without having to use database. Basically I want to be able to set the form up so it says: To register for $title, please fill out the form: who: what: _ where: _ [submit] [reset] and when it's submitted the mail() function will have an subject heading that consits of "$title Registration" is that possible? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can I use variable appended to the end of a link if I'm not using it for SQL query?
Hi, I went ahead and tried it - it works beautifully, where the title does show up perfectly when you arrive at the form. I filled out the form both to test the actual email body and the resulting html page once you've filled out the form and submitted. The $title variable does not show up in either the email body nor in the resulting page (the thank you for filling out this form page). While I can make the resulting page very generic by not adding the $title anywhere there, but the email body must contain the $title variable. I'm thinking maybe I should be adding the hidden form field for the $title? Here's the mail code: mail("$recipientname <$final_recipient>","$form[subject]","$form[first_name] $form[last_name] ($form[email]) send the following message to $recipientname ($final_recipient) : \n\n $form[message]\n\n Name: $form[first_name] $form[last_name] \n Event: $event \n Address: $form[address] \n City/Province: $form[city], $form[province] \n Phone: $form[areacode] $form[part1]-$form[part2] \n Email: $form[email] \n Subject: $form[subject] \n", "From: $form[first_name] $form[last_name] <$form[email]>\nReply-To: $form[first_name] $form[last_name] <$form[email]>\nContent-type: text/plain\nX-Mailer: PHP/" . phpversion()); "Martin Towell" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > sure - do exactly as you described. > > just because a variable is appended to a url, doesn't mean it HAS to be used > in an SQL statement. It can be used for anything you like - even ignored... > :) > > > -Original Message- > From: lmlweb [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 02, 2002 2:56 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Can I use variable appended to the end of a link if I'm > not using it for SQL query? > > > For example, on a page, I have this link: > > http://www.website.com/register.html?select=$title";>$title > > where > > $title is whatever the database spits up on a previous query. Now I want to > be able to carry that $title onto the next page, which is a form mail for > registering for the events, without having to use database. Basically I want > to be able to set the form up so it says: > > To register for $title, please fill out the form: > who: > what: _ > where: _ > [submit] [reset] > > and when it's submitted the mail() function will have an subject heading > that consits of "$title Registration" > > is that possible? > > > > -- > 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] Can I use variable appended to the end of a link if I'm not using it for SQL query?
No, not quite there yet - I've done the following and it still doesnt' show up. Here's what I have in my hidden input: and modified the Mail form: $event = addslashes($event); // to escape any funky stuff mail("$recipientname <$final_recipient>","$form[subject]","$form[first_name] $form[last_name] ($form[email]) send the following message to $recipientname ($final_recipient) : \n\n $form[message]\n\n Name: $form[first_name] $form[last_name] \n Event: $form[event] \n Address: $form[address] \n City/Province: $form[city], $form[province] \n Phone: $form[areacode] $form[part1]-$form[part2] \n Email: $form[email] \n Subject: $form[subject] \n", "From: $form[first_name] $form[last_name] <$form[email]>\nReply-To: $form[first_name] $form[last_name] <$form[email]>\nContent-type: text/plain\nX-Mailer: PHP/" . phpversion()); "Martin Towell" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > yep - definately need that hidden field, just a simple line will do > (normally) > > > > you'll have to do "funky" stuff if there's quotes in the title or anything > that gets escaped, like "'", and "\", etc > > > -Original Message- > From: lmlweb [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 02, 2002 3:33 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Can I use variable appended to the end of a link if > I'm not using it for SQL query? > > > Hi, > > I went ahead and tried it - it works beautifully, where the title does show > up perfectly when you arrive at the form. > > I filled out the form both to test the actual email body and the resulting > html page once you've filled out the form and submitted. > > The $title variable does not show up in either the email body nor in the > resulting page (the thank you for filling out this form page). > > While I can make the resulting page very generic by not adding the $title > anywhere there, but the email body must contain the $title variable. I'm > thinking maybe I should be adding the hidden form field for the $title? > > Here's the mail code: > > mail("$recipientname <$final_recipient>","$form[subject]","$form[first_name] > $form[last_name] ($form[email]) send the following message to $recipientname > ($final_recipient) : \n\n $form[message]\n\n Name: $form[first_name] > $form[last_name] \n Event: $event \n Address: $form[address] \n > City/Province: $form[city], $form[province] \n Phone: $form[areacode] > $form[part1]-$form[part2] \n Email: $form[email] \n Subject: $form[subject] > \n", "From: $form[first_name] $form[last_name] <$form[email]>\nReply-To: > $form[first_name] $form[last_name] <$form[email]>\nContent-type: > text/plain\nX-Mailer: PHP/" . phpversion()); > > > > "Martin Towell" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > sure - do exactly as you described. > > > > just because a variable is appended to a url, doesn't mean it HAS to be > used > > in an SQL statement. It can be used for anything you like - even > ignored... > > :) > > > > > > -Original Message- > > From: lmlweb [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, April 02, 2002 2:56 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP] Can I use variable appended to the end of a link if I'm > > not using it for SQL query? > > > > > > For example, on a page, I have this link: > > > > http://www.website.com/register.html?select=$title";>$title > > > > where > > > > $title is whatever the database spits up on a previous query. Now I want > to > > be able to carry that $title onto the next page, which is a form mail for > > registering for the events, without having to use database. Basically I > want > > to be able to set the form up so it says: > > > > To register for $title, please fill out the form: > > who: > > what: _ > > where: _ > > [submit] [reset] > > > > and when it's submitted the mail() function will have an subject heading > > that consits of "$title Registration" > > > > is that possible? > > > > > > > > -- > > 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] Mail function acting a bit differently
I got an email someone submitted through my web form. I've been using this form for a while, and it had always worked. It still works, but something new has popped up. If someone writes, "I'm available to meet with you anytime. We'll talk about our project." It appears as: I\'m available to meet with you anytime. We\'ll talk about our project. The mail() function as shown: mail("$recipientname <$final_recipient>","$form[subject]","$form[first_name] $form[last_name] ($form[email]) send the following message to $recipientname ($final_recipient) : \n\n $form[message]\n\n Name: $form[first_name] $form[last_name] \n Email: $form[email] \n Subject: $form[subject] \n", "From: $form[first_name] $form[last_name] <$form[email]>\nReply-To: $form[first_name] $form[last_name] <$form[email]>\nContent-type: text/plain\nX-Mailer: PHP/" . phpversion()); Only a week or so ago, I've switched server machines from the one that had version 4.0.4pl1 (my old server) over to a new server that has version 4.1.2. The other differences I can see from these two is that the 4.1.2 version has magic_quotes_gpc on, where the other one didn't. How would I set this up so that the comments posted in my forms doesn't get addslashed? I tried adding the stripslashes, but what happened was I get an email with no data in it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail function acting a bit differently
Hosted web, so option to turn on or off is up to the hosting company, not me. stripslashes what? $form = stripslashes($form); mail(...); or $form[message] = stripslashes($form[message]); mail(...); "Martin Towell" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > stripslashes() should work - or set the magic quote thingy to off > > -----Original Message- > From: lmlweb [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, April 03, 2002 1:12 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Mail function acting a bit differently > > > I got an email someone submitted through my web form. I've been using this > form for a while, and it had always worked. It still works, but something > new has popped up. > > If someone writes, "I'm available to meet with you anytime. We'll talk about > our project." > > It appears as: I\'m available to meet with you anytime. We\'ll talk about > our project. > > The mail() function as shown: > mail("$recipientname <$final_recipient>","$form[subject]","$form[first_name] > $form[last_name] ($form[email]) send the following message to $recipientname > ($final_recipient) : \n\n $form[message]\n\n Name: $form[first_name] > $form[last_name] \n Email: $form[email] \n Subject: $form[subject] \n", > "From: $form[first_name] $form[last_name] <$form[email]>\nReply-To: > $form[first_name] $form[last_name] <$form[email]>\nContent-type: > text/plain\nX-Mailer: PHP/" . phpversion()); > > Only a week or so ago, I've switched server machines from the one that had > version 4.0.4pl1 (my old server) over to a new server that has version > 4.1.2. > > The other differences I can see from these two is that the 4.1.2 version > has magic_quotes_gpc on, where the other one didn't. > > How would I set this up so that the comments posted in my forms doesn't get > addslashed? I tried adding the stripslashes, but what happened was I get an > email with no data in it. > > > > -- > 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 function acting a bit differently
I've answered myself, thanks all! It's definitely > $form[message] = stripslashes($form[message]); mail(...); "Lmlweb" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hosted web, so option to turn on or off is up to the hosting company, not > me. > > stripslashes what? > > $form = stripslashes($form); > mail(...); > or > $form[message] = stripslashes($form[message]); > mail(...); > > "Martin Towell" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > stripslashes() should work - or set the magic quote thingy to off > > > > -Original Message- > > From: lmlweb [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, April 03, 2002 1:12 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP] Mail function acting a bit differently > > > > > > I got an email someone submitted through my web form. I've been using this > > form for a while, and it had always worked. It still works, but something > > new has popped up. > > > > If someone writes, "I'm available to meet with you anytime. We'll talk > about > > our project." > > > > It appears as: I\'m available to meet with you anytime. We\'ll talk about > > our project. > > > > The mail() function as shown: > > mail("$recipientname > <$final_recipient>","$form[subject]","$form[first_name] > > $form[last_name] ($form[email]) send the following message to > $recipientname > > ($final_recipient) : \n\n $form[message]\n\n Name: $form[first_name] > > $form[last_name] \n Email: $form[email] \n Subject: $form[subject] \n", > > "From: $form[first_name] $form[last_name] <$form[email]>\nReply-To: > > $form[first_name] $form[last_name] <$form[email]>\nContent-type: > > text/plain\nX-Mailer: PHP/" . phpversion()); > > > > Only a week or so ago, I've switched server machines from the one that had > > version 4.0.4pl1 (my old server) over to a new server that has version > > 4.1.2. > > > > The other differences I can see from these two is that the 4.1.2 version > > has magic_quotes_gpc on, where the other one didn't. > > > > How would I set this up so that the comments posted in my forms doesn't > get > > addslashed? I tried adding the stripslashes, but what happened was I get > an > > email with no data in it. > > > > > > > > -- > > 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 function acting a bit differently
How can I do that - controlling via .htaccess? Pointing me to references would be good. TIA LML "Miguel Cruz" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Tue, 2 Apr 2002, lmlweb wrote: > > Hosted web, so option to turn on or off is up to the hosting company, not > > me. > > Perhaps you can control it from a .htaccess file? > > miguel > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail function acting a bit differently
Yes.. I found that there. My site doesn't allow .htaccess - now I'm off to find out why. "Jason Wong" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > On Wednesday 03 April 2002 12:06, lmlweb wrote: > > How can I do that - controlling via .htaccess? Pointing me to references > > would be good. > > The manual is a good reference. > > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > /* > Remember: Silly is a state of Mind, Stupid is a way of Life. > -- Dave Butler > */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] array limits in echo function?
I'm just curious: if I use within my html codes: , I get an error message telling me: Parse error: parse error, expecting `','' or `';'' However, if I take out one of the variables so that it reads it works. Has it always been this way? I never noticed before, as I'm quite the newbie. If so, how do I best combine the two (other than having to create two separate codes in the HTML)? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array limits in echo function?
Hi Miguel, I'm reading the manual as of this moment. Thank you for saying "RTFM" so very nicely! I guess I've used "$fname $lname" before, and just forgot at this point. Cheers, Laurie "Miguel Cruz" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Mon, 8 Apr 2002, lmlweb wrote: > > I'm just curious: > > > > if I use within my html codes: > > > > , I get an error message telling me: > > > > Parse error: parse error, expecting `','' or `';'' > > > > However, if I take out one of the variables so that it reads > $lname; ?> it works. > > > > Has it always been this way? I never noticed before, as I'm quite the > > newbie. If so, how do I best combine the two (other than having to create > > two separate codes in the HTML)? > > Syntax is not random. > > echo wants to be fed a comma-separated list of arguments. This is very > clearly described in the manual (http://php.net/echo) and should not be > difficult to figure out. > > So you can sent it a variable: > >echo $fname; > > Or you can send it a string: > >echo "Hello"; > > Or you can send it a string that contains some variables: > >echo "$fname $lname"; > > Or you can send it a bunch of variables and strings: > >echo $fname, ' ', $lname; > > The manual is your friend. > > miguel > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and PDF?????
I did a simple search at sourceforge.net, and got this link. Try this link instead: http://sourceforge.net/projects/pc4p/ "Jason Caldwell" <[EMAIL PROTECTED]> wrote in message 001701c1e1b9$784c7300$0202a8c0@cosmos">news:001701c1e1b9$784c7300$0202a8c0@cosmos... > Thanks for the response... I don't think the link you gave is working -- is > there another? > > Jason > > > - Original Message - > From: "Jason Wong" <[EMAIL PROTECTED]> > Newsgroups: php.general > To: <[EMAIL PROTECTED]> > Sent: Thursday, April 11, 2002 1:57 PM > Subject: Re: [PHP] PHP and PDF? > > > > On Friday 12 April 2002 03:44, Jason Caldwell wrote: > > > Does anyone have any *simple* examples of how I can go about taking a > text > > > file and converting it to a PDF using PHP's PDF functions? Looking at > the > > > documentation (http://www.php.net/manual/en/ref.pdf.php on php) on the > PDF > > > functions is a bit confusing... > > > > > > I just want to take a text file and convert it to a PDF file, just that > > > simple (I hope) :-) > > > > There's a nice class at http://pc4p.sourceforge.net which makes the PDF > > functions a lot easier to use. > > > > -- > > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > Open Source Software Systems Integrators > > * Web Design & Hosting * Internet & Intranet Applications Development * > > > > /* > > Man has never reconciled himself to the ten commandments. > > */ > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Understanding If conditional statements
I'm trying to get my code to print out a "sorry - no results" message if there is no match. I've read the If statement in the PHP manual (http://www.php.net/manual/ro/control-structures.php#control-structures.if) and I think my code structure may be wrong.. am I wrong to nest it this way in the following code? If so, where should I be putting the " if $sql returns 0 records, then print.." code? while ($row = mysql_fetch_array($sql_result)) { if ($sql_result = 0) { $option_block .= "Sorry, your search has resulted in 0 records. Please try again. \n"; } else { $advocateID = $row["advocateID"]; $esc_fname = $row["FNAME"]; $esc_lname = $row["LNAME"]; $esc_firm = $row["FIRM"]; $esc_city = $row["CITY"]; $esc_province = $row["PROVINCE"]; $esc_area = $row["AREA"]; // strips out special characters before output. $fname = stripslashes($esc_fname); $lname = stripslashes($esc_lname); $firm = stripslashes($esc_firm); $city = stripslashes($esc_city); $province = stripslashes($esc_province); $area = stripslashes($esc_area); $option_block .= "Name: $fname $lnameFirm/Organization: $firmLocation: $city, $provinceSpecialty: $area \n"; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Understanding If conditional statements
Hi, I've rewritten the code to: // Sends the Query $sql_result = mysql_query($sql); if (!$sql_result) { echo "Can't execute $sql " . mysql_error(); exit; } if (mysql_num_rows($sql_result) == 0) { $option_block .= "Sorry, your search has resulted in 0 records. Please try again. \n"; } // organizes data in an orderly manner (ie bulleted area) while ($row = mysql_fetch_array($sql_result)) { $advocateID = $row["advocateID"]; $esc_fname = $row["FNAME"]; $esc_lname = $row["LNAME"]; $esc_firm = $row["FIRM"]; $esc_city = $row["CITY"]; $esc_province = $row["PROVINCE"]; $esc_area = $row["AREA"]; and it works beautifully! Thanks for pointing me to the clue! "David Robley" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] > says... > > I'm trying to get my code to print out a "sorry - no results" message if > > there is no match. I've read the If statement in the PHP manual > > (http://www.php.net/manual/ro/control-structures.php#control-structures.if) > > > > and > > > > I think my code structure may be wrong.. am I wrong to nest it this way in > > the following code? If so, where should I be putting the " if $sql returns 0 > > records, then print.." code? > > > > while ($row = mysql_fetch_array($sql_result)) { > > if ($sql_result = 0) { > > $option_block .= "Sorry, your search has resulted in 0 records. Please try > > again. \n"; > > } > > else { > > Firstly, $sql_result insn't the value to check and secondly you should do > it before you start the while loop. > > Do your query to the DB, then check mysql_num_rows. If it is zero, print > the error message; otherwise go into the while loop to display your > results. > > -- > David Robley > Temporary Kiwi! > > Quod subigo farinam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php