the error i got was
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in file.php
when i put the error echo in it i get the error no database selected.
this might have to do with querying my db through a function call. here are the two code snippets i believe to be the region of interest.
myFunctions.php
function subtractRecallPoint() {
require_once( 'path/to/mysql_connect.php' );
// get the amount of points from the db
$query = "SELECT recallPoints from recallStatus WHERE rs_id =1";
$result = mysql_query( $query ); //or die( " failed: " .mysql_error() );;
//mysql_error() was producing the no database selected message
$retrieved = mysql_fetch_object( $result );
$rp = $retrieved->recallPoints;
...
viewEntries.php
require_once( 'path/to/mysql_connect.php' );// connect to the database
if( isset($_POST['submitted']) ) {
if( $_POST['q1'] == $_POST['num'] ) {
if( (checkChoice($_POST['d0'], $_POST['t0'])) && (checkChoice($_POST['d1'], $_POST['t1'])) && (checkChoice($_POST['d2'], $_POST['t2'])) && (checkChoice($
addRecallPoint();
myExit('good');
} else {
subtractRecallPoint();
myExit('failed checkChoices');
}
} else {
myExit('failed num compare');
}
} else {
...
now i know these codes did run prior to putting in the function call of subtractRecallPoint(). the querying done in the method worked when i had it on an external form handling php page. I just started out with php/mysql. Any help?