May 2006
Monthly Archive
MySQL Examples08 May 2006 10:39 am
MySQL SELECT Command
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:
-
$selectSQL=("SELECT * FROM tblstudent");
MySQL Examples08 May 2006 10:38 am
MySQL CREATE Command
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:
-
$createSQL=("CREATE TABLE tblstudent(fldstudid int(10) NOTNULL AUTO_INCREMENT PRIMARY KEY,fldstudName VARCHAR(250) NOTNULL,fldstudentmark int(4) DEFAULT '0' ");
Disable right click with javascript
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:
-
<head>
-
<script language=JavaScript>
-
<!--
-
var message="Function Disabled!";
-
function clickIE4(){
-
if (event.button==2){
-
alert(message);
-
return false;
-
}
-
}
-
function clickNS4(e){
-
if (document.layers||document.getElementById&&!document.all){
-
if (e.which==2||e.which==3){
-
alert(message);
-
return false;
-
}
-
}
-
}
-
if (document.layers){
-
document.captureEvents(Event.MOUSEDOWN);
-
document.onmousedown=clickNS4;
-
}
-
else if (document.all&&!document.getElementById){
-
document.onmousedown=clickIE4;
-
}
-
document.oncontextmenu=new Function("alert(message);return false")
-
// -->
-
</script>
-
</head>
PHP Code01 May 2006 10:46 am
php includes
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:
-
<? 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