Jump to content

tapewormbyte

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

tapewormbyte's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Respectively: - I don't know, are you? - Because the username/password combination isn't a valid login to MySQL. - Probably not, actually. But it wouldn't be a problem. - Maybe. - Try taking the error message at face value. I'm sorry, this really has my head spinning... The following code works, successfully connecting to the database: if($_POST['passwd'] == $_POST['passwd2']) { $test = db_query("SELECT * FROM INVENTORY WHERE INV_ID = 1"); echo $test[0]['NAME']; $passwd = $_POST['passwd']; However if I change the code ever so slightly, it doesn't work, giving me the connection error: if($_POST['passwd'] == $_POST['passwd2']) { $passwd = $_POST['passwd']; $test = db_query("SELECT * FROM INVENTORY WHERE INV_ID = 1"); echo $test[0]['NAME']; I don't get it... EDIT: oh my god... I just realized I'm resetting the $passwd variable... Same variable I previously set for the database connection. DUH.. Thanks for the help...
  2. I'm working offline, with apache on ubuntu. I have written my own session handler and my mysql connects, inserts and updates the session handler just fine. I'm in the process of writing a "registration" form, and when I attempt to INSERT the data after it has been validated I get the warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: YES) But, I'm already connected? Why would this happen? I'm sure if it were attempting to connect when already connected, it would tell me so. Likewise if it were a syntax error. Any ideas?
  3. I'm trying to update mutiple div's, depending whether or not new content is available for them. I can get one div to update perfectly fine, but as soon as I add recursive-requests stuff starts messing up in that div's will blank out with no content at all, or with the wrong content (as if they're intercepting each other). Is there a way around this? This is my js: [code]function createRequestObject() {     var ro;     var browser = navigator.appName;     if(browser == 'Microsoft Internet Explorer') {         ro = new ActiveXObject("Microsoft.XMLHTTP");     } else {         ro = new XMLHttpRequest();     }     return ro; } var http = createRequestObject(); function sndReq(timestamp, action) {     http.open('get', 'terminal.php?t='+timestamp+'&action='+action+'&nocache='+Date());     http.onreadystatechange = function(){handleResponse(action);}     http.send(null); } function handleResponse(action) {     if(http.readyState == 4) {         var response = http.responseText;         switch(action) {             case 'updateTimer':                 if(response != timestamp) {                     timestamp = response;                 }                 sndReq(timestamp, 'usersonline');             break                         case 'usersonline':                 if(response != document.getElementById(action).innerHTML) {                     document.getElementById(action).innerHTML = response;                 }                 // un-commenting the following line is where problems occur                 //sndReq(timestamp, 'calendar');             break                         case 'calendar':                 if(response != 'noupdate') {                     document.getElementById(action).innerHTML = response;                 }             break         }     } } var timestamp = '<?php echo time(); ?>'; setInterval("sndReq(timestamp, 'updateTimer')", 30000);[/code] And this is my PHP: [code]<?php require_once('../offline/functions.php'); session_start(); if(isset($_REQUEST['t'], $_REQUEST['action'])) {     $timestamp = ctype_digit($_REQUEST['t']) ? $_REQUEST['t'] : time();     switch($_REQUEST['action']) {         case 'updateTimer':             echo time();         break;                 case 'usersonline':             $result = db_query("SELECT count(*) FROM icv_sessions WHERE valid = 'Y'");             $online = $result[0][0] <= 1 ? 'there is currently 1 active session' : 'there are currently '.$result[0][0].' active sessions';             $online .= ' :: <b>'.date("n.j.y.B", $_REQUEST['t']).'</b>&nbsp;';             echo $online;         break;                 case 'calendar':             $result = db_query("SELECT UNIX_TIMESTAMP(create_ts) FROM icv_threads ORDER BY create_ts DESC LIMIT 1");             $lastThread = $result[0][0];             if($lastThread >= ($timestamp - 60)) {                 $dateArray = setup_calendar();                 echo build_calendar($dateArray['month'], $dateArray['year'], $dateArray['dates']);             } else {                 echo 'noupdate';             }         break;     }     exit(); } ?>[/code]
×
×
  • 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.