Jump to content

Need Simple Help - Warning: Wrong parameter count


jonhmatthew

Recommended Posts

Help!! - Im trying to display logged in user's row in table (not the whole table) - Please help me guys

 

--error message--

 

Warning: Wrong parameter count for mysql_num_rows() in /misc/22/000/244/268/0/user/web/x2broadcasting.com/login_success.php on line 34

Invalid USer..... 

 

--------my code---------------

 

<?

session_start();

if(!session_is_registered(myusername)){

header("location:home.php");

}

?>

 

<html>

<body>

Login Successful

</body>

</html>

 

<br><a href="http://x2broadcasting.com/loginhome.php" target="_top">Proceed Here</a>

 

<br> or

 

<br> <a href="http://www.x2broadcasting.com/logout.php" target="_top">Log Out</a>!<html>

 

<body>

<?php

$username="jonhmatthew";

$password="*********";

$database="x2_2434451";

$localhost="sql8.bravehost.com";

 

 

mysql_connect($localhost,$username,$password);

@mysql_select_db($database) or die( "Unable to select database");

 

 

$query =  mysql_query("SELECT * FROM Users WHERE username = '$username' and password = '$password'")or die("Error:" . mysql_error());

$rlt = mysql_fetch_array($query);

$count = mysql_num_rows();

if($count == 1){

        session_register("username");

        $_SESSION['USERID'] = $rlt['id'];

}else{

  echo "Invalid USer.....";

}

 

$qry = mysql_query("SELECT * FROM Users WHERE id = '".$_SESSION['USERID']."'")or die("ERROR:" . mysql_error());

$rst = mysql_fetch_array($qry);

 

 

mysql_close();

?>

<table border="0" cellspacing="2" cellpadding="2"><tr>

<th><font face="Arial, Helvetica, sans-serif">Value1</font></th>

<th><font face="Arial, Helvetica, sans-serif">Value2</font></th>

<th><font face="Arial, Helvetica, sans-serif">Value3</font></th>

<th><font face="Arial, Helvetica, sans-serif">Value4</font></th>

<th><font face="Arial, Helvetica, sans-serif">Value5</font></th>

</tr>

 

<?php

$i=0;

while ($i < $num) {

 

$f1=mysql_result($result,$i,"Production Appointments");

$f2=mysql_result($result,$i,"Available Commercials");

$f3=mysql_result($result,$i,"Now AIring");

 

?>

 

<tr>

<td><font face="Arial, Helvetica, sans-serif"><?php echo $f1; ?></font></td>

<td><font face="Arial, Helvetica, sans-serif"><?php echo $f2; ?></font></td>

<td><font face="Arial, Helvetica, sans-serif"><?php echo $f3; ?></font></td>

<td><font face="Arial, Helvetica, sans-serif"><?php echo $f4; ?></font></td>

<td><font face="Arial, Helvetica, sans-serif"><?php echo $f5; ?></font></td>

</tr>

 

<?php

$i++;

}

?>

</body>

</html>

 

Link to comment
Share on other sites

 

my page is displaying "invalid user" as you can see under $count, how can I make this a valid user ??

 

-----my code-----

 

$query =  mysql_query("SELECT * FROM Users WHERE username = '$username' and password = '$password'")or die("Error:" . mysql_error());

$rlt = mysql_fetch_array($query);

$count = mysql_num_rows($query );

if($count == 1){

        session_register("username");

        $_SESSION['USERID'] = $rlt['id'];

}else{

  echo "Invalid USer.....";

}

Link to comment
Share on other sites

Well that suggests that your query is returning no rows for the criteria given, so you need to make sure that the username and password are what you expect them to be when going in to the query, and that a row with that username ans password, exists in the db

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.