Current location: Hot Scripts Forums » Programming Languages » PHP » weird error


weird error

Reply
  #1 (permalink)  
Old 10-25-06, 03:05 PM
tommyc325's Avatar
tommyc325 tommyc325 is offline
Wannabe Coder
 
Join Date: Sep 2005
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
weird error

PHP Code:




# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_blog_oconn "xxx";
$database_blog_oconn "xxx";
$username_blog_oconn "xxx";
$password_blog_oconn "xxx";
$blog_oconn mysql_pconnect($hostname_blog_oconn$username_blog_oconn$password_blog_oconn) or trigger_error(mysql_error(),E_USER_ERROR); 




////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



$ip $_SERVER['REMOTE_ADDR'];
$time time();

$ip_check 'SELECT ip FROM `users_online` WHERE ip = \''.$_SERVER['REMOTE_ADDR'].'\'';
$ip_query mysql_query($ip_check);
$num_rows mysql_num_rows($ip_query);

if(!
$num_rows) { //if no rows, meaning no ip's in db matched theirs, we will add them.
   
$insert_new mysql_query("INSERT INTO `users_online` (ip, time) VALUES ('$ip', '$time')");  
//end if NOT THERE

//this means that they're already in there, so we update info.
   
if($num_rows 0) {
      
$update mysql_query('UPDATE `users_online` SET time=\''.time().'\' WHERE ip = \''.$_SERVER['REMOTE_ADDR'].'\'');
       if(!
$update) die(mysql_error());
// end UPDATE

//if time now - start time > 300 then its been 5 minutes, so we delete
   
$delete_old mysql_query("DELETE FROM `users_online` WHERE ((".time()."-time) > 300)");
     if(!
$delete_old) die(mysql_error());

//show the number of people online now....
$id_query = @mysql_query("SELECT * FROM `users_online`");
$users_online mysql_num_rows($id_query); 
Error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/vhosts/alteredimage.com/httpdocs/Connections/blog_oconn.php on line 25
Table 'alteredimage_com_-_ai2005.users_online' doesn't exist

the weird thing as you can tell is i`m not even connecting to the db called alteredimage_com_-_ai2005.
Reply With Quote
  #2 (permalink)  
Old 10-25-06, 03:10 PM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
replace:
PHP Code:

$ip_query mysql_query($ip_check); 

with this:
PHP Code:

$ip_query mysql_query($ip_check) or die(mysql_error()); 

and as the error says: there's no table named like that in your database

Greetz,
UnrealEd
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
  #3 (permalink)  
Old 10-25-06, 03:25 PM
tommyc325's Avatar
tommyc325 tommyc325 is offline
Wannabe Coder
 
Join Date: Sep 2005
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
ok understood but i`m not even connecting to the db there saying.

Table 'alteredimage_com_-_ai2005.users_online' doesn't exist

im trying to connect to ai_blog
and from there grab the table called users_online
Reply With Quote
  #4 (permalink)  
Old 10-25-06, 04:10 PM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
Since this is a persistent connection, it is probably reporting some previously used information.

Your code is missing a mysql_select_db(...) statement.
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
weird parse error. cant find a solution fridyrls PHP 1 11-03-05 11:26 AM
ASP upload prob minority ASP 1 06-27-05 08:35 AM
Error: 500 Can't connect to ppm.ActiveState.com:80 (connect: Unknown error) padmanaban_bala Perl 2 05-03-05 05:00 PM
New to Java: weird main error msg hecresper Everything Java 2 02-10-04 03:03 PM
[php error] parse error | fatal error xeoHosting PHP 1 01-03-04 08:12 PM


All times are GMT -5. The time now is 05:44 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.