473,708 Members | 2,363 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Confused by mysqli

Okay, background... yes, I am another of those evil, spurned, damnable
Perl mongers, but I'm not trying to start a flamewar, I'm juust tryung
to understand something...

I can write a script in Perl like so, and it's pretty to me (and the
using of the heredocs I think does defend perl against many arguments
withthe HTML being all escaped and explicit returns and stuff -- which
I can see... 'print "<p class=\"text\"> stuff</p>\n";' is terrible to
me to.. so I use heredocs), and simple, and fast under mod_perl...

....but I don't want my horizons limited so I wan to work out how to do
it in PHP:

#!/usr/bin/perl
use strict;

use CGI;
use DBI;

sub notLoggedIn();

my $cgi = new CGI;
print $cgi->header;
my $sessionid = $cgi->cookie('sessio n');

notLoggedIn unless $sessionid;
my $dbh = DBI->connect('DBI:m ysql:session',' user','password ');

my $get_session_st = <<"EOF";
SELECT *
FROM session
WHERE id = ?
EOF
my $get_session = $dbh->prepare($get_s ession_st);
$get_session->execute($sessi onid);

my $session;
$session = $get_session->fetchrow_hashr ef or notLoggedIn;
$get_session->finish;

for my $k (keys %{$session}) {
$ENV{"SESSION_" .uc($k)} = $session->{$v};
}

print <<"EOF";
<!--#include virtual="/includes/page_header.sht ml"-->
<p>You are logged in.</p>
<p>Here's your session data...</p>
<table>
EOF

while (my ($k, $v) = each %ENV) {
print <<"EOF" if $k =~ /^SESSION_/;
<tr>
<td>$k</td>
<td>$v</td>
</tr>
EOF
}

print <<"EOF";
</table>
<!--#include virtual="/includes/page_footer.sht ml"-->
EOF

sub notLoggedIn () {
print <<"EOF" and exit;
<!--#include virtual="/includes/page_header.sht ml"-->
<p>Sorry, you are not logged in.</p>
<!--#include virtual="/includes/page_footer.sht ml"-->
EOF
}
this whole thing is pretty simple. But anyway...
>From what I can see, the normal construct in the Perl DBI as seen above
is a bit hard to figure out in PHP...

To restate the perl bit and modify to a more-than-one-off- result
set... using that wunnerful cities example people love:

use DBI;
my $dbh = DBI->connect('DBI:m ysql:database', 'user','passwor d')
or die "Can't connect to database: $DBI::errstr\n" ;

my $query = <<"EOF";
SELECT *
FROM cities
WHERE Country = ?
EOF

my $statement = $dbh->prepare($query );
$statement->execute('USA') ;

my @cities;
while (my $city = $statement->fetchrow_hashr ef) {
push @cities, $city;
}

for my $city (@cities) {
# do stuff over each city... keys of hashref are same as
# column names in table
}

