Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

PHP 

PHP Login/Register | Login problem.

So, i got error in my php code at this line:

Code
//Counting table row
$count=mysql_num_rows($result);
mySQL error:
Code
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a5899566/public_html/checklogin.php on line 30

Heres the code that is interacted with the line:

Code
$sql = "SELECT * FROM $tbl_name WHERE username='$usern' and password='$passn'";
$result=mysql_query($sql);

//Counting table row
$count=mysql_num_rows($result);
Anyone help? :3
$result=mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query);

try that.
(Jan 18, 2012 06:08 PM)kalwat Wrote:  $result=mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query);

try that.
Then it says this:

Code
Error: Query was empty with query
Can you echo $results and post the contents?
(Jan 18, 2012 08:28 PM)Reserve Wrote:  Can you echo $results and post the contents?

Nope i can't, all i get is the query thing i posted over those 2 posts.
Did you connect to your database before hand? Are your table names correct?
(Jan 18, 2012 10:20 PM)BlueLight™ Wrote:  Did you connect to your database before hand? Are your table names correct?

Yep, this is at login section. The register works fien, and it isnerts the details into the table.
(Jan 18, 2012 06:11 PM)OsteeN Wrote:  Then it says this:

Code
Error: Query was empty with query

Use the variable in your script: $sql -_-
Try and make the "and" in the $sql statement capitals like "AND".


Possibly Related Threads...
Thread / Author Replies Views Last Post
[PHP] by DavidIAJan 24, 2019 12:44 PM 9 355 Jan 24, 2019 12:44 PM
Last Post: DavidIA
[PHP] by RootBlack1996Oct 29, 2017 09:41 AM 14 434 Oct 29, 2017 09:41 AM
Last Post: Charger
[PHP] by alemalakraMay 3, 2017 06:22 AM 57 2,600 May 3, 2017 06:22 AM
Last Post: Squito