WordPress.org

Ready to get started?Download WordPress

Forums

Problems quering different db (6 posts)

  1. simoart
    Member
    Posted 6 years ago #

    Hi all, i'm trying to integrate the phpbb3 login system with the comment form in wordpress so that authenticated people is automatically recognized and doesn't need to input name and email or login to comment.

    To do so i read a phpbb3 cookie and then query the database to get the data i need. Here is the code i use (file comments.php):

    ...
    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    
    <?php
    //inizio modifica per personalizzazione viterbolive
    $userSID = $_COOKIE["phpbb3_osrzf_sid"];
    
    //apro connessione...
    $myCon = mysql_connect("localhost","root","");
    
    if (!$myCon) {
    	die('Connessione fallita: ' . mysql_errore());
    }
    else
    {
    	$sqlSelect = "SELECT username, user_email, user_avatar, user_id " .
    	"FROM <code>phpbb_users</code> " .
    	"INNER JOIN <code>phpbb_sessions</code> ON session_user_id = user_id " .
    	"WHERE session_id = '" . $userSID . "'";
    
    	//echo($sqlSelect);
    
    	mysql_select_db("forum", $myCon);
    	$result = mysql_query($sqlSelect);
    
    	while($row = mysql_fetch_array($result))
    	{
    		$myUserName = $row['username'];
    		$myEmail = $row['user_email'];
    	}
    }
    
    mysql_close($myCon);
    //fine modifica
    ?>
    
    <?php if ($myUserName!='Anonymous' and $myUserName!='') : ?>
    ...

    With this code i obtain the result expected but i mess up all the other queries in the page. All the queries executed after this code return the following error on screen:

    Warning: mysql_error(): 8 is not a valid MySQL-Link resource in D:\xampp\htdocs\wordpress\wp-includes\wp-db.php on line 236
    
    No categories

    Any suggestion? What am i doing wrong and how can i solve it? Thank you all!

  2. DJ NightLife
    Member
    Posted 6 years ago #

    I am encoutering the same thing as your problem... Even more f***ed up, comment the mysql_close, and now you'll see the sidebars totally disappear... I'm still looking for a fix!

  3. DJ NightLife
    Member
    Posted 6 years ago #

    Anyone ?

  4. whooami
    Member
    Posted 6 years ago #

    1, Learn some patience. A bump after an hour doesnt make you any friends. AND I dont know where you are but its 6am CST in the states and some people do sleep.

    2. Search. This isnt a brand new topic.

  5. DJ NightLife
    Member
    Posted 6 years ago #

    I have searched... nothing found. I have the same error as simoart with

    Warning: mysql_error(): 8 is not a valid MySQL-Link resource

    with the file wp-db.php

  6. DJ NightLife
    Member
    Posted 6 years ago #

    It has suddenly stopped making errors. Don't ask me why lol ! Topic resolved...

Topic Closed

This topic has been closed to new replies.

About this Topic