I don't want to, and don't think I *can* use the query() method in PHP
off a mysqli object because I need placeholders. The documentation
makes no indication that I can find that query() (which seems to
combine prepare and execute, but doesn't seem to do so exactly) can use
placeholders. All the placeholder examples say to use prepare and
execute, as well as bind_params However I also do not know the names of
the things I'm getting back -- fetchrow_hashre f() in Perl DBI basically
returns an associative array (though couched under a reference).

I can get things back using fetch() after prepare, execute, and
store_result -- though the last of these seems kind of silly to me --
should be automatic.

But if I try to use fetch_row() or fetch_assoc(), I get PHP Fatal
Error: Call to undefined method mysqli_stmt::fe tch_row() -- though the
documentation seems to indicate I should be able to do this...
>From what the docs say, the direct translation of the perl that I can
write while asleep (fact, not embellishment, as I have in fact done so
and it's damned annoying to get Perl in a dream when you were hoping
for a Suicide Girl...) , seems like it should be:

$dbh = new mysqli('localho st','user','pas sword','databas e');
if ($err = mysqli_connect_ errno()) {
print "Connect failed: $err";
exit();
}

$query = <<<EOF
SELECT *
FROM cities
WHERE Country = ?
EOF;

$statement = $dbh->prepare($query );
$statement->bind_param('US A');
$statement->execute();
$statement->store_result() ;

$cities = array();
$i = 0;
while ($city = $statement->fetch_assoc( )) {
$cities[$i] = $city;
$i++;
}

foreach ($cities as $k =$v) {
# do stuff over each city... keys of hashref are same as
# column names in table
}

But it doesn't work. I get that messed up error string that says the
fetch_assoc() method doesn't exist...

So I'm driven to the point of posting to usenet and writing all that
out, despite those three Perl programmer virtues that otherwise fill my
lazy, hubristic and impatient being (they're supposed to do so--ask
Larry Wall).

So can someone tell me what I'm doing totally wrong?
I almost thing this would be easier if it were *nothing* like Perl,
instead of feeling to me like I'm writing something in some strange
perl that was written in a universe a few over in Sliders...

--
Dodger

Jul 5 '06 #1
26 4687
Rik
Dodger wrote:
$dbh = new mysqli('localho st','user','pas sword','databas e');
if ($err = mysqli_connect_ errno()) {
print "Connect failed: $err";
exit();
}

$query = <<<EOF
SELECT *
FROM cities
WHERE Country = ?
EOF;
$statement = $dbh->prepare($query );
$statement->bind_param('US A');
$statement->execute();
$statement->store_result() ;
$cities = array();
$i = 0;
while ($city = $statement->fetch_assoc( )) {
$cities[$i] = $city;
$i++;
}
mysqli_stmt_fet ch_assoc doesn't exist, mysqli_stmt_fet ch does.

$statement->bind_results($ city);
while ($statement->fetch()) {
$cities[] = $city;
}

Look at the example at
http://www.php.net/manual/en/functio...ind-result.php

Grtz,
--
Rik Wasmus
Jul 5 '06 #2
In article <11************ **********@a14g 2000cwb.googleg roups.com>,
"Dodger" <el********@gma il.comwrote:
$dbh = new mysqli('localho st','user','pas sword','databas e');
if ($err = mysqli_connect_ errno()) {
print "Connect failed: $err";
exit();
}

$query = <<<EOF
SELECT *
FROM cities
WHERE Country = ?
EOF;

$statement = $dbh->prepare($query );
$statement->bind_param('US A');
$statement->execute();
$statement->store_result() ;

$cities = array();
$i = 0;
while ($city = $statement->fetch_assoc( )) {
$cities[$i] = $city;
$i++;
}

foreach ($cities as $k =$v) {
# do stuff over each city... keys of hashref are same as
# column names in table
}

But it doesn't work. I get that messed up error string that says the
fetch_assoc() method doesn't exist...
I've not used "mysqli", but doing the above in mysql:

<?
$db = mysql_connect(" host", "user", "password") ;

$q = mysql_query("se lect * from cities where country = 'USA'");
while ($r = mysql_fetch_ass oc()){
$cities[] = $r["city"];
}

foreach ($cities as $city){
# Do stuff
}
?>
Why the extra foreach? Just "do stuff" in the mysql while loop.

--
Sandman[.net]
Jul 5 '06 #3
Dodger wrote:
[snip]
>
$query = <<<EOF
SELECT *
FROM cities
WHERE Country = ?
EOF;

$statement = $dbh->prepare($query );
$statement->bind_param('US A');
$statement->execute();
$statement->store_result() ;

$cities = array();
$i = 0;
while ($city = $statement->fetch_assoc( )) {
$cities[$i] = $city;
$i++;
}
The store->result() method returns a mysqli_result type.
You need to use the mysqli_type for the fetch_assoc() method.

So your code would look like:

$statement->execute();
$result = $statement->store_result() ;

$cities = array();
while( $city = $result->fetch_assoc( ) ) {
$cities[] = $city; // you don't need to supply the $i++ index this way
}
$result->free(); // don't forget to free the result memory

-david-

Jul 5 '06 #4

Sandman wrote:
In article <11************ **********@a14g 2000cwb.googleg roups.com>,
"Dodger" <el********@gma il.comwrote:
I've not used "mysqli", but doing the above in mysql:

<?
$db = mysql_connect(" host", "user", "password") ;

$q = mysql_query("se lect * from cities where country = 'USA'");
while ($r = mysql_fetch_ass oc()){
$cities[] = $r["city"];
}

foreach ($cities as $city){
# Do stuff
}
?>
Well, I do need bind variables. In the non-mysqli example up there, the
country is hardcoded into the statement. Even if I filled that in with
a variable, what if it was a variable that was passed in by a user? It
would be too easy to hack and would end up either potentially crippling
things or with an arms race between me and some l33+ haxcsore wanker
whi thinks he's clever.
Why the extra foreach? Just "do stuff" in the mysql while loop.
Could be plenty of reasons. In the example up top, I am populating the
environment (%ENV in Perl, $_ENV in PHP) with my special session
variables (and yes, I know PHP has session handling systems, but I'm
not gonna use them because I want stuff to work in *both* Perl and PHP
CGIs* -- I might be populating some other SESSION_* environment
variables elsewhere, for instance.

But it was an illustration of having a populated data structure,
mostly.
--
Dodger
*Yes, both are CGIs. Both use Common Gateway Interface. <-- Pet Peeve
when people think CGI is, like, a language or something. It's just a
protocol for handing off variables, and *all* web stuff uses it by
default (yeah some weird stuff takes it by rewriting other things,
but...)

Jul 5 '06 #5

Rik wrote:
Dodger wrote:
mysqli_stmt_fet ch_assoc doesn't exist, mysqli_stmt_fet ch does.
http://us2.php.net/manual/en/functio...etch-assoc.php
Not stmt_fetch_asso c, just fetch_assoc...
$statement->bind_results($ city);
while ($statement->fetch()) {
$cities[] = $city;
}
Look at the example at
http://www.php.net/manual/en/functio...ind-result.php
Thanks, but that's the problem...

I can't use vars named $col1, $col2, etc. I need names -- preferably as
keys in an associative array... I'm selecintg * -- there could be a
number of reasons that table might have differing numbers of columns --
for instance if I am selecting which table touse dynamically, and my
session tables consider different things important to hold in a SQL
fast lookup table... consider if I have one site that's a subscription
site and another that's a web stire. The subscription site might want
to have 'SESSION_SUBSCR IBED' as a session variable, while the store
might want to have 'SESSION_STORED _CCARD_REF' as a session variable,
where neither would be useful to the other. This way as long as they
both have an 'id' column, it's fine.

I actually do this. I have one site where I plugged in (shuddering as I
type this because the code is atrocious...) PostNuke with PnPHPBB forum
system, but I hacked it so that I can share my own session system with
the PostNuke one... there are five extra session variables, including
SESSION_PN_UID, SESSION_PHPBB_U ID, and so on that Perl drops into the
environment, so that, for instance, a Perl script can check and popup
if they have new IMs...

Jul 5 '06 #6
Dodger wrote:
Okay, background... yes, I am another of those evil, spurned, damnable
Perl mongers, but I'm not trying to start a flamewar, I'm juust tryung
to understand something...

I can write a script in Perl like so, and it's pretty to me (and the
using of the heredocs I think does defend perl against many arguments
withthe HTML being all escaped and explicit returns and stuff -- which
I can see... 'print "<p class=\"text\"> stuff</p>\n";' is terrible to
me to.. so I use heredocs), and simple, and fast under mod_perl...

...but I don't want my horizons limited so I wan to work out how to do
it in PHP:

#!/usr/bin/perl
use strict;

use CGI;
use DBI;

sub notLoggedIn();

my $cgi = new CGI;
print $cgi->header;
my $sessionid = $cgi->cookie('sessio n');

notLoggedIn unless $sessionid;
my $dbh = DBI->connect('DBI:m ysql:session',' user','password ');

my $get_session_st = <<"EOF";
SELECT *
FROM session
WHERE id = ?
EOF
my $get_session = $dbh->prepare($get_s ession_st);
$get_session->execute($sessi onid);

my $session;
$session = $get_session->fetchrow_hashr ef or notLoggedIn;
$get_session->finish;

for my $k (keys %{$session}) {
$ENV{"SESSION_" .uc($k)} = $session->{$v};
}

print <<"EOF";
<!--#include virtual="/includes/page_header.sht ml"-->
<p>You are logged in.</p>
<p>Here's your session data...</p>
<table>
EOF

while (my ($k, $v) = each %ENV) {
print <<"EOF" if $k =~ /^SESSION_/;
<tr>
<td>$k</td>
<td>$v</td>
</tr>
EOF
}

print <<"EOF";
</table>
<!--#include virtual="/includes/page_footer.sht ml"-->
EOF

sub notLoggedIn () {
print <<"EOF" and exit;
<!--#include virtual="/includes/page_header.sht ml"-->
<p>Sorry, you are not logged in.</p>
<!--#include virtual="/includes/page_footer.sht ml"-->
EOF
}
this whole thing is pretty simple. But anyway...
>>From what I can see, the normal construct in the Perl DBI as seen above
is a bit hard to figure out in PHP...

To restate the perl bit and modify to a more-than-one-off- result
set... using that wunnerful cities example people love:

use DBI;
my $dbh = DBI->connect('DBI:m ysql:database', 'user','passwor d')
or die "Can't connect to database: $DBI::errstr\n" ;

my $query = <<"EOF";
SELECT *
FROM cities
WHERE Country = ?
EOF

my $statement = $dbh->prepare($query );
$statement->execute('USA') ;

my @cities;
while (my $city = $statement->fetchrow_hashr ef) {
push @cities, $city;
}

for my $city (@cities) {
# do stuff over each city... keys of hashref are same as
# column names in table
}

I don't want to, and don't think I *can* use the query() method in PHP
off a mysqli object because I need placeholders. The documentation
makes no indication that I can find that query() (which seems to
combine prepare and execute, but doesn't seem to do so exactly) can use
placeholders. All the placeholder examples say to use prepare and
execute, as well as bind_params However I also do not know the names of
the things I'm getting back -- fetchrow_hashre f() in Perl DBI basically
returns an associative array (though couched under a reference).
Yes, it combines prepare and execute. you could, for instance, build
your query string dynamically, i.e.

mysql_query("SE LECT * FROM cities WHERE Country = '$country'");

Or, you can use the stmt member of mysqli, i.e.

$stmt = $mysqli->stmt_init();
if ($stmt->prepare(""SELE CT * FROM cities WHERE Country = ?")) {
$stmt->bind_param("s" , "USA");
$stmt->execute();
}

I can get things back using fetch() after prepare, execute, and
store_result -- though the last of these seems kind of silly to me --
should be automatic.
Actually, this is normal operation in almost any language with almost
any dataset. The database returns a result set; you need to retrieve
each row from the result set. The fact you *don't* have to do this seems
to be almost unique to the Perl::DBI module (I don't do Perl, so I'm not
familiar with it). But I suspect this module just fetches the data for
you, and the basic interface between Perl and MySQL doesn't do it.
But if I try to use fetch_row() or fetch_assoc(), I get PHP Fatal
Error: Call to undefined method mysqli_stmt::fe tch_row() -- though the
documentation seems to indicate I should be able to do this...
It is valid. But it can be confusing.
>>From what the docs say, the direct translation of the perl that I can
write while asleep (fact, not embellishment, as I have in fact done so
and it's damned annoying to get Perl in a dream when you were hoping
for a Suicide Girl...) , seems like it should be:

$dbh = new mysqli('localho st','user','pas sword','databas e');
if ($err = mysqli_connect_ errno()) {
print "Connect failed: $err";
exit();
}

$query = <<<EOF
SELECT *
FROM cities
WHERE Country = ?
EOF;

$statement = $dbh->prepare($query );
$statement->bind_param('US A');
$statement->execute();
$statement->store_result() ;

$cities = array();
$i = 0;
while ($city = $statement->fetch_assoc( )) {
$cities[$i] = $city;
$i++;
}

foreach ($cities as $k =$v) {
# do stuff over each city... keys of hashref are same as
# column names in table
}

But it doesn't work. I get that messed up error string that says the
fetch_assoc() method doesn't exist...
Ah, fetch_assoc() is a member of mysqli_result, and you're trying to
call it from a mysqli_stmt object. The function doesn't exist in
mysqli_stmt.

Rather, you should bind variables to the results and fetch the
variables, i.e.

$statement->execute();
$statement->bind_result($c ity);

while ($statement->fetch()) {
$cities[] = $city; // Automatically adds it to the end
}

$stmt->close();
So I'm driven to the point of posting to usenet and writing all that
out, despite those three Perl programmer virtues that otherwise fill my
lazy, hubristic and impatient being (they're supposed to do so--ask
Larry Wall).

So can someone tell me what I'm doing totally wrong?
I almost thing this would be easier if it were *nothing* like Perl,
instead of feeling to me like I'm writing something in some strange
perl that was written in a universe a few over in Sliders...
You're close, just a little more understanding of the different classes.
But it is confusing, especially to the new PHP programmer.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jul 5 '06 #7
Dodger wrote:
Okay, background... yes, I am another of those evil, spurned, damnable
Perl mongers, but I'm not trying to start a flamewar, I'm juust tryung
to understand something...
Hi Dodger,

Other helped you with the msql part, but I want to make 1 remark on your
next comment:
>
I can write a script in Perl like so, and it's pretty to me (and the
using of the heredocs I think does defend perl against many arguments
withthe HTML being all escaped and explicit returns and stuff -- which
I can see... 'print "<p class=\"text\"> stuff</p>\n";' is terrible to
me to.. so I use heredocs), and simple, and fast under mod_perl...
Only people who like to write unreadable code use syntax like that.
consider:
print "<p class=\"text\"> stuff</p>\n";
and
<p class="text">st uff</p>

The latter is the usual normal way if you first jump out of the PHP-tags,
which every experienced PHP-coder with a sane mind does, for sake of
readability.
If you need to jump back to get some variable, do this:
[just an example that uses ADODB-lib.]

<table>
<tr>
<td>
userid
</td>
<td>
firstname
</td>
<td>
lastname
</td>
</tr>

<?php
$SQL = "SELECT userid, firstname, lastname FROM tbluser;";
$RS = $con->Execute($SQL )->getArray;
for($i=0;$i<cou nt($RS);$i++){
$row = $RS[$i];
?>
<tr>
<td>
<?php= $row["userid"] ?>
</td>
<td>
<?php= $row["firstname"] ?>
</td>
<td>
<?php= $row["lastname"] ?>
</td>
</tr>

<?php
}
?>
</table>
I think that makes great readable code, both from a HTML perspective as from
a PHP perspective.
Don't use print and echo for HTML, unless you have some compelling reason.

just my 2 cent.

Regards,
Erwin Moller

Jul 5 '06 #8

David Haynes wrote:
Dodger wrote:
[snip]
The store->result() method returns a mysqli_result type.
You need to use the mysqli_type for the fetch_assoc() method.
Thank you!

Though pardon my saying that that's weird as snake shoes...
Result objects... *blinks*
$cities = array();
while( $city = $result->fetch_assoc( ) ) {
$cities[] = $city; // you don't need to supply the $i++ index this way
}
I think ... I think I'm gonna end up writing function push {} -- to
preserve my sanity by doing that bit elsewhere hidden away...
$result->free(); // don't forget to free the result memory
Is there a way to lexically scope things, something like my() in
Perl... so the garbage handling bit can be taken care of automagically
when things fall out of scope?

Jul 5 '06 #9

Erwin Moller wrote:
Dodger wrote:
Okay, background... yes, I am another of those evil, spurned, damnable
Perl mongers, but I'm not trying to start a flamewar, I'm juust tryung
to understand something...

Hi Dodger,

Other helped you with the msql part, but I want to make 1 remark on your
next comment:

I can write a script in Perl like so, and it's pretty to me (and the
using of the heredocs I think does defend perl against many arguments
withthe HTML being all escaped and explicit returns and stuff -- which
I can see... 'print "<p class=\"text\"> stuff</p>\n";' is terrible to
me to.. so I use heredocs), and simple, and fast under mod_perl...

Only people who like to write unreadable code use syntax like that.
consider:
print "<p class=\"text\"> stuff</p>\n";
and
<p class="text">st uff</p>

The latter is the usual normal way if you first jump out of the PHP-tags,
which every experienced PHP-coder with a sane mind does, for sake of
readability.
If you need to jump back to get some variable, do this:
-snip-
I think that makes great readable code, both from a HTML perspective as from
a PHP perspective.
Don't use print and echo for HTML, unless you have some compelling reason.

just my 2 cent.

Regards,
Erwin Moller
Oh, yeah, I know... I was more coming from the angle of 'Perl can keep
it pretty too, but 98% of perl programmers don't and I don't know why
-- just cause it's one of the things I hear all the time as a complaint
about Perl CGIs... and if you grab scripts off the web, it's true --
but those are usually worth every penny, minus the bandwidth cost, IMO.

Actually I think it's because all the die-hard PHP fans I know have
used the argument once or twice, and so coming into a PHP group I
wanted to point out that I want to be able to do a lot of the stuff I
do in Perl in PHP also, not because I feel a *need* to, but because I
*want* to -- which I hope might garner more respect. But it's
ecumenicism, not conversion.

But yeah, I know the whole

<?php
$var = 'foo';
?>
<p class="blue"><? = $var ?bar..<br>
for you.</p>

thing... got that out of the box... plus I used to do ColdFusion, which
is a lot the same, and I have dorked around with embedded Perl script
in mod_perl, as SHTML tags, or embperl or even, once, PerlAsp (yuk).

Its just I see people do comparisons a lot and they try and compare
that to this Perl code:
my $var = 'foo';
print "<class=\"blue\ ">$var bar..<br>\nfor you</p>\n";

and it's just totally the wrong thing people compare with.
The proper thing to make such a comparison would in my case be:

my $var = 'foo';
print <<"EOF";
<p class="blue">$v ar bar..<br>
for you.</p>
EOF

See, Pretty Perl. Only thing missing is the vim syntax highlighting on
the HTML bits. But you can't have everything, neh? B^)

(
And I prefer the heredocs vastly to the CGI faux-oo approach thing some
people try and push, which is horrible stuff, like:
my $var = 'foo';
print $cgi->p("$var bar", $cgi->br(), "for you.", {class ='blue'});

That stuff is only useful, IMO, for, like, the popup_menu method and
stuff where just writing out the HTML is a pain.
)

Buy yeah, I want to know how to do this every way, and I figure
branching out to PHP was one of the best starts.

Jul 5 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1889
by: yzzzzz | last post by:
Hi, I am compiling PHP 5.0.2 myself with MySQL support. I did a ./configure --with-mysqli=/usr/local/mysql/bin/mysql_config (see end of post for complete configure) Note: I also have --with-mysql=/usr/local/mysql/. However, I get the same errors when I configure without the mysql extension, just mysqli. And as the documentation says, I use the same version of MySQL for both extensions to avoid conflicts.
0
2137
by: Roy Shaw | last post by:
When configuring PHP5 (5.0.3) to use the mysqli libraries I get a "No such file or directory" from the configure script. My goal is to get PHP5 running with mysql 4.1.09 with both the mysql and mysqli options. I can get it to configure and work correctly with just the mysql but NOT the mysqli or both. Environment: Red Hat Enterprise Linux 3, rel 4 php 5.0.3 from sources from php.net
2
2732
by: ojorus | last post by:
Hi! Some questions regarding the mysqli-extension (php5) 1) Prepared statements: If I understand things right, prepared statements will give better performance if you make several similar querys. (where you only change the parameters) But what if you do only ONE query; will it then be usefull to use prepared statements? Can it actuelly give better performance NOT to use prepared statements in that case? 2) Are there any DISadvantages...
12
4746
by: davids58 | last post by:
trying to figure out how to use a mysql database with PHP. I ran the following code: <?php // defines database connection data define('DB_HOST', 'localhost'); define('DB_USER', 'ajaxuser'); define('DB_PASSWORD', 'practical'); define('DB_DATABASE', 'ajax'); // connect to the database $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
2
2766
by: Curtis | last post by:
Hello everyone: Recently, I decided to upgrade to PHP 5.2.0. I have C:\php5 in the Windows XP PATH, so upgrading is quite painless; just unzip new release, and restart Apache! Usually it goes off without a hitch, but I noticed that phpMyAdmin was not able to utilize the MySQLi library (which was working with my last 5.1.x release). As I was looking through php_info(), I noticed that MySQLi didn't even load. However, when I restarted...
13
3712
by: Schmidty | last post by:
If you do a page reload with $_SERVER will your program lose a mysqli connection upon the reload of the page? Would this code work? I need to know how to carry over a connection between methods as I am new to OOP? Thanks... Example; ======================================== <?php // webpage $newsignon = new newuser(); logon();
2
2603
by: Curtis | last post by:
Hello everyone: I have come to love the ease of updating PHP, since getting used to using it these past few years. Recently, however, when I upgraded from PHP 5.1 to PHP 5.2.0 and again when moving to 5.2.1, I noticed strange behavior when trying to load php_mysqli.dll. I am using Apache 2.2.3 on Windows XP Pro (32-bit). I use the php5apache2_2.dll to load PHP as an Apache module. The PHPIniDir directive in httpd.conf points to the...
21
7275
by: Daz | last post by:
Hi everyone. I am trying to create an extension of the mysqli class within PHP, and I am finding it quite difficult. I am fairly new to PHP classes, and decided to give them a go. Here's what I have to far: <?php class sql_db extends mysqli { var $connection = false;
2
3208
by: Michael | last post by:
Hi, I try to use mysqli object instead of standard mysql functions. Is it ok to create mysqli object within my class or schould I pass mysqli object to my object. The problem is, with code below I must call mysqli->connect() each time I call class methods. How do I create an connection for hole object, so methods can do queries without connect each time? Best Regards, Michael
0
9293
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9064
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7932
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6617
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5941
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4456
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4713
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2508
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2097
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.