Marecki669
2.06.2012, 14:37:45
Witam,
Mam problem ze skryptem aktywacji konta po przez email. Gdy podaje wartości czyli /activate.php?id=3&code=c6654769c83cda14c84270307a2e245d wyskakuje mi błąd:
SCREAM: Error suppression ignored for
( ! ) Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\activate.php on line 12
ZĹy ID lub Kod Aktywacyjny.
Oto plik activate.php
<?php
include 'include/funkcje.php';
$id = $_GET['id'];
$code = $_GET['code'];
if ($id&&$code)
{
$check = mysql_query("SELECT * FROM users WHERE user_id='$id' AND user_code_activation='$code'");
if ($checknum==1)
{
$acti = mysql_query("UPDATE users SET user_activated='1' WHERE user_id='$id'"); die("Użytkownik został aktywowany.");
}
else
die("Zły ID lub Kod Aktywacyjny.");
}else
?>
Proszę o pomoc z góry dziękuję.
radziopoke
2.06.2012, 18:03:08
a czy przypadkiem funkcja mysql_query nie ma dwóch parametrów? Pierwsze jest zapytanie, a drugim powinna być zmienna odpowiedzialna za połączenie z daną bazą.
Cytat z manula do wartości zwracanych z mysql_query:
Return Values
For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query() returns a resource on success, or FALSE on error.
For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, mysql_query() returns TRUE on success or FALSE on error.
The returned result resource should be passed to mysql_fetch_array(), and other functions for dealing with result tables, to access the returned data.
Use mysql_num_rows() to find out how many rows were returned for a SELECT statement or mysql_affected_rows() to find out how many rows were affected by a DELETE, INSERT, REPLACE, or UPDATE statement.
mysql_query() will also fail and return FALSE if the user does not have permission to access the table(s) referenced by the query.
Marecki669
2.06.2012, 18:29:30
Dziękuję bardzo radziopoke pomogło. Dziękuję