Table does not exists

rttsrc1

New Member
Messages
2
Reaction score
0
Points
0
Good day to you all experts!

I'm a novice in PHP and MySQL, I registerd here just few days ago, and I'm currently working on a web application using PHP and MYSQL. The web app works fine in my local computer. But when I've uploaded it on the webserver, I encountered an error saying that table does not exists. Here is the exact error. "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/rttsrc1/public_html/casechecklist/phpscripts/loginscript.php on line 18
Table 'rttsrc1_dbCaseCheckList.tblUsers' doesn't exist".

I've checked my database (rttsrc1_dbCaseCheckList) in PHP Admin under my cPanel and all my tables are there including the tblUsers.

Here are my codes.
===============================================
$mySqlServer = "localhost";
$ServerUserName = "rttsrc1";
$ServerPassword = "********";
$db = "rttsrc1_dbCaseCheckList";

$dbCon = mysql_connect($mySqlServer,$ServerUserName,$ServerPassword);
if (!$dbCon )
die('Could not connect to server. <br> Reason: ' . mysql_error());

//Selects a certain Database
mysql_select_db($db, $dbCon ) or die( "Unable to select database <br> Reason: ". mysql_error());

// Query from tables from the selected database
$rs = "SELECT * FROM tblUsers WHERE bActive=1";
$result = mysql_query($rs, $dbCon);// or die("Unable to select data because " . mysql_error());

//Get Record Count
$RecCount = mysql_num_rows($result) or die(mysql_error()); --> here is where the error occured..
===============================================
Is there something wrong in my codes? or the database settings? Please help me on this one.. Thank you in advance... great day ahead!
 

phpasks

New Member
Messages
145
Reaction score
0
Points
0
PHP:
<?php
$mySqlServer = "localhost";
$ServerUserName = "rttsrc1";
$ServerPassword = "********";
$db = "rttsrc1_dbCaseCheckList";

$dbCon = 
$dbCon = //mysql_connect($mySqlServer,$ServerUserName,$Server Password); $Server Password ==> your problem here.
mysql_connect($mySqlServer,$ServerUserName,$ServerPassword);
if (!$dbCon )

?>

Your password variable set right then solved your problem.
 

rttsrc1

New Member
Messages
2
Reaction score
0
Points
0
Thank you for the response. Although I've encountered another error whenever the app connects to database. it is something like this...

========================================================
"Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'rttsrc1_marcn'@'74.86.133.24' (using password: YES) in /home/rttsrc1/public_html/sample.php on line 8
Could not connect to server.
Reason: Access denied for user 'rttsrc1_marcn'@'74.86.133.24' (using password: YES)".
========================================================
I'm suspecting my database username and password. Please help me how to know the correct username and password to access my database via PHP. Thank you and best regards..
 

Nathan H

New Member
Messages
562
Reaction score
0
Points
0
If this is the only time that useraccoun is used, you can log into your cpanel, scroll down to go to MySQL databses and at the bottom of the page is user accounts management. I'm unsure of how to change passwords but you might consider making a new accouht in here and assiging it to your DB
 
Top