Jump to content

Tenaciousmug

Members
  • Posts

    159
  • Joined

  • Last visited

Posts posted by Tenaciousmug

  1. Thank you! I wasn't aware that you could do that. That works like a charm, but now my DISTINCT isn't exactly working the way I want it to. If the board has two posts in it, it pulls that thread twice even with the DISTINCT on the id... So I'm confused.

    This is my SQL statement now:

     

    SELECT DISTINCT t.id, t.title, t.sticky, t.locked, u.username AS author, pu.username AS lposter
    FROM forum_topic t
    JOIN user u ON u.user_id = t.author_id
    LEFT JOIN forum_post p ON p.topic_id = t.id
    LEFT JOIN user pu ON pu.user_id = p.author_id
    WHERE t.cat_id =2
    ORDER BY p.date DESC
    

     

    Now this is what is returning:

     

    id title sticky locked author lposter

     

    5 Another Topic 0 0 peanut peanut

    3 Another Topic 0 0 peanut draco

    3 Another Topic 0 0 peanut peanut

    2 Testing123 0 0 peanut peanut

     

    However, topic 3 is only suppose to be pulling once as Draco is the last poster... But it's pulling all the posts from it. So I basically need to LIMIT 1 on the pu.username.. Is there a way of doing that??

  2. Ok I'm trying to create a stored function to grab a username based on the user id that is given. My syntax is as follows:

     

    CREATE FUNCTION get_username(user_id BIGINT(20))
    RETURNS VARCHAR(35)
    BEGIN
    DECLARE user_name VARCHAR(35);
    
    
    SELECT username
    INTO user_name
    FROM user
    WHERE user_id = user_id;
    
    
    RETURN(user_name);
    END;
    

     

     

    However, it is saying this error:

    MySQL said: dot.gif

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4

     

    I'm not sure what's wrong with the word DECLARE since it's nesting inside a BEGIN and END statement..

     

    Also, I don't know if anyone knows any other efficient way of doing this so I don't have to create a stored function. I know you can join a user table from a forum post table to grab the username instead, but the thing is I need to grab both the topic username and last post username... but you can only join the user table using either the topic author or the post author... but I need BOTH usernames so I don't have to run two SQL statements.

    Here is my SQL statement for that thus far:

     

    SELECT DISTINCT t.id, t.title, t.sticky, t.locked, u.username
    FROM forum_topic t
    JOIN user u ON u.user_id = t.author_id
    LEFT JOIN forum_post p ON p.topic_id = t.id
    WHERE t.cat_id = 2
    ORDER BY p.date DESC
    

     

    But I also want to grab another username that p.author_id is in AND t.author_id.. I just don't know how to??

     

    Any help on this would be much appreciate. Thank you!

  3. Okay, when this shoutbox runs on my page and I'm going into my inventory and use an item or something and put it in my virtual shop, it puts TWO in or if I stay there for 5 minutes, LOADS of the same item in the shop...

     

    It just keeps redoing my action everytime it reloads the shoutbox..

     

    Here is my code for the shoutbox ON my layout:

    <div id="chat">
       <?
       $checkonline = time() - 1800;
       $online1 = mysql_query("SELECT * FROM login WHERE lastactive >= $checkonline");
       $online2 = mysql_num_rows($online1);
       ?>
       <p style="text-align:center;"><b><? echo $online2; ?></b> Users Online</p>
       <?
       if($clearance >= 4)
       {
       echo '<br /><p style="text-align:center;"><a href="adminsb.php">SB Admin</a></p>';
       }
       if($sbdisablebattle == 'yes' || $sbdisablebreed == 'yes')
       {
        echo '<br /><p style="text-align:center;">Shoutbox disabled whilst breeding or battling.</p>';
       } else {
        echo '<form name="myForm" action="postbox.php" method="post">
    	 <textarea id="message" name="message" wrap="physical" rows="5"
    	 onkeydown="textCounter(document.myForm.message,document.myForm.remLen1,79)"
    	 onkeyup="textCounter(document.myForm.message,document.myForm.remLen1,79)"></textarea>
    
    	 <br />
    	 <div class="clearfix" style="width:100%;">
    	  <input readonly type="text" name="remLen1" maxlength="3" value="79" style="color:#474747;width:15px;background:none;border:none;float:left;font-size:9px;margin-right:2px;">
    	  <span style="font-size:9px;margin-right:6px;float:left;">Characters Left</span>
    	 </div>
    	 <div class="clearfix" style="width:100%;margin-top:-15px;">
    	  <input name="location" id="location" type="hidden" value="'.$url.'" />
    	  <input type="Submit" name="Submit" value="POST" class="button" style="float:right;" />
    	 </div>
        </form>';
       }
       if($usrdet[sbauto] == 'no')
       {
        echo '<br /><p style="text-align:center;"><a href="settings.php?auto=yes">Turn ON Auto SB</a></p>';
       } else {
        echo '<br /><p style="text-align:center;"><a href="settings.php?auto=no">Turn OFF Auto SB</a></p>';
       }
       if($usrdet[sbauto] == 'no')
       {
        $sb = mysql_query("SELECT * FROM sb WHERE blocked = 'no' ORDER BY id DESC LIMIT 15");
        while ($sbresults = mysql_fetch_array( $sb ))
        {
    	 echo '<div class="shoutbox_post fixed_width" style="background-color: '.$sbresults[colour].';">';
    	 echo '<div class="shout_header"><p><img src="#" /><b><a href="http://www.dstable.com/profile.php?name='.$sbresults[user].'">'.$sbresults[user].'</b></a></p></div>';
    
    	 if($clearance >= 7)
    	 {
    	  echo '<sub><a href="admindelsb.php?id='.$sbresults[id].'&act=block&user='.$sbresults[user].'">Block</a> - <a href="admindelsb.php?id='.$sbresults[id].'&act=del&user='.$sbresults[user].'">Delete</a></sub>';
    	 }
    	 echo '<div class="shout_body">'.$sbresults[message].'</div>';
    	 echo '</div>';
        }
       } else {
        echo '
        <script>
    	  $(document).ready(function() {
    	    $("#responsecontainer").load("shout6.php");
    	    var refreshId = setInterval(function() {
    	       $("#responsecontainer").load(\'shout6.php?randval=\'+ Math.random());
    	    }, 9000);
    	    $.ajaxSetup({ cache: false });
    	 });
        </script>
        <div id="responsecontainer">
        </div>
        ';
       }
       ?>
       </div>
    

     

    Then here is the shout6.php page it loads:

     

    <?
    $conn = mysql_pconnect('localhost', 'username', 'password') or die ( header ( 'Location: noconnect.php' ) );
    mysql_select_db('jdstable_dstable', $conn);
    
    
    $sb = mysql_query("SELECT * FROM sb WHERE blocked = 'no' ORDER BY id DESC LIMIT 15");
    while ($sbresults = mysql_fetch_array( $sb ))
    {
    echo '<div class="shoutbox_post fixed_width" style="background-color: '.$sbresults[colour].';">';
    echo '<div class="shout_header clearfix"><p><img src="#" /><b><a href="http://www.dstable.com/profile.php?name='.$sbresults[user].'" style="float:left;">'.$sbresults[user].'</a></b>';
    
    echo '<span style="float:left;margin-left:5px;">';
    if($sbresults[user] == 'Jooshy')
    {echo '<img src="http://www.dstable.com/images/icon_mod.gif"><img src="http://www.dstable.com/images/icon_program.gif">';}
    
    if($sbresults[user] == 'Tim')
    {echo '<img src="http://www.dstable.com/images/icon_mod.gif"><img src="http://www.dstable.com/images/icon_program.gif">';}
    
    
    if($sbresults[user] == 'DracoTarcheInazuma')
    {echo '<img src="http://www.dstable.com/images/icon_staff.gif" width="14" height="14">';}
    
    if($sbresults[user] == 'Nortiker')
    {echo '<img src="http://www.dstable.com/images/icon_mod.gif"><img src="http://www.dstable.com/images/icon_art.gif">';}
    
    if($sbresults[user] == 'Annasaur' || $sbresults[user] == 'Knight')
    {echo '<img src="http://www.dstable.com/images/icon_art.gif">';}
    
    if($sbresults[user] == 'Fenikkusu')
    {echo '<img src="http://www.dstable.com/images/icon_mod2.gif"><img src="http://www.dstable.com/images/icon_writer.gif">';}
    
    if($sbresults[user] == 'Mage')
    {echo '<img src="http://www.dstable.com/images/icon_mod2.gif"><img src="http://www.dstable.com/images/icon_writer.gif">';}
    
    
    if($sbresults[user] == 'Prinx')
    {echo '<img src="http://www.dstable.com/images/icon_mod2.gif"><img src="http://www.dstable.com/images/icon_writer.gif">';}
    
    
    if($sbresults[user] == 'Yakumo')
    {echo '<img src="http://www.dstable.com/images/icon_mod2.gif">';}
    
    
    if($sbresults[user] == 'Thaddeusgrey')
    {echo '<img src="http://www.dstable.com/images/icon_art.gif">';}
    
    
    if($sbresults[user] == 'lilpeanut')
    {echo '<img src="http://www.dstable.com/images/icon_program.gif">';}
    
    
    echo '</span></p></div>';
    if($clearance >= 7)
    {
     echo '<sub><a href="admindelsb.php?id='.$sbresults[id].'&act=block&user='.$sbresults[user].'">Block</a> - <a href="admindelsb.php?id='.$sbresults[id].'&act=del&user='.$sbresults[user].'">Delete</a></sub>';
    }
    echo '<div class="shout_body">'.$sbresults[message].'</div>';
    echo '</div>';
    }
    
    
    ?>
    

     

    Does anyone have any idea why it would be resubmitting the actions over and over again that I'm doing as long as I stay on that page? It just keeps refreshing the page every 3-5 seconds since that is when the shoutbox refreshes?

  4. Okay I'm doing a typical BBCode to HTML converter except that it is converting BBCode from Neopets.. which is different from original BBCode.

    ANYWAY, I have a problem.

    I'll just post the parts that are messing up.

     

    function bb2html($string) {
    $match = array (
    
    '#\[\/font\]#se', 
    '#\[fontc\=(.*?)s\=(.*?)f\=(.*?)\]#se', 
    '#\[fontc\=(.*?)f\=(.*?)s\=(.*?)\]#se', 
    '#\[fonts\=(.*?)c\=(.*?)f\=(.*?)\]#se', 
    '#\[fonts\=(.*?)f\=(.*?)c\=(.*?)\]#se', 
    '#\[fontf\=(.*?)c\=(.*?)s\=(.*?)\]#se', 
    '#\[fontf\=(.*?)s\=(.*?)c\=(.*?)\]#se', 
    '#\[fontc\=(.*?)f\=(.*?)\]#se', 
    '#\[fontc\=(.*?)s\=(.*?)\]#se', 
    '#\[fonts\=(.*?)f\=(.*?)\]#se', 
    '#\[fonts\=(.*?)c\=(.*?)\]#se', 
    '#\[fonts\=(.*?)\]#se', 
    '#\[fontf\=(.*?)\]#se', 
    '#\[fontc\=(.*?)\]#se',
    );
    
    
    $replace = array (
    
    "'</font>'", 
    "'<font color=\'\\1\' size=\'\\2\' face=\'\\3\'>'",
    "'<font color=\'\\1\' face=\'\\2\' size=\'\\3\'>'",
    "'<font size=\'\\1\' color=\'\\2\' face=\'\\3\'>'",
    "'<font size=\'\\1\' face=\'\\2\' color=\'\\3\'>'",
    "'<font face=\'\\1\' color=\'\\2\' size=\'\\3\'>'",
    "'<font face=\'\\1\' size=\'\\2\' color=\'\\3\'>'",
    "'<font color=\'\\1\' face=\'\\2\'>'",
    '<font color=\"\\1\" size=\"\\2\'>"',
    "'<font size=\'\\1\' face=\'\\2\'>'",
    "'<font size=\'\\1\' color=\'\\2\'>'",
    "'<font size=\'\\1\'>'",
    "'<font face=\'\\1\'>'",
    "'<font color=\'\\1\'>'",
    );
    
    return preg_replace($match, $replace, $content);
    }
    
    
    $top_line = '
    [center][fontc=#f1c232][sup]?[/sup]???[br]?[/font][fontc=#000000s=1]neoHTML[/font][fontc=#f1c232f=courier]?[br][';
    $bottom_line = ']?I used to be Rich[sub]?[/sub]?[br]?[br]?[/font]Orange Draik-_-[fontc=#f1c232]??[/font][br][/center]
    ';
    
    $new_top_line = substr($top_line, 0, -1);
    $new_bottom_line = substr($bottom_line, 1);
    
    echo bb2html($new_top_line.$new_bottom_line);
    
    
    

     

    Okay, it's converting everything fine besides when it starts to get to the [fontc=#f1c232] in the very beginning. Since the [fontc=#000000s=1] would be listed first.. in the array.. it replaces those first. SO when it sees the [fontc=#f1c232], it replaces it with the first one that lists [fontc='something'... and doesn't put the ending > bracket on it... because it's expecting the s=1 and f=courier or something...

     

    How do I make it so that if it's ONLY [fontc=#198202], it uses the one that is meant for that and not the very first one? Because it's not putting the ending bracket on it..

  5. $(document).ready(function() {
    var lng = get_url_parameter('long');
    var lat = get_url_parameter('lat');
    if(lng==null && lat==null) {
     var mapOptions = {
      zoom: 8,
      center: new google.maps.LatLng(-34.397, 150.644),
      mapTypeId: google.maps.MapTypeId.ROADMAP
     };
    } else {
     var mapOptions = {
      zoom: 8,
      center: new google.maps.LatLng(lat, lng),
      mapTypeId: google.maps.MapTypeId.ROADMAP
     };
    }
    var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
    });
    

     

    Now when the long and lat parameters in the URL are null, the map loads fine with the preset coordinates. But when the long and lat parameters are passed. For example, this is what I'm passing to the URL right now : long=2277103.99355757&lat=421953.402769517

    It's grabbing the parameters as I did the whole alert(lat); and it alerts the appropriate value.

    However, it won't load the map. It's just a grey block.

    Anyone know the issue here??

  6. Okay I know this error is common. And it's mainly always a syntax problem, but I can not for the life of me figure out what is wrong with my code. I tried putting the getUrlParameter function inside the document.ready() function.. I also tried both of them outside of it.. every possibility you can imagine, I tried. So it has to be something else. I've been staring at it for the past hour or so...

    Maybe a second pair of eyes can help me out here.

     

    <script type="text/javascript">
    function getURLParameter(name) {
     /*var parameter = decodeURI(
    	 (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
     );
    
     if (parameter == null) {
      return null;
     } else {
      return parameter;
     }*/
     name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
       var regexS = "[\\?&]"+name+"=([^]*)";
       var regex = new RegExp( regexS );
       var results = regex.exec( window.location.href );
       if( results == null ) {
      return null;
       } else {
      return results[1];
       }
    }
    $(document).ready(function() {
    var lng = getUrlParameter('long');
    var lat = getUrlParameter('lat');
    if(lng==null && lat==null) {
     var mapOptions = {
      zoom: 8,
      center: new google.maps.LatLng(-34.397, 150.644),
      mapTypeId: google.maps.MapTypeId.ROADMAP
     };
    } else {
     var mapOptions = {
      zoom: 8,
      center: new google.maps.LatLng(lat, lng),
      mapTypeId: google.maps.MapTypeId.ROADMAP
     };
    }
    var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
    });
    </script>
    

     

    Thank you!

  7. My name is Haley. I am available for PHP freelancing work part time around 20 hours per week as I am a college student majoring in Computer Programming and Database.

    I work for Aultman Hospital in North Canton, OH as their web designer/programmer.

     

    I have programmed for many gaming sites including Misticpets (www.misticpets.com, some side work as their coding foundation was quite low quality), Utasia (www.utaisa.net, building from the ground up using the FuelPHP MVC framework with OOP coding standards), and my own site, Elvonica (www.elvonica.com, which is currently on hold due to focusing on freelancing career).

     

    As you can see, I use the FuelPHP MVC framework for larger projects, for smaller projects, I strictly use OOP coding standards in a more modular format.

    Things I do NOT do consists of Paypal integration and anything dealing with shopping carts.

    Otherwise, I'm available for any other features.

     

    I use jQuery in most of my applications to apply ease and high-quality interfacing on the end-user perspective.

    My programming rate typically STARTS at $17/hr (client will cover paypal fees), but most projects can go higher depending on work load and what is needed.

     

    I am also a web designer and have been designing for the past 10 years of my life. You can view my portfolio here : www.intellectproductions.com

    I can provide an attractive clean interface along with strong back-end programming foundation.

     

    My contact information is stated below:

    For my email, please PM me on here first as I do not want to state is publicly to avoid spam or anything like that.

    MSN: tenaciousmug@live.com

    Skype: h_schillig (not on as often)

     

    Thank you.

  8. Okay, I need someone who is very familiar with credit shop related things using Paypal.

    I have a business account and I'm trying to code the paypal script so I can track the transactions.

     

    Anyway, what Paypaltech gives you is VERY old PHP.. It's like PHP 4 or something o_o I am using Judd's PDO wrapper.

    http://development.andrewjudd.ca/

    I need someone who is familiar with both PDO and paypal transactions.

     

    I am asking for help and am paying for some assistance because I can not afford to have bugs/glitches in this area since it's deals with real money of users.. that would be VERY bad. So I'm not going to test my skills out in this area. I need an expert so I can have the comfort of knowing my users will be secure and no glitches will happen during their transactions.

     

    All I'm needing is a drop down where they can select 500 GP, 1000 GP, 1500 GP, etc. The items are NOT purchased through Paypal every single time. They will need to add GP currency to their account so they can then buy items in the cash shop.

     

    Thank you very much!

    If anyone has ever played a gaming site, this will make some more sense with the currency stuff :D

  9. Figured it out. If anyone is curious, here is the solution:

        //removes bbcode
        public function strip_bbcode($string) {
            // All the default bbcode arrays.
                $bbcode = array(
                        //Text Apperence
                        '#\[b\](.*?)\[/b\]#si' => '\\1',
                        '#\[i\](.*?)\[/i\]#si' => '\\1',
                        '#\[u\](.*?)\[/u\]#si' => '\\1',
                        '#\[s\](.*?)\[/s\]#si' => '\\1',
                        '#\[center\](.*?)\[/center\]#si' => '\\1',
                        '#\[right\](.*?)\[/right\]#si' => '\\1',
                        '#\[left\](.*?)\[/left\]#si' => '\\1',
                        //Font Color & Size
                        '#\[color=(.*?)\](.*?)\[/color\]#si' => '\\2',
                        '#\[small\](.*?)\[/small\]#si' => '\\1',
                        '#\[normal\](.*?)\[/normal\]#si' => '\\1',
                        '#\[big\](.*?)\[/big\]#si' => '\\1',
                        '#\[large\](.*?)\[/large\]#si' => '\\1',
                        //Text Effects
                        '#\[bl\](.*?)\[/bl\]#si' => '\\1',
                        '#\[marquee\](.*?)\[/marquee\]#si' => '\\1',
                        //Other
                        '#\[url=(.*?)\](.*?)\[/url]#si' => '\\2',
                        '#\[quote\](.*?)\[/quote\]#si' => '\\1',
                        '#\[img\](.*?)\[/img\]#si' => '\\1'
                );
                $output = preg_replace(array_keys($bbcode), array_values($bbcode), $string);
                return $output;
        }

  10. I'm trying to code a function that strips all BBCodes.. but I'm having trouble with the color since it has =whatever they type... This is how it looks:

        public function strip_bbcode($string) {
            // All the default bbcode arrays.
                $bbcode = array(
                        //Text Apperence
                        '
    [center]' => '',
                        '[/center]
    ' => '',
                        '[b]' => '',
                        '[/b]' => '',
                        '[i]' => '',
                        '[/i]' => '',
                        '[u]' => '',
                        '[/u]' => '',
                        '[s]' => '',
                        '[/s]' => '',
                        '
    [right]' => '',
                        '[/right]
    ' => '',
                        '
    [left]' => '',
                        '[/left]
    ' => '',
                        '[small]' => '',
                        '[/small]' => '',
                        '[normal]' => '',
                        '[/normal]' => '',
                        '[big]' => '',
                        '[/big]' => '',
                        '[large]' => '',
                        '[/large]' => '',
                        '[color=(.*?)]' => '',
                        '[url=(.*?)\](.*?)\[/url]#si' => '\\2',
                        '[img]' => '',
                        '[/img]' => ''
                );
                $output = str_replace(array_keys($bbcode), array_values($bbcode), $string);
                return $output;
        } 

     

    Anyone have any idea on how to do the color and the url?? I just basically want to replace it with emptiness.

  11. Okay I am doing a banking system. I have a deposit and withdraw submit button in the same form.. thing is. When they are entering into the deposit field and hit "enter", it works fine since I guess the deposit is the default submit button. When they fill in the withdraw and hit "enter", it tries to enter for the deposit button.

    I want it when they are on the withdraw input field and hit enter, to submit the "withdraw" button, not the deposit.

     

    How do I go about doing this? I feel like it's something with Javascript or something.

     

    <form action="'.$_SERVER['SCRIPT_NAME'].'" method="post">
    	<div class="row clearfix">
    			<div class="two-row left">
    					<label>Deposit: </label>
    					<input type="text" name="deposit_amt" />
    			</div>
    			<div class="two-row">
    					<label>Withdraw: </label>
    					<input type="text" name="withdraw_amt" />
    			</div>
    	</div>
    	<div class="row clearfix">
    			<div class="two-row left">
    					<input type="hidden" name="account" value="'.$bank['bank_name'].'" />
    					<input type="submit" name="deposit" value="Deposit" class="button" />
    			</div>
    			<div class="two-row">
    					<input type="hidden" name="account" value="'.$bank['bank_name'].'" />
    					<input type="submit" name="withdraw" value="Withdraw" class="button" />
    			</div>
    	</div>
    </form>

     

    I already tried rearranging the form so the deposit button is after the deposit input field and the withdraw button is after the withdraw input field, but it doesnt do anything.

  12. This is my query:

    SELECT i.item_img, i.item_id, i.item_name
                FROM item i
                JOIN user_item u ON u.item_id = i.item_id
                WHERE i.item_function='M' AND u.item_id NOT IN (SELECT u.item_id FROM user_collection WHERE u.user_id=6)

     

    I am trying to select the item details for the items the user has in their inventory, but I DO NOT want to select the ones that are in their collection.

    So I'm trying to say where item_id IS NOT in the user_collection with their user id..

     

    But this is returning an empty result when it should be returning around 5 rows.. it works fine when they have nothing in their collection, but as soon as I put one item in their collection, this query returns nothing.

     

    Help? :)

  13. if($this->color=="Blue" || $this->color=="Green" || $this->color=="Red" || $this->color=="Yellow") {
    return true;
    } else {
    return false;
    }
    

     

    This is returning false, when it should be returning true because $this->color DOES equal "Red"...

    I can NEVER EVER get these conditional things to work UNLESS it's &&, but I even tried:

    !$this->color != "Red" && .........

     

    as well to see if that would work even though that's really confusing.

     

    Can someone help me finally understand this stupid OR stuff?

  14. Well since I couldn't edit my last message, I'll have to post what I'm running into with this whole mysql connection.

     

    <?php
        private $cxn;
        private $numResult;
        private $stmt;
        private $row;
        
        function __construct() { 
            $this->cxn = new mysqli(DB_SERVER, DB_USER, DB_PASS, DB_NAME);
                    //or die('Could not connect to the database.');
        }
    ?>
    

     

    And this is the error I'm getting:

    Fatal error: Class 'mysqli' not found in C:\wamp\www\Elvonica\class\Database.php on line 11

     

    So theeeennn I changed the php.ini file to this:

    ;extension=php_mssql.dll
    extension=php_mysql.dll
    extension=php_mysqli.dll
    ;extension=php_oci8.dll      
    ;extension=php_oci8_11g.dll 
    ;extension=php_openssl.dll

     

    I have both the .dll's enabled.

    And then there is this crazy libmysqli.dll or something you're suppose to put somewhere.. I searched my whole C:/ directory for that file and it didn't find anything. I even searched for "lib" "mysql". Nothing. :/

    Then they said phpinfo(); should have a MySqlI section and I can't find any so I have a feeling I don't even have mysqli extension or something. But when I look under the ext folder in the php folder of WAMP, both files are there and I have them enabled in the php.ini.

     

    So what am I doing wrong? Thank you soooo much for anyone who can help me solve this!!

  15. Fatal error: Call to undefined function mysqli_connect() in C:\wamp\www\Elvonica\class\Database.php on line 11

     

    Huh. I wonder why that is..

    My constructor is fine under my Database class. Am I not connecting properly? I would think it would say "Could not connect to the database" since I have an or die() function.

  16. Wow thank you sooo much for all your help.

    My function now looks like this:

    <?php
        public function select($rows, $table, $where='', $order='', $limit='', $type='', $input='', $result='') {
            $this->stmt = $this->cxn->stmt_init();
    $query = 'SELECT '.$rows.' FROM '.$table;
    if($where != '') {
    	$query .= ' WHERE '.$where;
    }
    if($order != '') {
    	$query .= ' ORDER BY '.$order;
    }
    if($limit != '') {
    	$query .= ' LIMIT '.$limit;
    }
            $this->stmt = $this->stmt->prepare($query);
    if($where != '') {
    	$this->stmt->bind_param($type, $input);
    }
    $this->stmt->execute();
    $this->stmt->bind_result($result);
            $this->stmt->store_result();
    $this->numResult = $this->stmt->num_rows;
    for ($i = 0; $i < $this->numResult; $i++) { // look at when you get up. returning 0 instead of 1!
    	$this->row = $this->stmt->fetch();
    }
            return $this->row;
    return false; //return an error
        }
    ?>
    

     

    Does anyone know why the bind_param is not working. It is giving me this error message:

    Fatal error: Call to a member function bind_param() on a non-object in C:\wamp\www\Elvonica\class\Database.php on line 51

     

    I'm turning my errors on right now. :) Never knew there was an option like that in WAMP.

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