<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Using MySQLi in a Seperate Class</title>
	<atom:link href="http://www.weblimner.com/tutorial/using-mysqli-in-a-seperate-class/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.weblimner.com/tutorial/using-mysqli-in-a-seperate-class/</link>
	<description></description>
	<lastBuildDate>Mon, 12 Sep 2011 14:54:59 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: John</title>
		<link>http://www.weblimner.com/tutorial/using-mysqli-in-a-seperate-class/comment-page-1/#comment-1258</link>
		<dc:creator>John</dc:creator>
		<pubDate>Sun, 11 Sep 2011 12:44:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.weblimner.com/?p=155#comment-1258</guid>
		<description>This is what I was looking for, thanks!</description>
		<content:encoded><![CDATA[<p>This is what I was looking for, thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ali Sipahioglu</title>
		<link>http://www.weblimner.com/tutorial/using-mysqli-in-a-seperate-class/comment-page-1/#comment-445</link>
		<dc:creator>Ali Sipahioglu</dc:creator>
		<pubDate>Fri, 04 Jun 2010 13:04:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.weblimner.com/?p=155#comment-445</guid>
		<description>That looks right</description>
		<content:encoded><![CDATA[<p>That looks right</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Griffo</title>
		<link>http://www.weblimner.com/tutorial/using-mysqli-in-a-seperate-class/comment-page-1/#comment-444</link>
		<dc:creator>Griffo</dc:creator>
		<pubDate>Thu, 03 Jun 2010 20:11:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.weblimner.com/?p=155#comment-444</guid>
		<description>okay i got to work but not sure if it is the right way here it is

members.class.php

class members{   
    public $error;   
    function __construct($mysqli){}   
  
    function get_member($id){   
        global $mysqli;
       if($result = $mysqli-&gt;query(&quot;SELECT* from users WHERE userid=&#039;$id&#039;&quot;)){   
            return $result;   
        }else{   
            $this-&gt;error = $mysqli-&gt;error;   
        }   
  
    }   
}   

users.php

include_once(&quot;afcr-includes/database.php&quot;);
include_once(&quot;afcr-includes/members.class.php&quot;);
$members = new members($mysqli);
$result = $members-&gt;get_member(&#039;b513273941c5302ecfdbcce45a143b94&#039;);
echo &#039;The data set has: &#039;.$result-&gt;num_rows.&#039; user(s).&#039;;
while ($row = $result-&gt;fetch_object()) {
    echo &quot;User Name: &quot; .$row-&gt;username.&quot;&quot; .
         &quot;First Name: &quot;.$row-&gt;name.&quot;&quot; .
         &quot;Last Name: &quot;.$row-&gt;lastname.&quot;&quot;;
  }


thanks for the help</description>
		<content:encoded><![CDATA[<p>okay i got to work but not sure if it is the right way here it is</p>
<p>members.class.php</p>
<p>class members{<br />
    public $error;<br />
    function __construct($mysqli){}   </p>
<p>    function get_member($id){<br />
        global $mysqli;<br />
       if($result = $mysqli-&gt;query(&#8220;SELECT* from users WHERE userid=&#8217;$id&#8217;&#8221;)){<br />
            return $result;<br />
        }else{<br />
            $this-&gt;error = $mysqli-&gt;error;<br />
        }   </p>
<p>    }<br />
}   </p>
<p>users.php</p>
<p>include_once(&#8220;afcr-includes/database.php&#8221;);<br />
include_once(&#8220;afcr-includes/members.class.php&#8221;);<br />
$members = new members($mysqli);<br />
$result = $members-&gt;get_member(&#8216;b513273941c5302ecfdbcce45a143b94&#8242;);<br />
echo &#8216;The data set has: &#8216;.$result-&gt;num_rows.&#8217; user(s).&#8217;;<br />
while ($row = $result-&gt;fetch_object()) {<br />
    echo &#8220;User Name: &#8221; .$row-&gt;username.&#8221;" .<br />
         &#8220;First Name: &#8220;.$row-&gt;name.&#8221;" .<br />
         &#8220;Last Name: &#8220;.$row-&gt;lastname.&#8221;";<br />
  }</p>
<p>thanks for the help</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ali Sipahioglu</title>
		<link>http://www.weblimner.com/tutorial/using-mysqli-in-a-seperate-class/comment-page-1/#comment-443</link>
		<dc:creator>Ali Sipahioglu</dc:creator>
		<pubDate>Thu, 03 Jun 2010 13:07:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.weblimner.com/?p=155#comment-443</guid>
		<description>try $result = $users-&gt;get_user(&#039;b513273941c5302ecfdbcce45a143b94&#039;)

instead of $result-&gt;get_user(‘b513273941c5302ecfdbcce45a143b94′);</description>
		<content:encoded><![CDATA[<p>try $result = $users->get_user(&#8216;b513273941c5302ecfdbcce45a143b94&#8242;)</p>
<p>instead of $result->get_user(‘b513273941c5302ecfdbcce45a143b94′);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Griffo</title>
		<link>http://www.weblimner.com/tutorial/using-mysqli-in-a-seperate-class/comment-page-1/#comment-442</link>
		<dc:creator>Griffo</dc:creator>
		<pubDate>Thu, 03 Jun 2010 02:35:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.weblimner.com/?p=155#comment-442</guid>
		<description>users.php

include_once(&quot;afcr-includes/database.php&quot;);
include_once(&quot;afcr-includes/members.class.php&quot;);
$users = new users($mysqli);
$result-&gt;get_user(&#039;b513273941c5302ecfdbcce45a143b94&#039;);
echo &#039;The users table has: &#039;.$result-&gt;num_rows.&#039; users.&#039;;
while ($row = $result-&gt;fetch_object()) {
echo &quot;&quot;.
        &quot;&quot;.
            &quot;&quot;.
                 &quot;User Name:&quot;.
            &quot;&quot;.
            &quot;&quot;.
                 &quot;First Name:&quot;.
            &quot;&quot;.
            &quot;&quot;.
                 &quot;Last Name:&quot;.
            &quot;&quot;.
            &quot;&quot;.
                 &quot;Email:&quot;.
            &quot;&quot;.
            &quot;&quot;.
                 &quot;Password:&quot;.
            &quot;&quot;.
        &quot;&quot;.
        &quot;&quot;.
        &quot;&quot;.
            $row-&gt;username.
        &quot;&quot;.
        &quot;&quot;.
            $row-&gt;name.
        &quot;&quot;.
        &quot;&quot;.
            $row-&gt;lastname.
        &quot;&quot;.
        &quot;&quot;.
            $row-&gt;email.
        &quot;&quot;.
        &quot;&quot;.
            $row-&gt;password.
        &quot;&quot;.
        &quot;&quot;.
        &quot;&quot;;
}

error received:
Fatal error: Call to a member function get_user() on a non-object in C:\Sites\AllFlorida\testsite.com\site\web\users.php on line 5</description>
		<content:encoded><![CDATA[<p>users.php</p>
<p>include_once(&#8220;afcr-includes/database.php&#8221;);<br />
include_once(&#8220;afcr-includes/members.class.php&#8221;);<br />
$users = new users($mysqli);<br />
$result-&gt;get_user(&#8216;b513273941c5302ecfdbcce45a143b94&#8242;);<br />
echo &#8216;The users table has: &#8216;.$result-&gt;num_rows.&#8217; users.&#8217;;<br />
while ($row = $result-&gt;fetch_object()) {<br />
echo &#8220;&#8221;.<br />
        &#8220;&#8221;.<br />
            &#8220;&#8221;.<br />
                 &#8220;User Name:&#8221;.<br />
            &#8220;&#8221;.<br />
            &#8220;&#8221;.<br />
                 &#8220;First Name:&#8221;.<br />
            &#8220;&#8221;.<br />
            &#8220;&#8221;.<br />
                 &#8220;Last Name:&#8221;.<br />
            &#8220;&#8221;.<br />
            &#8220;&#8221;.<br />
                 &#8220;Email:&#8221;.<br />
            &#8220;&#8221;.<br />
            &#8220;&#8221;.<br />
                 &#8220;Password:&#8221;.<br />
            &#8220;&#8221;.<br />
        &#8220;&#8221;.<br />
        &#8220;&#8221;.<br />
        &#8220;&#8221;.<br />
            $row-&gt;username.<br />
        &#8220;&#8221;.<br />
        &#8220;&#8221;.<br />
            $row-&gt;name.<br />
        &#8220;&#8221;.<br />
        &#8220;&#8221;.<br />
            $row-&gt;lastname.<br />
        &#8220;&#8221;.<br />
        &#8220;&#8221;.<br />
            $row-&gt;email.<br />
        &#8220;&#8221;.<br />
        &#8220;&#8221;.<br />
            $row-&gt;password.<br />
        &#8220;&#8221;.<br />
        &#8220;&#8221;.<br />
        &#8220;&#8221;;<br />
}</p>
<p>error received:<br />
Fatal error: Call to a member function get_user() on a non-object in C:\Sites\AllFlorida\testsite.com\site\web\users.php on line 5</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Griffo</title>
		<link>http://www.weblimner.com/tutorial/using-mysqli-in-a-seperate-class/comment-page-1/#comment-441</link>
		<dc:creator>Griffo</dc:creator>
		<pubDate>Thu, 03 Jun 2010 02:33:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.weblimner.com/?p=155#comment-441</guid>
		<description>members.class.php

  
class users{   
    public $error;   
    function __construct($mysqli){}   
  
    function get_user($id){   
        global $mysqli;   
  if ($result = $mysqli-&gt;query(&quot;SELECT * FROM users WHERE userid=&#039;$id&#039;&quot;)) {
return $row;
} else {
echo $mysqli-&gt;error;
}
$mysqli-&gt;close();     
            
} 
}</description>
		<content:encoded><![CDATA[<p>members.class.php</p>
<p>class users{<br />
    public $error;<br />
    function __construct($mysqli){}   </p>
<p>    function get_user($id){<br />
        global $mysqli;<br />
  if ($result = $mysqli-&gt;query(&#8220;SELECT * FROM users WHERE userid=&#8217;$id&#8217;&#8221;)) {<br />
return $row;<br />
} else {<br />
echo $mysqli-&gt;error;<br />
}<br />
$mysqli-&gt;close();     </p>
<p>}<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Griffo</title>
		<link>http://www.weblimner.com/tutorial/using-mysqli-in-a-seperate-class/comment-page-1/#comment-440</link>
		<dc:creator>Griffo</dc:creator>
		<pubDate>Thu, 03 Jun 2010 02:32:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.weblimner.com/?p=155#comment-440</guid>
		<description>database.php

include_once(&quot;config.php&quot;);
$mysqli = new mysqli(SERVER, USER, PASS, DBNAME);
if (mysqli_connect_errno()) { 
    printf(&quot;Connect failed: %s\n&quot;, mysqli_connect_error()); 
    exit(); 
}</description>
		<content:encoded><![CDATA[<p>database.php</p>
<p>include_once(&#8220;config.php&#8221;);<br />
$mysqli = new mysqli(SERVER, USER, PASS, DBNAME);<br />
if (mysqli_connect_errno()) {<br />
    printf(&#8220;Connect failed: %s\n&#8221;, mysqli_connect_error());<br />
    exit();<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Griffo</title>
		<link>http://www.weblimner.com/tutorial/using-mysqli-in-a-seperate-class/comment-page-1/#comment-439</link>
		<dc:creator>Griffo</dc:creator>
		<pubDate>Thu, 03 Jun 2010 02:31:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.weblimner.com/?p=155#comment-439</guid>
		<description>the last reply dropped some stuff so here it is again
I am still having problems this is what i have so far

database.php
</description>
		<content:encoded><![CDATA[<p>the last reply dropped some stuff so here it is again<br />
I am still having problems this is what i have so far</p>
<p>database.php</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Griffo</title>
		<link>http://www.weblimner.com/tutorial/using-mysqli-in-a-seperate-class/comment-page-1/#comment-438</link>
		<dc:creator>Griffo</dc:creator>
		<pubDate>Thu, 03 Jun 2010 02:27:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.weblimner.com/?p=155#comment-438</guid>
		<description>I am still having problems this is what i have so far

database.php


members.class.php

query(&quot;SELECT * FROM users WHERE userid=&#039;$id&#039;&quot;)) {
return $row;
} else {
echo $mysqli-&gt;error;
}
$mysqli-&gt;close();     
            
} 
}
?&gt; 

users.php

 get_user(&#039;b513273941c5302ecfdbcce45a143b94&#039;);
echo &#039;The users table has: &#039;.$result-&gt;num_rows.&#039; users.&#039;;
while ($row = $result-&gt;fetch_object()) {
echo &quot;&quot;.
        &quot;&quot;.
            &quot;&quot;.
                 &quot;User Name:&quot;.
            &quot;&quot;.
            &quot;&quot;.
                 &quot;First Name:&quot;.
            &quot;&quot;.
            &quot;&quot;.
                 &quot;Last Name:&quot;.
            &quot;&quot;.
            &quot;&quot;.
                 &quot;Email:&quot;.
            &quot;&quot;.
            &quot;&quot;.
                 &quot;Password:&quot;.
            &quot;&quot;.
        &quot;&quot;.
        &quot;&quot;.
        &quot;&quot;.
            $row-&gt;username.
        &quot;&quot;.
        &quot;&quot;.
            $row-&gt;name.
        &quot;&quot;.
        &quot;&quot;.
            $row-&gt;lastname.
        &quot;&quot;.
        &quot;&quot;.
            $row-&gt;email.
        &quot;&quot;.
        &quot;&quot;.
            $row-&gt;password.
        &quot;&quot;.
        &quot;&quot;.
        &quot;&quot;;
}
?&gt;

I get the following errors:


Fatal error: Call to a member function get_user() on a non-object in C:\Sites\AllFlorida\testsite.com\site\web\users.php on line 5.

I have been trying to get this to work for 2 days and i cant find anything on the internet
thanks</description>
		<content:encoded><![CDATA[<p>I am still having problems this is what i have so far</p>
<p>database.php</p>
<p>members.class.php</p>
<p>query(&#8220;SELECT * FROM users WHERE userid=&#8217;$id&#8217;&#8221;)) {<br />
return $row;<br />
} else {<br />
echo $mysqli-&gt;error;<br />
}<br />
$mysqli-&gt;close();     </p>
<p>}<br />
}<br />
?&gt; </p>
<p>users.php</p>
<p> get_user(&#8216;b513273941c5302ecfdbcce45a143b94&#8242;);<br />
echo &#8216;The users table has: &#8216;.$result-&gt;num_rows.&#8217; users.&#8217;;<br />
while ($row = $result-&gt;fetch_object()) {<br />
echo &#8220;&#8221;.<br />
        &#8220;&#8221;.<br />
            &#8220;&#8221;.<br />
                 &#8220;User Name:&#8221;.<br />
            &#8220;&#8221;.<br />
            &#8220;&#8221;.<br />
                 &#8220;First Name:&#8221;.<br />
            &#8220;&#8221;.<br />
            &#8220;&#8221;.<br />
                 &#8220;Last Name:&#8221;.<br />
            &#8220;&#8221;.<br />
            &#8220;&#8221;.<br />
                 &#8220;Email:&#8221;.<br />
            &#8220;&#8221;.<br />
            &#8220;&#8221;.<br />
                 &#8220;Password:&#8221;.<br />
            &#8220;&#8221;.<br />
        &#8220;&#8221;.<br />
        &#8220;&#8221;.<br />
        &#8220;&#8221;.<br />
            $row-&gt;username.<br />
        &#8220;&#8221;.<br />
        &#8220;&#8221;.<br />
            $row-&gt;name.<br />
        &#8220;&#8221;.<br />
        &#8220;&#8221;.<br />
            $row-&gt;lastname.<br />
        &#8220;&#8221;.<br />
        &#8220;&#8221;.<br />
            $row-&gt;email.<br />
        &#8220;&#8221;.<br />
        &#8220;&#8221;.<br />
            $row-&gt;password.<br />
        &#8220;&#8221;.<br />
        &#8220;&#8221;.<br />
        &#8220;&#8221;;<br />
}<br />
?&gt;</p>
<p>I get the following errors:</p>
<p>Fatal error: Call to a member function get_user() on a non-object in C:\Sites\AllFlorida\testsite.com\site\web\users.php on line 5.</p>
<p>I have been trying to get this to work for 2 days and i cant find anything on the internet<br />
thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ali Sipahioglu</title>
		<link>http://www.weblimner.com/tutorial/using-mysqli-in-a-seperate-class/comment-page-1/#comment-437</link>
		<dc:creator>Ali Sipahioglu</dc:creator>
		<pubDate>Wed, 02 Jun 2010 20:13:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.weblimner.com/?p=155#comment-437</guid>
		<description>you could create a get_books() function kinda similar to the get_book() function i created and then return the resultset and then you can loop through it with a while loop like; 

     while ($row = $result-&gt;fetch_row()) {
          printf(&quot;%s\n&quot;, $row[0]);
     }</description>
		<content:encoded><![CDATA[<p>you could create a get_books() function kinda similar to the get_book() function i created and then return the resultset and then you can loop through it with a while loop like; </p>
<p>     while ($row = $result->fetch_row()) {<br />
          printf(&#8220;%s\n&#8221;, $row[0]);<br />
     }</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)
Object Caching 396/406 objects using disk

Served from: www.weblimner.com @ 2012-02-06 03:42:43 -->
