Get ready for BLACK FRIDAY shopping starting in

Forums

This topic is locked

1064 error

Posted 05 Aug 2002 01:48:49
1
has voted
05 Aug 2002 01:48:49 W Moody posted:
When I attempt to submit a form that inserts records into a mysql database I get the following error

An error occured!
Error no: 1046
Error message: No Database Selected

All of the code has been written by ultradev. I am using the PHAKT extension to write the code in php. I know the connection works because I used the insert records behaviour to match the datafields.

I am new to this so I may be leaving out a step. For example do I need a page to retrieve the data before it gets sent to the database. I am attempting to simply use the insert records behaviour to insert the data from the form page.

Thanks for any suggestions or help

The code from the form page is listed below.

<?php


// Copyright (c) Interakt Online 2001
// www.interakt.ro/

require("./adodb/adodb.inc.php";
require("./Connections/birthdaysite.php";
?>
<?php require_once(ADODB_DIR."/KTeditOps_declareVars.php"; ?>
<?php
// *** Insert Record: set Variables

if (isset($MM_insert)){

// $MM_editConnection = MM_birthdaysite_STRING;
$MM_editTable = "contactinfo";
$MM_editRedirectUrl = "thankyoupremium.php";
$MM_fieldsStr =
"username|value|password|value|securityquestion|value|securityanswer|value|c
ontactname|value|contactemail|value|businesscategory|value|businessname|valu
e|streetaddress|value|city|value|state|value|siteurl|value|email|value|busin
essdescription|value|uploadlogo|value|premium hidden insert|value";
$MM_columnsStr =
"username|',none,''|password|',none,''|securityquestion|',none,''|securityan
swer|',none,''|contactname|',none,''|contactemail|',none,''|businesscategory
|',none,''|businessname|',none,''|streetaddress|',none,''|city|',none,''|sta
te|',none,''|siteurl|',none,''|email|',none,''|businessdescription|',none,''
|uploadlogo|',none,''|level|',none,''";

// create the $MM_fields and $MM_columns arrays
$MM_fields = explode("|", $MM_fieldsStr);
$MM_columns = explode("|", $MM_columnsStr);

// set the form values
for ($i=0; $i+1 < sizeof($MM_fields); ($i=$i+2)) {
$MM_fields[$i+1] = $$MM_fields[$i];
}

// append the query string to the redirect URL
if ($MM_editRedirectUrl && $QUERY_STRING && (strlen($QUERY_STRING) > 0)) {

$MM_editRedirectUrl .= ((strpos($MM_editRedirectUrl, '?') ==
false)?"?":"&" . $QUERY_STRING;
}
}
?>
<?php
$KT_Connection = &$birthdaysite;
require_once(ADODB_DIR."/KTinsertRecord_query.php";
?>
<html>
<head>
<title>Premium listing</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document;
if((p=n.indexOf("?")>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++)
x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++)
x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2];
val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="" {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an
e-mail address.\n';
} else if (test!='R') {
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (val<min || max<val) errors+='- '+nm+' must contain a number
between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is
required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}

function tmt_compareField(f1,f2,rule,errorMsg){
var myErr = "";
if(eval("MM_findObj('"+f1+"').value"+rule+"MM_findObj('"+f2+"').value"){
alert(unescape(errorMsg));myErr += 'errorMsg';}
document.MM_returnValue = (myErr == "";
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="700" border="0" cellspacing="0" cellpadding="0"
align="center">
<tr>
<td> </td>
<td align="center"><font face="Times New Roman, Times, serif"
size="6">Premium
listing</font></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td align="center">
<p><font face="Times New Roman, Times, serif" size="4">contact
information</font></p>
<p><font face="Times New Roman, Times, serif" size="3">(this
information
will not be displayed)</font></p>
</td>
<td> </td>
</tr>
</table>
<form ACTION="<?php echo $MM_editAction?>" METHOD="POST" name="premium
listing submit" enctype="multipart/form-data"
onSubmit="MM_validateForm('username','','R','security
answer','','R','contact name','','R','contact
e-mail','','RisEmail','business
name','','R','email','','NisEmail','password','','R','confirm
pass','','R');tmt_compareField('password','confirm
pass','!=','The%20password%20didn%27t%20match');return
document.MM_returnValue">
<table width="700" border="0" cellspacing="0" cellpadding="0"
align="center">
<tr>
<td width="243"><font face="Geneva, Arial, Helvetica, san-serif"
color="#CC6633"><b><font color="#0066FF">Username</font></b></font></td>
<td width="252">
<input type="text" name="username" size="20" maxlength="20">
<font color="#CC3300">*</font> </td>
<td width="205"> </td>
</tr>
<tr>
<td width="243"><font face="Geneva, Arial, Helvetica,
san-serif"><b><font color="#0066FF">Password</font></b></font></td>
<td width="252">
<input type="password" name="password" size="10" maxlength="10">
<font color="#CC3300">*</font> </td>
<td width="205"> </td>
</tr>
<tr>
<td width="243"><b><font face="Geneva, Arial, Helvetica, san-serif"
color="#0066FF">Confirm
password</font></b></td>
<td width="252">
<input type="password" name="confirm pass" size="10" maxlength="10">
<font color="#CC3300">*</font> </td>
<td width="205"> </td>
</tr>
<tr>
<td width="243"><font face="Geneva, Arial, Helvetica,
san-serif"><b><font color="#0066FF">Security
question</font></b></font></td>
<td width="252">
<select name="securityquestion">
<option value="mother's maiden name">What is your mother's maiden
name</option>
<option value="first pet's name">What was your first pets
name</option>
</select>
<font color="#CC3300">*</font> </td>
<td width="205"> </td>
</tr>
<tr>
<td width="243"><font face="Geneva, Arial, Helvetica, san-serif"
color="#0066FF"><b>Answer
to security question</b></font></td>
<td width="252">
<input type="text" name="securityanswer" size="30">
<font color="#CC3300">*</font> </td>
<td width="205"> </td>
</tr>
<tr>
<td width="243"><font face="Geneva, Arial, Helvetica, san-serif"
color="#0066FF"><b>Contact
name</b></font></td>
<td width="252">
<input type="text" name="contactname" size="30">
<font color="#CC3300">*</font> </td>
<td width="205"> </td>
</tr>
<tr>
<td width="243"><font face="Geneva, Arial, Helvetica, san-serif"
color="#0066FF"><b>Contact
e-mail</b></font></td>
<td width="252">
<input type="text" name="contactemail" size="30">
<font color="#CC3300">*</font> </td>
<td width="205"> </td>
</tr>
<tr>
<td width="243"><b><font face="Geneva, Arial, Helvetica, san-serif"
color="#0066FF">Business
category </font></b></td>
<td width="252">
<select name="businesscategory">
<option value="cakes">cakes</option>
<option value="entertainment">entertainment</option>
<option value="rentals">rentals</option>
<option value="venues/locations">venues/locations</option>
<option value="party supplies">party supplies</option>
<option value="catering">catering</option>
</select>
</td>
<td width="205"> </td>
</tr>
</table>
<table width="700" border="0" cellspacing="0" cellpadding="0"
align="center">
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td align="center"><font face="Times New Roman, Times, serif"
size="4">Listing
information</font></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<table width="700" border="0" cellspacing="0" cellpadding="0"
align="center">
<tr>
<td width="242"><font face="Geneva, Arial, Helvetica,
san-serif"><b><font color="#0066FF">Business
name</font></b></font></td>
<td width="243" colspan="2">
<input type="text" name="businessname" size="30">
<font color="#CC3300">*</font> </td>
<td width="215"> </td>
</tr>
<tr>
<td width="242"><font face="Geneva, Arial, Helvetica,
san-serif"><b><font color="#0066FF">Street
address</font></b></font></td>
<td width="243" colspan="2">
<input type="text" name="streetaddress" size="30">
</td>
<td width="215"> </td>
</tr>
<tr>
<td width="242"><b><font face="Geneva, Arial, Helvetica, san-serif"
color="#0066FF">City</font></b></td>
<td width="243" colspan="2">
<input type="text" name="city" size="30">
</td>
<td width="215"> </td>
</tr>
<tr>
<td width="242"><b><font face="Geneva, Arial, Helvetica, san-serif"
color="#0066FF">State</font></b></td>
<td width="243" colspan="2">
<select name="state">
</select>
</td>
<td width="215"> </td>
</tr>
<tr>
<td width="242"><font face="Geneva, Arial, Helvetica,
san-serif"><b><font color="#0066FF">Phone
number</font></b></font></td>
<td width="243" colspan="2">
<input type="text" name="phone " size="12">
</td>
<td width="215"> </td>
</tr>
<tr>
<td width="242"><font face="Geneva, Arial, Helvetica,
san-serif"><b><font color="#0066FF">Site
url (optional)</font></b></font></td>
<td width="243" colspan="2">
<input type="text" name="siteurl" size="30">
</td>
<td width="215"> </td>
</tr>
<tr>
<td width="242"><font face="Geneva, Arial, Helvetica, san-serif"
color="#0066FF"><b>Email
address (optional)</b></font></td>
<td width="243" colspan="2">
<input type="text" name="email" size="30">
</td>
<td width="215"> </td>
</tr>
<tr>
<td width="242"><font face="Geneva, Arial, Helvetica, san-serif"
color="#0066FF"><b>Description</b></font></td>
<td width="243" colspan="2">
<textarea name="businessdescription" cols="40" rows="6"></textarea>
</td>
<td width="215"> </td>
</tr>
<tr>
<td width="242"><b><font face="Geneva, Arial, Helvetica, san-serif"
color="#0066FF">upload
logo</font></b></td>
<td width="243" colspan="2">
<input type="file" name="uploadlogo">
</td>
<td width="215"> </td>
<tr>
<td width="242">
<input type="hidden" name="premium hidden insert" value="premium">
</td>
<td width="243" colspan="2">  </td>
<td width="215"> </td>
</tr>
<tr>
<td width="242"> </td>
<td width="243" align="center" valign="middle" colspan="2"> <font
color="#CC3300">*</font>
denotes required field </td>
<td width="215"> </td>
</tr>
<tr>
<td width="242"> </td>
<td width="243" colspan="2"> </td>
<td width="215"> </td>
</tr>
<tr>
<td width="242"> </td>
<td width="243" colspan="2"> </td>
<td width="215"> </td>
</tr>
<tr>
<td width="242"> </td>
<td width="121" align="center" valign="middle">
<input type="submit" name="Submit" value="Submit">
</td>
<td width="122" align="center" valign="middle">
<input type="reset" name="reset" value="Reset">
</td>
<td width="215"> </td>
</tr>
<tr>
<td width="242"> </td>
<td width="243" colspan="2"> </td>
<td width="215"> </td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="true">
</form>
</body>
</html>

Reply to this topic