Jump to content

gewthen

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

gewthen's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ask the post above illustrated, you cannot include arrays in double quotes and have it resolve to its proper value.
  2. You will have to allow external mysql connection to the database you want to connect to. The configuration can only be done with root access. If you do not have it there is no other way. Ask your system adminstrator. If you use shared hosting you will need to ask your hosting company. It is likely that with shared hosting you will not be able to connect for security reasons.
  3. Look at:[url=http://us3.php.net/manual/en/function.highlight-file.php] http://us3.php.net/manual/en/function.highlight-file.php[/url].
  4. The http referer is supplied by the browser, not the server. Because php is server side you can do nothing about it. Javascript will work (not reliably though) because it is run in the client side which supplies the referer field in the request.
  5. See: [url=http://us3.php.net/manual/en/features.file-upload.php]http://us3.php.net/manual/en/features.file-upload.php[/url]. Explains all you will need to know.
  6. [quote author=hostfreak link=topic=100381.msg396110#msg396110 date=1152761016] I was wondering if it is possible to insert data from a form into my database and have the data be sent via email at that same time? I have no trouble doing either on there own, but combining the two is where I'm lost. [/quote] Yes, it possible to insert data into a database and email what it inserted within the same script. You might have an SQL statement: [code] <?php $sql="INSERT INTO         myTable         (id, name, address, city, state, zip)       VALUES(null, '".$name."', '".$address."',         '".$city."', '".$state."', '".$zip."' )"; mysql_query($sql); ?> [/code] All you need is to send the mail (assuming your PHP has mailing enabled). [code] <?php $to      = 'nobody@example.com'; $subject = 'the subject'; $message = "$name $address $city $state $zip"; $headers = 'From: webmaster@example.com' . "\r\n" .   'Reply-To: webmaster@example.com' . "\r\n" .   'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?> [/code] [size=8pt]The above was taken and then edited from [url=http://us3.php.net/manual/en/function.mail.php]php.net[/url][/size]. The above should insert the data into the database and send the values to you.
  7. You would need to carry the search term in the query string (the string after the ? in the url) across all the pages that need it or store the value in a session variable if you do not want the query term displayed in the url. Putting term into the $_POST is not possible unless you insert the term as a hidden field in a form and have the next and previous buttons form submissions. It just seems sloppy to have a form for the next and previous functionality and I recomend against it (if my recomendation means anything).
  8. Might I suggest that you try to focus on one problem at a time, and try to determine where the code it is failing. I don't mean to be harsh, but putting all the code on the forum is not very effective. One piece of advice, use single quite for pure html, as you will not have to escape the double quote in your markup at all.
  9. [quote author=hvle link=topic=100364.msg396091#msg396091 date=1152757637] OOP is wonderfull and best method of programming.  If everything in your site is OO and having a nice design structure, you're ahead of everyone else. [/quote] I thought I would point out that there is no best way of programing. OOP is just one way. There are several different ways of programing anything: functional, declarative, sequential, procedural, and object oriented. All have their strengths. OOP provides the structure for those begining to program as well as any group programers who do not already know each other's style of programing. Once you feel you got a good handle of OOP, move on to other styles. Try not to get stuck on one particular style, for when you can combine them all together you can really do much much more.
  10. [quote author=Eiolon link=topic=100379.msg396083#msg396083 date=1152756631] I hope this is the appropriate forum for this: 1. Should I start with PHP4 or 5?  I know this question seems strange but I didn't know if PHP5 was new and not fully developed or not.  I notice lots of people still using PHP4. [/quote] You should learn PHP5. It is much better for object oriented programing. Object oriented programing is easier to learn for many people that procedural programing, which PHP4 is better for than PHP5. If you plan on to use your scripts or system on a live website you will find it difficult to find hosting companies supporting PHP5 (for whatever reason this seems due to the slow adoption of some control pannels supporting PHP5). If you are learning PHP purely for the sake of learning it, then you would be a fool not to learn PHP5. If you do any serious programing in PHP4 you will have to know PHP5 well so that your scripts do not break when (and not if) PHP4 becomes obsolete.
  11. [quote author=lnthai2002 link=topic=99477.msg396088#msg396088 date=1152757340] With class definition, i HAVE to do the same thing except that i HAVE to instantiate the class which has been included before i can  use it! [/quote] Not true. I assume that you are used to putting one class per file in the java style. You can do the same thing with php, but it require you use the [url=http://www.php.net/manual/en/language.oop5.autoload.php]autoloader [/url]functionality. The autoloading allows you forget to include class files explictly. Once the class is included you do not have to instantiate the class to use it. You can call static methods on it. Example: [code] class DataSack{   public static function max($num1, $num2){       if($num1<$num2) return $num2;       return $num1;   } } [/code] Now with the autoloader you can do: [code] echo DataSack->max(10, 12); [/code] For example sake, it'll produce: [code] 12 [/code] I hope this addressing your problem of not being able to use a class without instantiating the class. I assumed you are working with PHP 5. If you are stuck with PHP 4, I suggest forgetting about using object and use procedural programing.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.