Jump to content

mrooks1984

Members
  • Posts

    82
  • Joined

  • Last visited

    Never

Posts posted by mrooks1984

  1. the actual db file i am using on the 1and1 server is this i have changed username and password.

    the one on my local xampp test server is the one at the top of the page with localhost

    //Setup Our Connection Vars
    $obj->host = 'db1222.oneandone.co.uk';
    $obj->username = 'username';
    $obj->password = 'password';
    $obj->db = 'db361371865';
    
    	//Connect To Our Database
    $obj->connect();
    

    hope this helps, thanks again.

  2. hi all, i have a test server (newest xampp) and the code works fine, as soon as i upload to 1and1 (they use apachi, php and mysql) i get this message: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

    i have double checked username and passwords, had a look on google, contacted there support with no luck yet.

    i am wondering if its a mysql or php version problem, so hoping someone knows when the following code with classes etc was added or if someone knows how to fix it i be really greatful.

    heres some of the code i am using

    class cyberglide {
    
    var $host;
    var $username;
    var $password;
    var $db;
    
    function connect() {
    	$con = mysql_connect($this->host, $this->username, $this->password) or die (mysql_error());
    	mysql_select_db($this->db, $con) or die(mysql_error());
    }
    
    function get_top() {
    
            if (isset($_GET['page']))
    {
     		$page = $_GET['page'];
    	// Display Page.
                    $sql = "SELECT title,body FROM content WHERE page = '$page' AND location = 'left' AND disabled = 'no' ORDER BY id";
                    $res = mysql_query($sql) or die (mysql_error());
                    while($row = mysql_fetch_assoc($res)){
    				echo '<h1>' . $row['title'] . '</h1>';	
                        echo '<p>' . $row['body'] . '</p>';
    		}			
    	}		
            else
            {
                    //Show Home Page
                    $sql = "SELECT title,body FROM content WHERE page = 'home' AND location = 'left' AND disabled = 'no' ORDER BY id";
                    $res = mysql_query($sql) or die (mysql_error());
                    while($row = mysql_fetch_assoc($res)){
    				echo '<h1>' . $row['title'] . '</h1>';
                        echo '<p>' . $row['body'] . '</p>';  
                    }
    	  }
    }
    
    	function get_left() {
    
            if (isset($_GET['page']))
    {
     		$page = $_GET['page'];
    	// Display Page.
                    $sql = "SELECT title,body FROM content WHERE page = '$page' AND location = 'left' AND disabled = 'no' ORDER BY id";
                    $res = mysql_query($sql) or die (mysql_error());
                    while($row = mysql_fetch_assoc($res)){
    				echo '<h1>' . $row['title'] . '</h1>';	
                        echo '<p>' . $row['body'] . '</p>';
    		}			
    	}		
            else
            {
                    //Show Home Page
                    $sql = "SELECT title,body FROM content WHERE page = 'home' AND location = 'left' AND disabled = 'no' ORDER BY id";
                    $res = mysql_query($sql) or die (mysql_error());
                    while($row = mysql_fetch_assoc($res)){
    				echo '<h1>' . $row['title'] . '</h1>';
                        echo '<p>' . $row['body'] . '</p>';  
                    }
    		}
    }
    }//Ends Our Class
    

    db file

    //Setup Our Connection Vars
    $obj->host = 'localhost';
    $obj->username = 'root';
    $obj->password = '';
    $obj->db = 'db361371865';
    
    	//Connect To Our Database
    $obj->connect();
    

    many thanks all.

  3. hello all, i am stuck with a problem and hoping someone can help me.

    i have got the following code to sort of work.

    the problem i am having is when i put e.g. index.php?page=test and there is no information with test under page in the sqlite db i get this message, Notice: Undefined offset: 0 in C:\xampp\htdocs\test\Frontend\left.php on line 8.

    as soon as i type index.php?page=test2 and i have test2 in the database the error is gone and shows the content

    heres the code

    
            if (isset($_GET['page']))
            {
    	$page = $_GET['page'];
    
    	// Display Page.
    	$query = "SELECT body FROM content WHERE page = '$page' AND location = 'left' AND disabled = 'no' ORDER BY id";
    	$results = $base->arrayQuery($query, SQLITE_ASSOC);
    	$arr = $results[0];
    
    			echo '<div id="left">';		
                    echo '<p>' . $arr['body'] . '</p>';
    			echo '</div>';
    
    	}		
            else
            {
                    //Show Home Page
    	$query = "SELECT body FROM content WHERE page = 'home' AND location = 'left' AND disabled = 'no' ORDER BY id";
    	$results = $base->arrayQuery($query, SQLITE_ASSOC);
    	$arr = $results[0];
    
    			echo '<div id="left">';
                    echo '<p>' . $arr['body'] . '</p>';
    			echo '</div>';    
                    
    }

    hope you understand what i am trying to say, thanks very much all.

     

     

     

×
×
  • 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.