Lots of good stuff here on this forum..but I fit in this area. While I have been using php for quite some time...all I did was have some code done for me years ago and modified them as I needed...figured it out and it worked.
This week though...I changed to a vps hosting system and everything is different and I have a script I can't get to work for me just says...
Cannot find database
I got the connection script live and working, but the one I need I can't figure out what to put for the database to named properly.
I tried using justanswer.com and they were no help...worse than me.
I think I have it looking for a table in a databse. Here is my code:
<?php
session_start();
//Include database connection details
require_once('connection.php');
?>
<html>
<head>
<script type="text/javascript">
function checkEmail(field)
{
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(field.value)){
return (true)
}
alert("Invalid Member ID! Please re-enter.")
return (false)
}
function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
{
alert(alerttxt);
return false;
}
else
{
return true;
}
}
}
function validate_form(thisform)
{
with (thisform)
{
if ((validate_required(txt_Member,"Member ID Must Be filled!")==false) || (checkMember(txt_Member) == false))
{txt_Member.focus();return false;}
}
}
</script>
<title>Special KWAOR Board Area</title>
<style type="text/css">
<!--
.style1 {
color: #FFFFFF;
font-weight: bold;
}
-->
</style>
</head>
<body>
<?php
if( ! isset($_SESSION['status']))
{
?>
<form method="post" action="code30.php" onsubmit="return validate_form(this)">
<table width="100%" height="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="middle"><table style="border:#006600 1px solid;" width="320" height="120" cellpadding="0" cellspacing="0" bgcolor="#EFEFEF">
<tr>
<td valign="top"><table width="100%" height="120" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3" align="center" bgcolor="#006600">
<span class="style1">Member ID Required!</span> </td>
</tr>
<tr>
<td width="41%" align="right">Member ID </td>
<td width="3%"> </td>
<td width="56%">
<label>
<input name="txt_Email" id="txt_Email" type="text">
<input type="hidden" name="check_submit" value="yes">
</label>
</td>
</tr>
<tr>
<td colspan="3" align="center">
<label>
<input type="submit" name="Submit" value="Submit">
</label>
<b><font color="#FF0000">Your IP is being Recorded</font></b></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</form>
<?php
$_SESSION['status']=1;
}
else
{
if($_POST["check_submit"] == "yes")
{
$eid=$_POST["txt_Email"];
global $cnnDB2;
connectDB2();
$imemberCount = 0;
$sQuery = "SELECT COUNT(member) AS cnt FROM Members WHERE member = '$eid'";
$objResult = mysql_query($sQuery, $cnnDB2);
$aResult=mysql_fetch_array($objResult);
$imemberCount = $aResult[0];
ResetDB2();
if($imemberCount > 0)
{
$sql='select * from fp14361_Board.kwboard where member ="' . $eid . '"';
$result=mysql_query($sql);
//mysql_close($con);
if(mysql_num_rows($result) >= 1)
{
$row=mysql_fetch_array($result);
$_SESSION['bcode'] = $row['fld_code'];
}
else
{
$sql="select MAX(fld_code) from fp14361_Board.kwboard";
$maxcode=mysql_query($sql);
$row=mysql_fetch_array($maxcode);
$maxcode=$row[0];
$maxcode++;
$sql="insert into code30 values('" .$eid. "'," .$maxcode. ")";
mysql_query($sql);
$_SESSION['bcode'] =$maxcode;
}
?>
<div align="center">
<table border="0" width="695" id="table1">
<tr>
<td colspan="3" align="center">
<font size="6" color="#0000FF"><b><br>
KWAOR Board Area</b></font></td>
</tr>
<tr>
<td align="center" width="326">
<p align="left"></p>
<p align="left"> </td>
<td align="center" width="88">
</td>
<td align="center" width="267">
</td>
</tr>
<tr>
<td colspan="3">
<p align="center"> </td>
</tr>
<tr>
<td colspan="3">
<p align="center"><img id="code_img" src="http://bcgen.com/img/29430-RI95-lin.aspx?D=<?php echo($_SESSION['bcode']); ?>">
</tr>
<tr><td colspan="3" align="center"><font size="5" color="#0000FF">
Admission is </font>
<font size="5" color="#0000ff">ONLY for (<?php echo $eid; ?>)</font></td>
</tr>
<tr>
<td colspan="3">
<p align="center"> </td>
<tr>
<td colspan="3">
<p align="center"><a href="http://kwaor.org/a/bd/MostRecentCommitteeReports_8_24_10.pdf">
Download Committee Reports Here</a> <font color="#FF0000">(PDF format)</font></p></td>
</tr>
</table>
</div>
<?php
}
else
{
echo("<br/><br/><h3>Sorry, Member ID is not in our database. Page authorized only for validated Member ID.</h3><br/><a href='http://www.kwaor.org' >Please Click here to load home Page</a>");
}
}
else
{
echo("<a href='http://kwaor.org' >Please Click here to load home Page</a>");
}
session_destroy();
}
?>
</body>
</html>
Do you think you can help?
I have almost the same code working at oceantate.tv/nordic/test/code30.php
the new site has a different version of MySql and I couldn't match them up.