Re: php and freehost
From: Terry A. Haimann (terry_at_yngstr.oldboy.com)
Date: 10/10/03
- Next message: Greg: "External USB hard drive problems..."
- Previous message: Terry A. Haimann: "php and freehost"
- In reply to: Terry A. Haimann: "php and freehost"
- Next in thread: Douglas Clinton: "Re: php and freehost"
- Reply: Douglas Clinton: "Re: php and freehost"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 10 Oct 2003 21:00:22 GMT
Sorry, no attachments are allowed here, I guess.
Example 1:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<SCRIPT LANGUAGE=JavaScript>
<?php
$ipaddr = "localhost";
$user = "myuser";
$pass = "mypass";
$db = "mydb";
$Cnt = 0;
$astro = mysql_connect($ipaddr, $user, $pass);
if(! $astro)
die("could not connect to mysql server");
mysql_select_db($db, $astro)
or die("Could not connect to database");
print("var ObjType = new Array(\n");
$result = mysql_query("select ObjTypeIdx from ObjType");
while($a_row = mysql_fetch_array($result))
{
print('"');
print($a_row['ObjTypeIdx']);
printf('",');
printf("\n");
$Cnt++;
}
print('""');
print(");\n");
print("var ObjTypeCnt = ");
print($Cnt);
print(";\n");
$Cnt = 0;
print("var ObjName = new Array(\n");
$result = mysql_query("select ObjNameIdx from ObjName");
while($a_row = mysql_fetch_array($result))
{
print('"');
print($a_row['ObjNameIdx']);
printf('",');
printf("\n");
$Cnt++;
}
print('""');
print(");\n");
print("var ObjNameCnt = ");
print($Cnt);
print(";\n");
$Cnt = 0;
print("var Photo = new Array(\n");
$result = mysql_query("select PhotoIdx from Photo");
while($a_row = mysql_fetch_array($result))
{
print('"');
print($a_row['PhotoIdx']);
printf('",');
printf("\n");
$Cnt++;
}
print('""');
print(");\n");
print("var PhotoCnt = ");
print($Cnt);
print(";\n");
?>
var TtlInDB = 0;
function ChangeSearch()
{
if(TtlInDB > 0)
{
i = 0;
while(i<=(TtlInDB+1))
{
document.SrchForm.DetailDB.options[0] = null;
i++;
}
}
i = document.SrchForm.SearchDB.value;
// alert('Testing 1... ' + document.SrchForm.SearchDB.value)
// alert('Testing 2... ' + document.SrchForm.SearchDB.options[i].text)
if (i==1)
{
j = 0;
while (j <= ObjNameCnt)
{
var myNewOption = new Option(ObjName[j], j+1);
document.SrchForm.DetailDB.options[j] = myNewOption;
j++;
}
TtlInDB = ObjNameCnt;
}
if (i==2)
{
j = 0;
while (j <= ObjTypeCnt)
{
var myNewOption = new Option(ObjType[j], j+1);
document.SrchForm.DetailDB.options[j] = myNewOption;
j++;
}
TtlInDB = ObjTypeCnt;
}
if (i==3)
{
j = 0;
while (j <= PhotoCnt)
{
var myNewOption = new Option(Photo[j], j+1);
document.SrchForm.DetailDB.options[j] = myNewOption;
j++;
}
TtlInDB = PhotoCnt;
}
}
function ButFunction()
{
var Page;
var s;
var d;
var h, w;
s = document.SrchForm.SearchDB.value;
d = document.SrchForm.DetailDB.value;
d = d - 1;
// h = window.outerHeight;
// w = window.outerWidth;
// alert('height = ' + h);
// alert('width = ' + w);
// document.SrchForm.SearchDB.options[s].text);
// alert('DetailDB = ' +
// document.SrchForm.DetailDB.options[d].text);
Page = "Table_Page.html?" + "sch=" +
document.SrchForm.SearchDB.options[s].text + "&" +
"dtl=" + document.SrchForm.DetailDB.options[d].text;
// alert('Page = ' + Page);
var newWindow = open(Page, "Records Selected", "fullscreen=yes");
}
</SCRIPT>
<title>Astronomy Page</title>
<meta http-equiv="content-type"
content="text/html; charset=ISO-8859-1">
<A href="http://hostrave.com?source=freehosting-allusersheaders"
target=_blank>Gracefully sponsered by HOSTRAVE.COM- Discount Hosting!</A>
</head>
<body>
<div align="center"><big><big><big><big><big>Terry's Astronomy Page</big></big></big></big></big><br>
<FORM NAME=SrchForm>
<SELECT NAME="SearchDB"
onChange="ChangeSearch()">
<OPTION VALUE=0 SELECTED> Search By
<OPTION VALUE=1>Object
<OPTION VALUE=2>Type of Object
<OPTION VALUE=3>Photographer
</SELECT>
<SELECT NAME="DetailDB">
</SELECT>
</div>
<br>
<br>
<INPUT TYPE="button" NAME="SubBut" VALUE="Submit" onClick="ButFunction()">
</FORM>
</body>
</html>
Example 2:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script LANGUAGE=JavaScript>
var ObjType = new Array(
"BinarySystem",
"ClusterGlobular",
"ClusterOpen",
"ClusterOpen+Emission",
"Galaxie",
"Moon",
"NebulaEmission",
"NebulaPlanetary",
"Planet",
"SuprNovRem",
"");
var ObjTypeCnt = 10;
var ObjName = new Array(
"m001",
"m002",
"m003",
"m004",
"m005",
"m006",
"m010",
"m011",
"m012",
"m013",
"m014",
"m015",
"m016",
"m017",
"m018",
"m019",
"m027",
"m031",
"M042",
"m045",
"m051",
"M057",
"Mars",
"Moon",
"");
var ObjNameCnt = 24;
var Photo = new Array(
"BeersAlan",
"ButchBry",
"HaimChery",
"HaimTerry",
"JohnFred",
"NASA",
"SEDS",
"");
var PhotoCnt = 7;
var TtlInDB = 0;
function ChangeSearch()
{
if(TtlInDB > 0)
{
i = 0;
while(i<=(TtlInDB+1))
{
document.SrchForm.DetailDB.options[0] = null;
i++;
}
}
i = document.SrchForm.SearchDB.value;
// alert('Testing 1... ' + document.SrchForm.SearchDB.value)
// alert('Testing 2... ' + document.SrchForm.SearchDB.options[i].text)
if (i==1)
{
j = 0;
while (j <= ObjNameCnt)
{
var myNewOption = new Option(ObjName[j], j+1);
document.SrchForm.DetailDB.options[j] = myNewOption;
j++;
}
TtlInDB = ObjNameCnt;
}
if (i==2)
{
j = 0;
while (j <= ObjTypeCnt)
{
var myNewOption = new Option(ObjType[j], j+1);
document.SrchForm.DetailDB.options[j] = myNewOption;
j++;
}
TtlInDB = ObjTypeCnt;
}
if (i==3)
{
j = 0;
while (j <= PhotoCnt)
{
var myNewOption = new Option(Photo[j], j+1);
document.SrchForm.DetailDB.options[j] = myNewOption;
j++;
}
TtlInDB = PhotoCnt;
}
}
function ButFunction()
{
var Page;
var s;
var d;
var h, w;
s = document.SrchForm.SearchDB.value;
d = document.SrchForm.DetailDB.value;
d = d - 1;
// h = window.outerHeight;
// w = window.outerWidth;
// alert('height = ' + h);
// alert('width = ' + w);
// document.SrchForm.SearchDB.options[s].text);
// alert('DetailDB = ' +
// document.SrchForm.DetailDB.options[d].text);
Page = "Table_Page.html?" + "sch=" +
document.SrchForm.SearchDB.options[s].text + "&" +
"dtl=" + document.SrchForm.DetailDB.options[d].text;
// alert('Page = ' + Page);
var newWindow = open(Page, "Records Selected", "fullscreen=yes");
}
</SCRIPT>
<title>Astronomy Page</title>
<meta http-equiv="content-type"
content="text/html; charset=ISO-8859-1">
<a href="http://hostrave.com?source=freehosting-allusersheaders"
target=_blank>Gracefully sponsered by HOSTRAVE.COM- Discount Hosting!</a>
</head>
<body>
<div align="center"><big><big><big><big><big>Terry's Astronomy Page</big></big></big></big></big><br>
<form NAME=SrchForm>
<select NAME="SearchDB"
onChange="ChangeSearch()">
<option VALUE=0 SELECTED> Search By
<option VALUE=1>Object
<option VALUE=2>Type of Object
<option VALUE=3>Photographer
</select>
<select NAME="DetailDB">
</select>
</div>
<br>
<br>
<input TYPE="button" NAME="SubBut" VALUE="Submit" onClick="ButFunction()">
</form>
</body>
</html>
Example 3:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script LANGUAGE=JavaScript>
<?php
$ipaddr = "localhost";
$user = "myuser";
$pass = "mypass";
$db = "mydb";
$Cnt = 0;
$astro = mysql_connect($ipaddr, $user, $pass);
if(! $astro)
die("could not connect to mysql server");
mysql_select_db($db, $astro)
or die("Could not connect to database");
print("var ObjType = new Array(\n");
$result = mysql_query("select ObjTypeIdx from ObjType");
while($a_row = mysql_fetch_array($result))
{
print('"');
print($a_row['ObjTypeIdx']);
printf('",');
printf("\n");
$Cnt++;
}
print('""');
print(");\n");
print("var ObjTypeCnt = ");
print($Cnt);
print(";\n");
$Cnt = 0;
print("var ObjName = new Array(\n");
$result = mysql_query("select ObjNameIdx from ObjName");
while($a_row = mysql_fetch_array($result))
{
print('"');
print($a_row['ObjNameIdx']);
printf('",');
printf("\n");
$Cnt++;
}
print('""');
print(");\n");
print("var ObjNameCnt = ");
print($Cnt);
print(";\n");
$Cnt = 0;
print("var Photo = new Array(\n");
$result = mysql_query("select PhotoIdx from Photo");
while($a_row = mysql_fetch_array($result))
{
print('"');
print($a_row['PhotoIdx']);
printf('",');
printf("\n");
$Cnt++;
}
print('""');
print(");\n");
print("var PhotoCnt = ");
print($Cnt);
print(";\n");
?>
var TtlInDB = 0;
function ChangeSearch()
{
if(TtlInDB > 0)
{
i = 0;
while(i<=(TtlInDB+1))
{
document.SrchForm.DetailDB.options[0] = null;
i++;
}
}
i = document.SrchForm.SearchDB.value;
// alert('Testing 1... ' + document.SrchForm.SearchDB.value)
// alert('Testing 2... ' + document.SrchForm.SearchDB.options[i].text)
if (i==1)
{
j = 0;
while (j <= ObjNameCnt)
{
var myNewOption = new Option(ObjName[j], j+1);
document.SrchForm.DetailDB.options[j] = myNewOption;
j++;
}
TtlInDB = ObjNameCnt;
}
if (i==2)
{
j = 0;
while (j <= ObjTypeCnt)
{
var myNewOption = new Option(ObjType[j], j+1);
document.SrchForm.DetailDB.options[j] = myNewOption;
j++;
}
TtlInDB = ObjTypeCnt;
}
if (i==3)
{
j = 0;
while (j <= PhotoCnt)
{
var myNewOption = new Option(Photo[j], j+1);
document.SrchForm.DetailDB.options[j] = myNewOption;
j++;
}
TtlInDB = PhotoCnt;
}
}
function ButFunction()
{
var Page;
var s;
var d;
var h, w;
s = document.SrchForm.SearchDB.value;
d = document.SrchForm.DetailDB.value;
d = d - 1;
// h = window.outerHeight;
// w = window.outerWidth;
// alert('height = ' + h);
// alert('width = ' + w);
// document.SrchForm.SearchDB.options[s].text);
// alert('DetailDB = ' +
// document.SrchForm.DetailDB.options[d].text);
Page = "Table_Page.html?" + "sch=" +
document.SrchForm.SearchDB.options[s].text + "&" +
"dtl=" + document.SrchForm.DetailDB.options[d].text;
// alert('Page = ' + Page);
var newWindow = open(Page, "Records Selected", "fullscreen=yes");
}
</SCRIPT>
<title>Astronomy Page</title>
<meta http-equiv="content-type"
content="text/html; charset=ISO-8859-1">
<a href="http://hostrave.com?source=freehosting-allusersheaders"
target=_blank>Gracefully sponsered by HOSTRAVE.COM- Discount Hosting!</a>
</head>
<body>
<!-- START HOME FREE HEADER CODE -->
<center><script language="JavaScript">
var imgsa = new Array("Gracefully sponsored by HOSTRAVE.COM- Discount Hosting & GREAT SERVICE","GREAT PRICES....FRIENDLY SUPPORT")
var lnksa = new Array("http://hostrave.com?source=freehosting-allusersheaders","http://hostrave.com?source=freehosting-allusersheaders")
var alta = new Array()
var currentAda = 0
var imgCta = 2
function cyclea() {
currentAda++
if (currentAda == imgCta) {
currentAda = 0
}
adLinka.innerText=imgsa[currentAda]
adLinka.href=lnksa[currentAda]
setTimeout("cyclea()",10 * 1000)
}
</script>
<a style="font-size:12px;color:#003366;font-family:verdana;font-weight:bold;font-style:italic;" href="http://hostrave.com?source=freehosting-allusersheaders" name="adLinka" target="_top">Gracefully sponsored by HOSTRAVE.COM- Discount Hosting & GREAT SERVICE</a>
<script language="JavaScript">
cyclea()
</script></center>
<!-- END HOME FREE HEADER CODE -->
<div align="center"><big><big><big><big><big>Terry's Astronomy Page</big></big></big></big></big><br>
<form NAME=SrchForm>
<select NAME="SearchDB"
onChange="ChangeSearch()">
<option VALUE=0 SELECTED> Search By
<option VALUE=1>Object
<option VALUE=2>Type of Object
<option VALUE=3>Photographer
</select>
<select NAME="DetailDB">
</select>
</div>
<br>
<br>
<input TYPE="button" NAME="SubBut" VALUE="Submit" onClick="ButFunction()">
</form>
<!-- START HOME FREE FOOTER CODE -->
<!-- END HOME FREE FOOTER CODE -->
</body>
</html>
- Next message: Greg: "External USB hard drive problems..."
- Previous message: Terry A. Haimann: "php and freehost"
- In reply to: Terry A. Haimann: "php and freehost"
- Next in thread: Douglas Clinton: "Re: php and freehost"
- Reply: Douglas Clinton: "Re: php and freehost"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]