Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. E_STRICT is an error reporting level. But it doesnt return errors in your code but PHP will suggest changes to be made to your code which will ensure the best interoperability and forward compatibility of your code. The thing about !@ is a form of lasy programming, apart form the ! symbol. The ! symbol is a comparison operater which means [b]not[/b] in PHP terms. For example you want to check a variable is not set you'll do this: [code]if(!$var) {     //set $var     $var = "something"; }[/code] Now when you run that code you are likely to get a php notice error which says var is not defined, meaning var is a non existent variable in your script. What (lazy) programmers tend to do is place an @ symbol in front of $var. The @ supresses the error message meaning no error is shown. But this is lazy! I tend to do the following: [code]if(!isset($var)) {     //set $var     $var = "something"; }[/code] isset does what the function is called all it does is check whether a variable is actually set. The allows me not to be tempted to use the @ symbol. Hope that helps.
  2. From the past when I used to browser the third party php scripts forum I never really saw a lot of posts about MVC's. If there was a lot of consistant threads on MVS then prehaps a new forum could be made dedicated to PHP MVC's. PHPFreaks has many forums already. If you need help with a PHP MVC then you shoud post in either the PHP Help or PHP Third Party Scripts forum as others have suggested.
  3. Wow what a pointless post! Or are getting an access denied message? If you are paste you code over at [a href=\"http://www.pastebin.com\" target=\"_blank\"]http://www.pastebin.com[/a] and post the link to the submitted code in your thread. Certain php funtions when you post your code sets of a security script which thinks you're attacking the forum.
  4. No, you dont include a whole website. inlcude or require is used to include extra source code into a certain file. Most programmers split up their code in to seperate files. For example for connecting to a mysql db, people will create a file called db.php wit hthe folllowing: [code]<?php $host = "localhost"; $user = "root"; $pass = "password"; $database = "db_name"; mysql_connect($host, $user, $pass) or die("Database connection faild"); mysql_select_db($database) or die("Database selection failed"); ?>[/code] Then when they need to connect to mysql they would use this: [code]<?php include "db.php"; // MySQL query stuff here ?>[/code] When you do that what PHP does is basically is copy 'n' paste the code from db.php to the file that is including the db.php. It just saves having to type up all the mysql connection stuff each time you want to connect to the database. Have a look at the examples [a href=\"http://uk.php.net/manual/en/function.include.php\" target=\"_blank\"]here[/a] from the fine manual.
  5. Switch statements can be inbeded in side each other: [code]switch($foo) {     clase 1:         switch($foobar)         {             case 1:         } }[/code]
  6. Don't rely on the Design View feature in Dreamweaver when developing in PHP. Dreamweaver doesn't understand what PHP is so it wont process your menu code, only the raw HTML. This is why DW screws up how a page looks in Design View. You should always check how your site looks in web browser. Don't test it in for example just IE. Test it in FireFox and Opera to see if your site design is compatiable with most modern browsers.
  7. wildteen88

    .htaccess?

    .htaccess is an external configuaration for the Aapche http server. You can tell Apache to say not allow users to view certain files in your direcotry view or if a file isn't found on the server it'll display a custom 404 error message etc.
  8. Its not /n but \n also when using \n make sure you use it inside double quotes ie: [code]echo "Hi\nBye";[/code]When you run that in a web browser it'll oinly display as HiBye however you'll notice that if you go to view -> source in the browser. Your newline is in fact there [code]Hi Bye[/code] If you want a newline character you have to use the, line break tag (<br />). This is becuase the browser ignores whispace charaters. But if you use the command line in Windows you'll need to do \r\n for a new line to be inserted otherwise windows wont put in new line character. Other OS like Linux require \n and Macs require \r I would recommend you to download a software package called WAMP. WAMP includes Apache (we server), PHP and MySQL. This enables you to test your PHP scripts localy on your PC. This save a lot time as you have to keep using your clients server to test you scripts.
  9. What are you planning to do? Make a website or a computer program. If its a website then to create a website you will need to know the following:[list][*]HTML[*]CSS[*]PHP and MySQL (if you want a dynamic site)[/list] If you want to make a computer program then the C lanagues will be what you want to learn. You can learn the basics of these lnaguges over at [a href=\"http://www.w3schools.com\" target=\"_blank\"]http://www.w3schools.com[/a]
  10. Is mysql installed on the same server as your hosting account? If it use [b]localhost[/b] (try this first). If a connection to mysql doesn't succeed use mysql.domain.com if so wish to. Howver localhost should be just fine.
  11. Do you just want to edit the way the day, month and year appears if so you can just do this: [code]$row['daterow'] = "2006-04-11 11:21:28"; date("d / m / Y", strtotime($row['daterow']));[/code] This will then reformat the mysql date
  12. Oh, sorry I missunderstood. My MySQL Query knowledge is little vague but I think something like thi should do it: [!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] a.CLINIC_ID, a.CLINIC_NAME, [color=blue]COUNT[/color](b.CLINIC_ID), b.DATE_TIME [color=green]FROM[/color] [color=orange]`CLINIC`[/color] a, `Clicks` b [color=green]WHERE[/color] a.CLINIC_ID [color=orange]=[/color] b.CLINIC_ID GROUP BY a.CLINIC_NAME [!--sql2--][/div][!--sql3--]
  13. The only to pass a variable to PHP with a link is by the url like so: [code]<a href="something.php?var=1">Send Var1</a> <a href="something.php?var=2">Send Var2</a>[/code]
  14. I think this should do it: [!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] a.*, b.* [color=green]FROM[/color] [color=orange]Clinc[/color] a, Clicks b [color=green]WHERE[/color] a.CLINIC_ID [color=orange]=[/color] b.CLINIC_ID [!--sql2--][/div][!--sql3--]
  15. change [code]$replace[] = ''';[/code] to [code]$replace[] = '\'';[/code] It was because you was not escaping your single quote and so PHP though you finished when you had typed the secound ' and when it came to the third ' it cuased the error. The middel ' needed to be escaped (\').
  16. Whats the problem?> Can you explains what is not working?. Is [i]<?php echo $_POST["age"]; ?>[/i] not outputting anything? If it isnt then try: [i]<?php echo $age; ?>[/i] as I think you server has register_globals turned on.
  17. You'll want to look into AJAX if you want to do that sort of thing. Have a look at [a href=\"http://www.ajaxfreaks.com/tutorials/1/0.php\" target=\"_blank\"]this[/a] tutorial and prehaps [a href=\"http://www.ajaxfreaks.com/tutorials/5/0.php\" target=\"_blank\"]this [/a] one too.
  18. No. If you have mysql installed on the server which your site is running off then you can use localhost as the server is located locally. PHP will fund where the database is automatically. However if your MySQL database is hosted of another server then you'll have to subsitiue localhost with the domain name to the remote server.
  19. Prehaps use fopen?
  20. Prefty straight forward. PHP is looking for a function called left in your script, but it can't find it. left is not a predifined function in PHP. By looks of it is being defined in your script somewhere.
  21. OMG! I ahav never seen such as list of questions this big before! Anyway I will try to awnser a few questiosn for you. [b]1. When working with php what is the quickest way to learn, I don't know if I will master all the tags, hopefully I will, but I understand the concept of if, while, and, looping, and other related statements, but not how to use those and principles to write out my own programs, I can't even validate forms myself, actually haven't even yet, I want to master these things, what are the best steps for me to do that, I have went through every tutorial online that could be found and www.php.net manuals. And this site. and the php and the faqs website as well, and no luck, I am learning slowly week by week, but I want to start a full fledged career soon, I will always study new things, but I need the basics.[/b] To get started with PHP look at online tutorial sites such as w3schools.com to get the real basics. Once you have learnt the basics at w3shools.com (make sure you run the examples too). Try to create something out of what you have learnt. You should be able to create someting even its someting that sounds dumb but its a start everyone starts somewhere. When I started PHP I first created a guestbook, however I learnt how to create one first by running through a turorial. I then created my very own guestbook from scratch from what I learnt from learning the Basics of PHP and creating the guestbook. If you get stuck search the manual over at www.php.net. Another way of learn PHP, which most people prefer to do is to download a premade script and play around with it. ALso dont just rely on online tutorials get out there into a libary / book store and have read through a good PHP book. Such as [b]PHP 5 for Dummies[/b] [b]4. When should I use database driven websites and when should they not be database driven should every website I do, have every single page database driven, or should I do the special tasks database driven, like login names, and log in related stuff, or stuff like big search functions, and guestbooks, and forums and things of that nature,. 5. Should forms be database driven themselves[/b] You should only need to create a database driven site when your site requires dynamic content, such as a guestbook will require a database to keep track of the entries vistors have made about a site. You shouldn't use a database to show a login form for example, unless you have all your templates stored in the database for truely dynamic site. Forms shouldn't be database driven no, however the data that is collected from the forms can be stored in database, a flat file database or to be used in general. [b]6. I know that I want to learn how to process forms with php, and how to validate them, but I have heard it's better to use javascript to validate, and php to process. Or asp whichever server side you are using, I heard it's best to use javascript to do the validating. is this true or should I do both with php.[/b] Yes I would say use javascript for form validation as javascript can permit a form being submitted if a required form field is not filled in or there is an error in one of the form fields. PHP on the other hand can do the same (accept permit a form from being submitted) but it can be slower. [b]7.After I master php, will it be very easy for me to do tasks when given, or build websites then using jsp, asp, cf, or am I going to have to learn all those languages as well, or is it the exact same thing just different sintax and once I get the right idea down, then the rest falls into place.[/b] There are lots of different web programming langauges out there. If you are to provide a service such as you creating websites for people don't overload yourself with lots of programmiung languages chose one langauge that you are compfortable with, one that is easy to use, cost efficent etc which PHP is. JSP, ASP, CF etc are alot more difficult to use and can be quite costly. [b]8. IF that's the case then why do people who know for instance asp, why don't they say they know jsp, php as well because they might as well know all if they know one if this is the proper case.[/b] Web Programming Languages can differ dramatically as I have only PHP I cannot comment on ASP or JSP. However these three lanaguages are completely different. [b]12.Can I create a php file, and save it with a .htm, or .html extension and it still be good or the same effect if so what would be the point, is the .htm or html, or the .php better.[/b] You can code PHP in a .htm or .html file but your server must be configured to parse .html files as PHP. Webhosts will only allow .php files for PHP, .html for CSS/Javascript etc. [b]13. What is the difference between .html, and .htm, I always use .htm as default is that the best choice, or should I use .html. As a permanent complete resolution for all things.[/b] There is no difference between .html and .htm file extensions but .html never used to exist. the .htm extension was used on OS that could only allow upto three letters as their file extensions. This changed since Windows 2000 as OS could use extensions more than three letters. This is why there is far more three lettered extensions, such as .doc, .txt, .inc, .xls, .pdf etc. compared to four lettered file extensions. [b]14. What is shtml.[/b] SHTML is HTML on steriods. Well not really but it allows you to stuff like inlude other HTML files in to .shtml document or to should the time other stuff. But SHTML is only limited certain functions. It is rarely used. [b]16. Should I stay away from php 5 for awhile longer, I was told it has a lot of bugs, and isn't good to use it's functions right now until in the future, should I not use it.[/b] Who told you that! That is not true! Although PHP5 did have it problems when it was first released. However this has been corrected and fine to use. But unfortuanly many webhosts have not upgraded their versions of PHP (PHP4) to the newer version. So if you are planning on creating a dynamic website for a client before you go a head and create their site for them you will need to check that their hosting account supports PHP and what version the server has, however 90% of the time it'll be PHP4 only a handfull of hosts have PHP5. If they have PHP5 then it doesn't matter whether you code in PHP4 or 5 as PHP5 is backwards compatible. [b]17. Are there any cross browser issues when relating to server side scripting like php, jsp, or asp, or does all php work in all browsers, and all jsp, and all asp, work in all browsers, if this is not true, then what do I have to do with php to make sure I follow all guidelines to make sure it's as close to browser compatible as possible. IF someone is using internet explorer or firefox version 1( I know it's a 1 in a million) would they be able to see all php and asp as well as someone using a new browser, or do certain browsers not use certain server side languages. I have never heard anything about browser compatibility when relating to something like server side scripting.[/b] Well PHP, JSP, ASP is a server side language meaning it runs of the server and not the browser. The only thing you should worry about with cross browser compatibility is your HTML, CSS and Javascript as these are Client side lanagues (meaning these are run of the clients computer and not the server it self). Any server sided lanague shouldn't show the true souce (your PHP code) when viewed in the browser by going to view -> source but only the output which will be your HTML/CSS or Javascript. This what happens when you request a page on website that is a php file. User click link to see products (products.php) [b]>[/b] browser sends request to server for a file called products.php [b]>[/b] The server checks to see if the file ends in .php prefixif it does it'll send it to the PHP Intepreter [b]>[/b] PHP Intepreter parses the PHP code and returns the output (list of products) to the server [b]>[/b] Server returns the list of products to the browser [b]>[/b] Browser parses the list of products and displays then to the user. [b]19. If I learn really good graphic arts, where I can create logo's banners, and everything else, plus finish mastering xhtml, css, javascript, php, asp, jsp, coldfusion, sql, it's variations. Where do I go from there, is there anything else I can learn that will help, is there anywhere else I can go to learn more, are there any other languages I should start on after that.[/b] You dont need to learn every single web progrommaing languages under the sun. I would recommend you to learn HTML and CSS pretty well these are the only two languages that are important for creating a site that looks good in any browser. Secoundly consentrate on another langauges or two which is server sided sich as PHP and MySQL and thats your lot! If you where to learn all the web programming lanagues under the sun it'll take you years to master them you cannot just pick up a lanaguage, click your fingures and say "hay presto!" and be a wiz at that lanaguage. [b]20. I have heard of ajax, what are it's purposes and reasons for being, are there any reasons for it, and if so, why have I never heard about it from a client, or other web designer, I have only seen it in one place and that is w3schools.com[/b] With AJAX you can create extremely rich content and display data without having to keep refeshing you browser. For a good example of where AJAX is being used go to [a href=\"http://www.forgetfoo.com/\" target=\"_blank\"]forgetfoo.com[/a]. Click on the links on the left and look at your browser loading bar you'll see it will never appear this where AJAX is really cleaver. Instead of you having to clcik and link and then wait for your browser to refresh the page instead AJAX tacks the back door aproach. It request for the page in the background. For more information on AJAX have a read about it over at [a href=\"http://en.wikipedia.org/wiki/AJAX\" target=\"_blank\"]wikipedia.net[/a]. You wont really get any think from a client reqesting their site to feature AJAX as, well they won't have a clue what it is. [b]22. What is the height of php knowledge, how will I know when I can say I have mastered php.[/b] I have being using PHP for about 2 years now and I'm still learning but I have not mastered it as I havn't learnt every single function, configuration setting or developed enough apps to be a master. No one can really say they have mastered PHP. [b]23. How long will it take for me to be able to do my own stuff in php without a lot of checking back with the references.[/b] You are always going to be finding yourself winging your way back to php.net or some help forum or even a book for help with PHP even if you are deserted on some island miles a way from any where. I have done it loads of times sitting in front of my computer screen pulling my hair out asking myself Whats that function called again? How did I do that? Why aint this working?, How can I do/this/that and the other? [b]24. Are there multiple ways to do each thing with server side languages, for instance, with php I see there are like 100 differnet people that create 100 different sets of coding to validate and process forms, does that mean there are different ways to do different things, again meaning there are not just 1 specific way to process forms, but actually many, and if so is this the same for asp, and all the others.[/b] Yes there aloads of different ways a off doing the same task, there isn't any set standard to do things. People just do what best for them and people have different opinions. This is becuase PHP is classed as a "loose" programming lanaguge. Such as an if/else statment you can do this: [code]if($var == $var1) echo "something else"; else echo "something else";[/code]or [code]if($var == $var1) { echo "something else"; } else echo { "something"; }[/code]or another style[code]f($var == $var1) {     echo "something"; } else { echo "something else"; }[/code] As you can see they are the same thing but coded diffferently. PHP allows to get away with this but if you where you doing in another language such as ASP it'll probably have a right out sissy fit. [b]29. How do I use xml with xhtml, should I make it a habit of incorporating xml, into all Xhtml, along with my css, and javascript, is it something that would make me a better designer in some way. What's its purpose, what's it for, and how do I learn how to use it, is there any real significance for it's use, or is it just there[/b]. xHTML is XML. xHTML has a standard set, same goes for XML. These standards are set by w3c (World Wide Web Consortium). With xHTML all (accpet a few such as <br>) tags must be closed, all tags and attributed must be in lowercase etc. Well thats my big 2cents worth there. Scince awnsering all these questions it suddenly dawned on me that you have look at w3schools.com and going through all the tutorials there and said "I have to learn all these lanaguges to be web design". This is not the case. HTML/CSS/PHP and MySQL are the moist common.
  22. Could you provide a link to the problem so I can see what your page looks like at the moment. Also about the DOCTYPE thing I was talking to moberemk then.
  23. My word the world just get better and better! We have the Biscuit Appreciation Society!
  24. wildteen88

    $_GET

    If you want to pas the GET data from the parent window then you'll want to feed the GET data to the frame like so: [code]<frame src="pagename.php?<?php echo $_SERVER["QUERY_STRING"]; ?>">[/code] Now your pagename.php should be able to access the GET data in the parent window.
  25. So you want to see how many users are in your database? Then you can do this: [code]$db = mysql_connect("xxxx","xxxxx","xxxx"); mysql_select_db("schollwork",$db); $query = "SELECT COUNT(name) as users FROM work"; $result = mysql_query($query); $user = mysql_fetch_array($result); echo "There are <b>" . $user['users'] . "</b> users currently in the database!";[/code]
×
×
  • 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.