May 2006


MySQL Examples08 May 2006 10:39 am

The Select command is used to select the records from a table using its field names. To select all the fields in a table, '*' is used in the command. The result is assigned to a variable name as shown below:

Syntax:

$selectSQL=("SELECT field_names FROM tablename");

Example:

CODE:
  1. $selectSQL=("SELECT * FROM tblstudent");

MySQL Examples08 May 2006 10:38 am

CREATE Command

The Create command is used to create a table by specifying the tablename, fieldnames and constraints as shown below:

Syntax:

$createSQL=("CREATE TABLE tblName");

Example:

CODE:
  1. $createSQL=("CREATE TABLE tblstudent(fldstudid int(10) NOTNULL AUTO_INCREMENT PRIMARY KEY,fldstudName VARCHAR(250) NOTNULL,fldstudentmark int(4) DEFAULT '0' ");

Javascript code snippets02 May 2006 01:39 pm

Though not able to stop anyone who really wants your source code, images, or other imbedded items, this will slow down some... disable right mouse click with a bit of JavaScript in your pages header

CODE:
  1. <head>
  2. <script language=JavaScript>
  3. <!--
  4. var message="Function Disabled!";
  5. function clickIE4(){
  6. if (event.button==2){
  7. alert(message);
  8. return false;
  9. }
  10. }
  11. function clickNS4(e){
  12. if (document.layers||document.getElementById&&!document.all){
  13. if (e.which==2||e.which==3){
  14. alert(message);
  15. return false;
  16. }
  17. }
  18. }
  19. if (document.layers){
  20. document.captureEvents(Event.MOUSEDOWN);
  21. document.onmousedown=clickNS4;
  22. }
  23. else if (document.all&&!document.getElementById){
  24. document.onmousedown=clickIE4;
  25. }
  26. document.oncontextmenu=new Function("alert(message);return false")
  27. // -->
  28. </script>
  29. </head>

PHP Code01 May 2006 10:46 am

php includes - rather than rewrite several lines of code for each page, for example adding a standardized header (or footer) to hundreds of pages, using a php include can save a lot of effort, especially when it comes time that you want to make universal changes across your site..... edit one file ie... header.php and every page calling for it's header from this file is changed in single shot.

CODE:
  1. <? include("header.php") ?>

There are as many uses for using includes as you can imagine, populating a set list of variables, database connection strings...

« Previous Page


Mortgage Calculator - Online Gift Shopping - Car Loan - Free Advertising - Bad Credit Mortgages
X10 Home Security|Dakar's Photos
Listed on BlogShares