FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


mysql tempramental ?





rein
hey people,

I got a login and update-form working (yay) but sometimes i get mysql-errors:
this one when i try to update:
Code:
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in blablablah ... login.php on line 14

or this one when i try to log in:
Code:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in ..blah.. change.php on line 35


Sometimes they show, sometimes everything works fine; without changing anything to my code.

Is mysql such a temperamentful and fickle thing, or did i do something wrong?
Philip
you better add your source code specially at error lines here.
but ussually that error happened because sql syntax is wrong

ex :
Code:
$query=mysql_query("select a_field_name_that_dont_at_a_table from table",$db_connection);
rein
thanks for the reply.
This is the sql query:
Code:
   $qLogin = mysql_query("SELECT ID FROM $tabel_gebruikers WHERE
                emailadres = '".mysql_real_escape_string($_POST['emailadres'])."' AND
                paswoord   = '".mysql_real_escape_string($_POST['paswoord'])."'");


This is the line that gives the error:
Code:
    if(mysql_num_rows($qLogin) == 0) {
        echo 'The emailadres/paswoord combination is not correct.';
    } else {
        $_SESSION['gebruiker']         = mysql_result($qLogin, 0);
        $_SESSION['gebruikersnaam'] = $_POST['emailadres'];
      $_SESSION['gebruikersvoornaam'] = mysql_result(mysql_query("SELECT voornaam FROM $tabel_gebruikers WHERE ID = '".mysql_real_escape_string($_SESSION['gebruiker'])."'"), 0);
hexkid
Add error validation to your mysql_query()s
Code:
$var = mysql_query("something") or die('Error in query @ line ' . __LINE__ . ': ' . mysql_error());
rein
Thanks hexkid, that was great advice. Turns out my query was allright, but i forgot to specify the database it should go through. Silly me. Won't make that mistake again any time soon Embarassed

You guys have been a great help.
Thanks again.
Related topics
mysql connection question
php admin and mysql admin console
Mysql And PHP HELP PLZ
Do you use a CMS script?
Question about MySQL!
PHP, MySQL...
PHP Book (Php and Mysql for Dynamic Web Sites)
few mysql questions
E-Cards with PHP & MySQL
HTTP AUTH with PHP and mySQL
Build an online dictionary by PHP/MySQL
Make search engine With PHP and mySQL, for your site
PHP without mySQL
Multiple versions of PHP/MySQL
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.