For some reason im getting the error below
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in C:\www\apache\htdocs\application.php on line 21
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in C:\www\apache\htdocs\application.php on line 25
when trying to insert a form into a mysql table.
below is what the form looks like
<?php
if ($_GET['update'] == 1){
$update = new frontend;
$update->signUp($_POST['firstName'],$_POST['lastName'],
$_POST['sloginName'],$_POST['spassword']);
}
?>
<div id="userSignUp" align="center">
<form action="signUp.php?update=1" method="post">
<table border="0"
cellspacing="0"
cellpadding="0"
style="margin:0px;">
<tr>
<td width="98">First Name </td>
<td width="162"><input type="text" name="firstName" /></td>
</tr>
<tr>
<td>Last Name </td>
<td><input type="text" name="lastName" /></td>
</tr>
<tr>
<td>Login Name </td>
<td><input type="text" name="sloginName" /></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="spassword" /></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Submit" /></td>
</tr>
</table>
</form>
When the form submits. the $_POST varible values are pasted into a user defined method call signUp within a class called front end. this is what it looks like in front end
<?php
class frontend
{
public $table = "users";
public $columns = "firstName, lastName, loginName, passWord";
public function signUp($first,$last,$userName,$userPass){
$value = array($first,$last,$userName,$userPass);
$value = "'{".implode("}','{",$value)."}'";
require_once('Connections/ok.php');
mysql_select_db($database_ok, $ok);
$table = $this->table;
$columns = $this->columns;
$query = "INSERT INTO {$table} ({$columns}) VALUES ($value)";
mysql_query($query,$ok)or die("Error: ".mysql_error());
}
}
?>
Now ive tested all the values being past. they all work. Basically everything works except for the require_once('Connections./ok.php') and mysql_select_db.
Whats funny is I use this every. about a thousand times. but for some reason it doesnt work here. Is it because it doesnt work within a class ???