Jump to content

samporras

Members
  • Content Count

    156
  • Joined

  • Last visited

Everything posted by samporras

  1. Thaks Bruce...that definitely helps! Sam
  2. Hi guys. This is a pretty simple question. I'm relatively new to php, and I'm trying to use the php mysql_connect() function to connect to a database I created, but I don't know what to put in for the servername and user. for the server, I wasn't sure if I need put in my domain name, server name (that's indicated in cpanel), or just localhost. I'm assuming that for the username I just put in any of the users I created using the MySQL Database wizard. Thanks in advance. Sam
  3. you are absolutely right. my logic was wrong. i guess that's what i get for writing code at 2am your suggestion has fixed my issue. thank you very much for your help! Sam
  4. Thanks for the help OBJ. I didn't know that in PHP the start is 0 so i've updated my for statement. I didn't post the entire piece of code. The reason I was looping through 10 times is because i wanted to do something from 0 to rowcownt, and then do something else from rowcount to 10. The problem i'm having is when executing the following statement: >echo 'filename: '.$properties[$i]['filename'].'<br />'; The result i get is just when i remove $i from the index reference, the correct value shows up for the filename variable. (ie. $properties[1]['filename'])
  5. Hi guys. I'm still relatively new to php programming and I'm having some problems with some functionality that i am currently writing. I want to capture all the data from my database table and put it in a 2 dimensional array. I found this function online that seems to do the trick: >function mysql_fetch_data($result, $numass=MYSQL_BOTH) { $i=0; $keys=array_keys(mysql_fetch_array($result, $numass)); mysql_data_seek($result, 0); while ($row = mysql_fetch_array($result, $numass)) { foreach ($keys as $speckey) { $got[$i][$speckey]=$row[$speckey]; } $i++; } return $got; } the problem i am having is that i want to reference each element within the master array dynamically: > $result = mysql_query($select, $conn) or die(mysql_error()); $rowcount = mysql_num_rows($result); $properties = mysql_fetch_data($result); for($i=1; $i<10; $i++) { if($rowcount <= $i) { echo('filename: '.$properties[$i]['filename'].'<br />'); } else { //do something else } } why is it that i can not reference that specific index position dynamically? when i replace my variable ($i) with a specific value, the correct value for my field 'filename' is appearing. am i missing something or doing something incorrectly?? any help would be greatly appreciated! Thanks in advance, Sam
  6. I "cooked" for myself and my wife last night. (by "cook" I mean I heated up a frozen tomato, pesto and broccoli pizza. I also heated up a delicious frozen mushroom risotto) What can I say, I'm the world's greatest chef!!
  7. Some great information here!! thanks TheCanadian
  8. Thanks OJB. I ended up installing Apache. When I have time, I will go back and look through the original configuration of php (compare the two php.ini files) and see what the issue was. For now I have a solid working local environment. One question with the XAMPP install. Is there any way to configure apache to use something other than port 80 or 1443? I played around with the configuration file, but had no luck. Thanks again for all your help. Sam
  9. Thanks OJB. I will update my code to use a $_POST array. I think there is something wrong with the configuration of php on my local machine. The code works fine on the TCH servers. I attempted to use the print_r() function that you provided and it appears to be completely ignoring that statement as well as some other simple php code that I know should work (for example: <? echo date("Y"); ?> ) I used the following instructions to install and configure PHP on IIS7 http://learn.iis.net/page.aspx/246/using-f...ions-on-iis-70/ Any suggestions or changes that I need to make to my php.ini file??
  10. Hi guys. I haven't worked too much with PHP and am coming up on an error that I can't fix. I just installed and configured PHP on my pc running windows vista sp1 (IIS7). I've got FastCGI installed and configured and php sites show up perfectly. However, a page on a site that i'm hosting here at TCH is not working locally on my machine (it works on TCH's server ). I get the following error message: below is the code that the error is referencing and I can not see what I am doing wrong: >//declare variables and assign values $firstName = $_REQUEST["userFirstName"]; $lastName = $_REQUEST["userLastName"]; $email = $_REQUEST["email"]; $areaCode = $_REQUEST["areaCode"]; $phonePrefix = $_REQUEST["phonePrefix"]; $phoneSufix = $_REQUEST["phoneSufix"]; $comments = $_REQUEST["comments"]; $errorMessage = ''; The only thing that I can think of is that I am running PHP version 5.2.8 and my site on TCH is running 5.2.5. I don't think this attributes to what is going on but could it be possible? I've also already checked to make sure that the variables referenced are using the same case within my html code. Thanks in advance for your help! Sam
  11. Thanks for the help bruce. I'm thinking it might be something on their network because he can not view from any computer within his office. He is able to access the site from his home and other locations (not in his office). I'm not really familiar with proxy services. Can you explain (or send me a link) on how that would work? In the meantime I will get the IP address of the office and open up a ticket. Thanks again Sam
  12. Hi guys. I remember reading a thread a little over a year ago that talked about some people experiencing issues with certain ISPs. I'm not sure if the ISP was blocking communication on certain ports or if they were blocking an entire website. I tried searching for it, but could not find it. I have user that is not able to access a site i created for him from his office (tried multiple computers within...able to access from other locations). I asked if they were running any firewall software and he informed me they were not. They just have a standard router and all the computers connect from there. Now I haven't seen this myself, so he could be wrong, but I was just trying to think of all possibilities. His ISP is AT&T. Does anyone know the thread i'm talking about or have any ideas?? Any help would be great. Thanks, Sam
  13. I love looking at Don's picture from this post. I think that it really captures his personality and reminds me to keep a positive outlook on life. Don was a great man and I just wanted to say thanks again for all his help throughout the years! I'm sure he's smiling down at us from up there. We miss ya Don!
  14. I forgot to respond back to this post. I think you guys were right. I had no problem signing in to cpanel once I got home. Guess i'm in for some late nights...
  15. Thanks Bruce. I wanted try this channel first and make sure I wasn't doing anything wrong on my end. Sam
  16. Is there a way to alter this code to swap out one domain name for another? Basically what happened was that one of my clients let the domain expire and purchased a new one. I want to reference this new domain to point to the location where the existing files exist. - Sam
  17. good morning. i'm trying to access cpanel and keep getting a "page cannot be displayed error". i tried http://****/cpanel and http://****:2082 getting the same result on both. am i doing something wrong? i haven't had a problem accessing before. thanks in advance. Sam
  18. I attempted to do this and it didn't work. After looking at the expression a little bit more, i noticed I had an extra space after the '-' so it looked like this: Was the extra space the reason it was interpreted as defining a range? The code seems to be functioning properly now after removing the space. Thanks again! I was stuck for hours!!
  19. one more question... I found the below function to validate an email address. >function CheckEmail($email_field) { if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9- ]+)*(\.[a-z]{2,3})", $email)) { return TRUE; } else return FALSE; } Whenever the code is hit, i get the following error: i tried escaping the quotation marks thinking it might be it, but i get a parse error when hitting that code.
  20. thanks click. worked like a charm! Sam
  21. Hey guys. I'm delving a little more into php and am creating a web form. While trying to create some simple validation, i came across the preg_match() function and am getting an error while implementing it. below are the 2 function i created: > function CheckName($name) { if(!preg_match("/[^a-zA-Z0-9\.\-\Ä\ä\Ö\ö\Ü\ü\]+$/s",$name)) return TRUE; else return FALSE; } function CheckPhone($areaCode, $phonePrefix, $phoneSufix, $phone) { if(!preg_match("/[^0-9\-\]+$/",$phone)) return TRUE; elseif(strlen($areaCode) == 3) return TRUE; elseif(strlen($phonePrefix) == 3) return TRUE; elseif(strlen($phoneSuffix) == 4) return TRUE; else return FALSE; } i'm getting the following errors respectively when executing the code: any help would be greatly appreciated Sam
  22. Thanks Bruce. i thought i took care of that when i set up my $headers variable (line 4 of the below code). Is there a preferred way to declare a "from" email address? >//populate email headers $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $headers .= 'From: <xxx@xxxxx.com>' . "\r\n";
  23. Thanks Don I'm not 100% sure i follow what you're saying. What would i want to output when redirecting from one page to the other?
  24. I figured out what was going on. I was using a type="button" input instead of a type="submit". The page was not posting which would explain why the variables i created were never populated. This leads me to another question. Does anyone know of a function that exists in php to redirect from one page to another? I was not able to find this in any of the books i own. I would like to call this function and redirect to another page after the mail() function has been executed. Thanks. Sam
×
×
  • Create New...