php error Uncaught exception
Ik ben net nieuw in het hele try catch gebeuren.. Nu krijg ik een error waar ik niet helemaal uitkom. kan iemand mij helpen?
Code:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
public function checkThread($messId, $userID, $recID)
{
$checkThreadValid = "select * from strtmessages where uid=$userID and recid=$recID and id=$messId or uid=$recID and recid=$userID and id=$messId";
try
{
if(mysql_query($checkThreadValid))
{
if(mysql_num_rows($checkThreadValid) > 0)
{
return true;
}
else
{
throw new Exception('Something went wrong. Users didn\'t match in class_message at ± 14.');
}
}
else
{
throw new Exception('SQL error while checking thread: '.mysql_error());
}
}
catch(Exeption $returnedError)
{
if(settings::debugging)
{
echo $returnedError->getMessage();
}
else
{
return false;
}
}
}
?>
public function checkThread($messId, $userID, $recID)
{
$checkThreadValid = "select * from strtmessages where uid=$userID and recid=$recID and id=$messId or uid=$recID and recid=$userID and id=$messId";
try
{
if(mysql_query($checkThreadValid))
{
if(mysql_num_rows($checkThreadValid) > 0)
{
return true;
}
else
{
throw new Exception('Something went wrong. Users didn\'t match in class_message at ± 14.');
}
}
else
{
throw new Exception('SQL error while checking thread: '.mysql_error());
}
}
catch(Exeption $returnedError)
{
if(settings::debugging)
{
echo $returnedError->getMessage();
}
else
{
return false;
}
}
}
?>
error:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\Users\solow\Desktop\UsbWebserver\Root\projects\messaging\modules\class_message.php on line 18
Fatal error: Uncaught exception 'Exception' with message 'Something went
wrong. Users didn't match in class_message at 14.' in C:\Users\solow
\Desktop\UsbWebserver\Root\projects\messaging\modules
\class_message.php:24 Stack trace: #0 C:\Users\solow\Desktop
\UsbWebserver\Root\projects\messaging\modules\class_message.php(90):
message->checkThread(19, '2', '1') #1 C:\Users\solow\Desktop\UsbWebserver
\Root\projects\messaging\index.php(6): message->send('2', '1', 'dit is een
repl...', false, 19) #2 {main} thrown in C:\Users\solow\Desktop\UsbWebserve
r\Root\projects\messaging\modules\class_message.php on line 24
Fatal error: Uncaught exception 'Exception' with message 'Something went
wrong. Users didn't match in class_message at 14.' in C:\Users\solow
\Desktop\UsbWebserver\Root\projects\messaging\modules
\class_message.php:24 Stack trace: #0 C:\Users\solow\Desktop
\UsbWebserver\Root\projects\messaging\modules\class_message.php(90):
message->checkThread(19, '2', '1') #1 C:\Users\solow\Desktop\UsbWebserver
\Root\projects\messaging\index.php(6): message->send('2', '1', 'dit is een
repl...', false, 19) #2 {main} thrown in C:\Users\solow\Desktop\UsbWebserve
r\Root\projects\messaging\modules\class_message.php on line 24
Alvast bedankt.
Gewijzigd op 01/01/1970 01:00:00 door Wesley Overdijk
sorry.
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
public function checkThread($messId, $userID, $recID)
{
$checkThreadValid = "select * from strtmessages where uid=$userID and recid=$recID and id=$messId or uid=$recID and recid=$userID and id=$messId";
try
{
if(mysql_query($checkThreadValid))
{
if(mysql_num_rows($checkThreadValid) > 0)
{
return true;
}
else
{
throw new Exception('Something went wrong. Users didn\'t match in class_message at ± 14.');
}
}
else
{
throw new Exception('SQL error while checking thread: '.mysql_error());
}
}
catch(Exception $returnedError)
{
if(settings::debugging)
{
echo $returnedError->getMessage();
}
else
{
return false;
}
}
}
?>
public function checkThread($messId, $userID, $recID)
{
$checkThreadValid = "select * from strtmessages where uid=$userID and recid=$recID and id=$messId or uid=$recID and recid=$userID and id=$messId";
try
{
if(mysql_query($checkThreadValid))
{
if(mysql_num_rows($checkThreadValid) > 0)
{
return true;
}
else
{
throw new Exception('Something went wrong. Users didn\'t match in class_message at ± 14.');
}
}
else
{
throw new Exception('SQL error while checking thread: '.mysql_error());
}
}
catch(Exception $returnedError)
{
if(settings::debugging)
{
echo $returnedError->getMessage();
}
else
{
return false;
}
}
}
?>
Zo dan maar?
Gewijzigd op 01/01/1970 01:00:00 door Maestro Roboroads
roboroads schreef op 05.12.2009 14:49:
Zo dan maar?
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
public function checkThread($messId, $userID, $recID)
{
$checkThreadValid = "select * from strtmessages where uid=$userID and recid=$recID and id=$messId or uid=$recID and recid=$userID and id=$messId";
try
{
if(mysql_query($checkThreadValid))
{
if(mysql_num_rows($checkThreadValid) > 0)
{
return true;
}
else
{
throw new Exeption('Something went wrong. Users didn\'t match in class_message at ± 14.');
}
}
else
{
throw new Exeption('SQL error while checking thread: '.mysql_error());
}
}
catch(Exeption $returnedError)
{
if(settings::debugging)
{
echo $returnedError->getMessage();
}
else
{
return false;
}
}
}
?>
public function checkThread($messId, $userID, $recID)
{
$checkThreadValid = "select * from strtmessages where uid=$userID and recid=$recID and id=$messId or uid=$recID and recid=$userID and id=$messId";
try
{
if(mysql_query($checkThreadValid))
{
if(mysql_num_rows($checkThreadValid) > 0)
{
return true;
}
else
{
throw new Exeption('Something went wrong. Users didn\'t match in class_message at ± 14.');
}
}
else
{
throw new Exeption('SQL error while checking thread: '.mysql_error());
}
}
catch(Exeption $returnedError)
{
if(settings::debugging)
{
echo $returnedError->getMessage();
}
else
{
return false;
}
}
}
?>
Zo dan maar?
OMFG je doet het precies verkeerd om.
Ga jij even lekker sql leren ofzo en niet bezig houden met OOP.
En ook lezen wat hij zegt. Hij zegt dat hij Exeption deed in plaats van Exception.
In de catch was het dus fout.
Niet in de throw.
LOL. Geen commentaar. Toch bedankt voor de poging. :)