Announcement

Collapse
No announcement yet.

MySql not working in vBulletin

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • MySql not working in vBulletin

    Ive made a little script just to practise making hacks for vBulletin.
    Its a little chat/shoutout box where the user can submit some text and will display the text on the page.

    There was no problem intergrating it with the style but a little problem to get it to insert the text into the database or view the text on the page.

    here is the code, could someone please tell me whats wrong with it.
    Code:
    <?php 
    // ######################## SET PHP ENVIRONMENT ########################### 
    error_reporting(E_ALL & ~E_NOTICE); 
    // ##################### DEFINE IMPORTANT CONSTANTS ####################### 
    // change the line below to the actual filename without ".php" extention. 
    // the reason for using actual filename without extention as a value of this constant is to ensure uniqueness of the value throughout every PHP file of any given vBulletin installation. 
    define('THIS_SCRIPT', 'chat');  
    // #################### PRE-CACHE TEMPLATES AND DATA ###################### 
    // get special phrase groups 
    $phrasegroups = array(); 
    // get special data templates from the datastore 
    $specialtemplates = array(); 
    // pre-cache templates used by all actions 
    $globaltemplates = array( 
            // change the lines below to the list of actual templates used in the script 
            'mychat', 
    ); 
    // pre-cache templates used by specific actions 
    $actiontemplates = array(); 
    // ########################## REQUIRE BACK-END ############################ 
    require_once('./global.php'); 
    // #################### HARD CODE JAVASCRIPT PATHS ######################## 
    $headinclude = str_replace('clientscript', $vbulletin->options['bburl'] . '/clientscript', $headinclude); 
    // ######################################################################## 
    // ######################### START MAIN SCRIPT ############################ 
    // ######################################################################## 
    $navbits = array();  
    // change the line below to contain whatever you want to show in the navbar (title of your custom page) 
    $navbits[$parent] = 'Test Page'; 
    $navbits = construct_navbits($navbits); 
    eval('$navbar = "' . fetch_template('navbar') . '";'); 
    // change the line below to contain the name of the actual main output template used in your script 
    eval('print_output("' . fetch_template('mychat') . '");'); 
    $message=$_POST['message'];
    $query="INSERT INTO " . TABLE_PREFIX . "mychat VALUES ('$message')";
    mysql_query($query);
    or die(mysql_error());  
    $query2="SELECT * FROM " . TABLE_PREFIX . "mychat";
    $result=mysql_query($query2);
    $num=mysql_numrows($result);
    echo "<b><center>Chat history</center></b><br><br>";
    $i=0;
    while ($i < $num) {
    $message=mysql_result($result,$i,"message");
    echo "<b>Message: $message</b><br />";
    $i++;
    }
    
    ?>

  • #2
    Please post on www.vbulletin.org for help with custom code.
    Best Regards
    Colin Frei

    Please don't contact me per PM.

    Comment


    • #3
      I did, no reply or help.

      What is this php section for if everything has to go in vb org :S

      il try again
      Last edited by Jaynesh; Wed 8 Mar '06, 9:29am.

      Comment


      • #4
        This forum is more for general PHP coding questions. Custom coding for vB is best asked at vbulletin.org.
        Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
        Change CKEditor Colors to Match Style (for 4.1.4 and above)

        Steve Machol Photography


        Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


        Comment


        • #5
          Okay ive gotten no repy from vb org

          Comment


          • #6
            You did get a reply at vb.org. You must remember that at vb.org there are only normal members/volunteers, no paid staff. If someone who know the answer come along he will probably try to help you.
            Originally posted by Jaynesh
            but a little problem to get it to insert the text into the database or view the text on the page.
            Being more specific woul also help in getting a fast response.

            I saw your post at vb.org, replied with a request to be more specific, but (not checked yet today) until now you keep your "problem" vague. Sorry but i (maybe someone else does), don't have the time right now to go read your whole script, searching for possible mistakes if i am not even sure what to look for.
            Want to take your board beyond the standard vBulletin features?
            Visit the official Member to Member support site for vBulletin Modifications: www.vbulletin.org

            Comment


            • #7
              Sorry about not being detailed enough,

              nothing happens when the submit butten is pressed, i inserted some values manually via phpmyadmin, it showed nothing on the page. no error message. just the form.

              i checked the form, its fine.

              Comment

              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
              Working...
              X