$db=new mysqli fails while $db=mysqli_connect succeeds in PHP/MySQL5
$db=new mysqli fails while $db=mysqli_connect succeeds in PHP/MySQL5
am 25.08.2007 02:44:20 von Whil Hentzen
From a php-general thread earlier:
$db=new mysqli('localhost','whil','secret','test');
?>
generates:
Fatal error: Call to undefined function new mysqli() in index.php on
line 24
while
$conn = mysqli_connect("localhost","whil","secret","test");
echo 'conn good: '.$conn.' :very good indeed
';
?>
generates success:
conn good: Object id #1 :very good indeed
The book I'm working with (PHP & MySQL Web Dev, Welling/Thompson)
specifically defines the 'new mysqli' syntax. So I'm guessing I don't
have something configured right?
Whil
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: $db=new mysqli fails while $db=mysqli_connect succeedsin PHP/MySQL 5
am 27.08.2007 03:25:37 von dmagick
Linux NG/Lists wrote:
> From a php-general thread earlier:
>
>
> $db=new mysqli('localhost','whil','secret','test');
> ?>
>
> generates:
>
> Fatal error: Call to undefined function new mysqli() in index.php on
> line 24
>
> while
>
>
> $conn = mysqli_connect("localhost","whil","secret","test");
> echo 'conn good: '.$conn.' :very good indeed
';
> ?>
>
> generates success:
>
> conn good: Object id #1 :very good indeed
>
> The book I'm working with (PHP & MySQL Web Dev, Welling/Thompson)
> specifically defines the 'new mysqli' syntax. So I'm guessing I don't
> have something configured right?
If one works the other should too. Your code here looks fine according
to the manual (http://www.php.net/manual/en/function.mysqli-connect.php)
- can you send us exactly what you have?
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: $db=new mysqli fails while $db=mysqli_connect succeeds in PHP/MySQL
am 27.08.2007 16:15:56 von Instruct ICC
>From a php-general thread earlier:
>
>
> $db=new mysqli('localhost','whil','secret','test');
> ?>
>
>generates:
>
> Fatal error: Call to undefined function new mysqli() in index.php on
> line 24
>
>while
>
>
> $conn = mysqli_connect("localhost","whil","secret","test");
> echo 'conn good: '.$conn.' :very good indeed
';
> ?>
>
>generates success:
>
> conn good: Object id #1 :very good indeed
>
>The book I'm working with (PHP & MySQL Web Dev, Welling/Thompson)
>specifically defines the 'new mysqli' syntax. So I'm guessing I don't have
>something configured right?
>
>Whil
I don't see a constructor for mysqli at http://php.net/mysqli
Your book is probably defining a class that you didn't include/require. For
example, search for the following at the php page above:
require_once('safe_mysqli.php');
try {
$mysql = new safe_mysqli
You will need to have the class your book is defining before you can
instantiate such an object.
____________________________________________________________ _____
Find a local pizza place, movie theater, and moreĀ
.then map the best route!
http://maps.live.com/default.aspx?v=2&ss=yp.bars~yp.pizza~yp .movie%20theater&cp=42.358996~-71.056691&style=r&lvl=13&tilt =-90&dir=0&alt=-1000&scene=950607&encType=1&FORM=MGAC01
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: $db=new mysqli fails while $db=mysqli_connect succeeds in PHP/MySQL
am 27.08.2007 16:20:17 von Instruct ICC
"I don't see a constructor for mysqli at http://php.net/mysqli"
My bad. It's right there at the top. Must be a case of the Mooondayz.
____________________________________________________________ _____
Now you can see troubleĀ
before he arrives
http://newlivehotmail.com/?ocid=TXT_TAGHM_migration_HM_viral _protection_0507
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: $db=new mysqli fails while $db=mysqli_connect succeedsin PHP/MySQL 5
am 27.08.2007 18:32:56 von Whil Hentzen
>> The book I'm working with (PHP & MySQL Web Dev, Welling/Thompson)
>> specifically defines the 'new mysqli' syntax. So I'm guessing I don't
>> have something configured right?
>
> If one works the other should too. Your code here looks fine according
> to the manual (http://www.php.net/manual/en/function.mysqli-connect.php)
> - can you send us exactly what you have?
OK, here's what I've got, cut and pasted directly out of the script:
********************************************
echo('Today is... ' . date('l, F dS Y. ').'
' );
?>
error_reporting(E_ALL);
ini_set('display_errors','On');
?>
$db=new mysqli("localhost","whil","secret","test");
echo '$db is:'.$db.':';
$conn = mysqli_connect("localhost","whil","secret","test");
echo '$conn is:'.$conn.':';
?>
********************************************
1. If I comment out the $db and echo $db lines, the next two lines,
$conn and echo $conn generate the following:
Today is... Monday, August 27th 2007.
$conn is:Object id #1:
2. If I remove the $db and echo $db comments, I get the following:
Today is... Monday, August 27th 2007.
Fatal error: Call to undefined function new mysqli() in
index_listtest.php on line 17
I'm soooooooooo puzzled. :)
Whil
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: $db=new mysqli fails while $db=mysqli_connect succeedsin PHP/MySQL 5
am 29.08.2007 08:28:43 von Goltsios Theodore
--------------080709030705060708070704
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
|Why don't you try this:|
|
|$mysqli = new mysqli("localhost", "my_user", "my_password", "world");|
||
|/* check connection */|
|if (mysqli_connect_errno()) {|
| printf("Connect failed: %s\n", mysqli_connect_error());|
| exit();|
|}|
||
|printf("Host information: %s\n", $mysqli->host_info);|
||
|/* close connection */|
|$mysqli->close();|
|?>|
I took this script from the php manual so why don't you try it and see
what |mysqli_connect_error will do for you. In that you will debug the
previous script and find out what went wrong.|
Linux NG/Lists wrote:
> Goltsios Theodore wrote:
>> Well if you are in the unix case then you should check if your php
>> supports mysqli :-) . In either case unix or not you could use phpinfo:
>>
>>
>> phpinfo();
>> ?>
>
>
> Oh, sorry, I thought I posted this before. Looks like I didn't. I'm
> pretty sure it supports mysqli:
>
> './configure' '--prefix=/usr/local/php5'
> '--with-config-file-path=/usr/local/etc/php5/cgi' '--with-xml'
> '--enable-bcmath' '--enable-calendar' '--with-curl' '--with-dom'
> '--with-dom-xslt' '--with-dom-exslt' '--enable-exif'
> '--with-swf=/usr/local/flash' '--enable-ftp' '--with-gd'
> '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr'
> '--with-xpm-dir=/usr/X11R6' '--with-gettext'
> '--with-imap=/usr/local/imap-2004g' '--enable-mbstring'
> '--enable-mbstr-enc-trans' '--enable-mbregex' '--with-mcrypt'
> '--with-mhash' '--enable-magic-quotes' '--with-mysqli'
> '--with-mysql=/usr' '--with-openssl' '--enable-discard-path'
> '--with-pear' '--with-pspell' '--enable-sockets' '--enable-track-vars'
> '--with-ttf' '--with-freetype-dir=/usr' '--enable-gd-native-ttf'
> '--with-zip' '--with-zlib'
>
> The 'mysqli_connect(...' call works, just not 'new mysqli(...'
>
> If mysqli wasn't supported, then both would fail, right?
>
> Whil
>
>
>
>
>> This will show a lot useful information about what your web server
>> and your php can or cannot do.
>>
>>
>> Linux NG/Lists wrote:
>>>>> The book I'm working with (PHP & MySQL Web Dev, Welling/Thompson)
>>>>> specifically defines the 'new mysqli' syntax. So I'm guessing I
>>>>> don't have something configured right?
>>>>
>>>> If one works the other should too. Your code here looks fine
>>>> according to the manual
>>>> (http://www.php.net/manual/en/function.mysqli-connect.php) - can
>>>> you send us exactly what you have?
>>>
>>> OK, here's what I've got, cut and pasted directly out of the script:
>>>
>>> ********************************************
>>>
>>>
>>>
>>> echo('Today is... ' . date('l, F dS Y. ').'
' );
>>> ?>
>>>
>>>
>>> error_reporting(E_ALL);
>>> ini_set('display_errors','On');
>>> ?>
>>>
>>>
>>> $db=new mysqli("localhost","whil","secret","test");
>>> echo '$db is:'.$db.':';
>>> $conn = mysqli_connect("localhost","whil","secret","test");
>>> echo '$conn is:'.$conn.':';
>>> ?>
>>>
>>>
>>> ********************************************
>>>
>>> 1. If I comment out the $db and echo $db lines, the next two lines,
>>> $conn and echo $conn generate the following:
>>>
>>> Today is... Monday, August 27th 2007.
>>> $conn is:Object id #1:
>>>
>>> 2. If I remove the $db and echo $db comments, I get the following:
>>>
>>> Today is... Monday, August 27th 2007.
>>>
>>> Fatal error: Call to undefined function new mysqli() in
>>> index_listtest.php on line 17
>>>
>>> I'm soooooooooo puzzled. :)
>>>
>>> Whil
>>>
>>
>
--------------080709030705060708070704--
Re: $db=new mysqli fails while $db=mysqli_connect succeedsin PHP/MySQL 5
am 29.08.2007 08:32:47 von Goltsios Theodore
Reposting the code sorry:
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
printf("Host information: %s\n", $mysqli->host_info);
/* close connection */
$mysqli->close();
?>
>
>
> Linux NG/Lists wrote:
>> Goltsios Theodore wrote:
>>> Well if you are in the unix case then you should check if your php
>>> supports mysqli :-) . In either case unix or not you could use phpinfo:
>>>
>>>
>>> phpinfo();
>>> ?>
>>
>>
>> Oh, sorry, I thought I posted this before. Looks like I didn't. I'm
>> pretty sure it supports mysqli:
>>
>> './configure' '--prefix=/usr/local/php5'
>> '--with-config-file-path=/usr/local/etc/php5/cgi' '--with-xml'
>> '--enable-bcmath' '--enable-calendar' '--with-curl' '--with-dom'
>> '--with-dom-xslt' '--with-dom-exslt' '--enable-exif'
>> '--with-swf=/usr/local/flash' '--enable-ftp' '--with-gd'
>> '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr'
>> '--with-xpm-dir=/usr/X11R6' '--with-gettext'
>> '--with-imap=/usr/local/imap-2004g' '--enable-mbstring'
>> '--enable-mbstr-enc-trans' '--enable-mbregex' '--with-mcrypt'
>> '--with-mhash' '--enable-magic-quotes' '--with-mysqli'
>> '--with-mysql=/usr' '--with-openssl' '--enable-discard-path'
>> '--with-pear' '--with-pspell' '--enable-sockets'
>> '--enable-track-vars' '--with-ttf' '--with-freetype-dir=/usr'
>> '--enable-gd-native-ttf' '--with-zip' '--with-zlib'
>>
>> The 'mysqli_connect(...' call works, just not 'new mysqli(...'
>>
>> If mysqli wasn't supported, then both would fail, right?
>>
>> Whil
>>
>>
>>
>>
>>> This will show a lot useful information about what your web server
>>> and your php can or cannot do.
>>>
>>>
>>> Linux NG/Lists wrote:
>>>>>> The book I'm working with (PHP & MySQL Web Dev, Welling/Thompson)
>>>>>> specifically defines the 'new mysqli' syntax. So I'm guessing I
>>>>>> don't have something configured right?
>>>>>
>>>>> If one works the other should too. Your code here looks fine
>>>>> according to the manual
>>>>> (http://www.php.net/manual/en/function.mysqli-connect.php) - can
>>>>> you send us exactly what you have?
>>>>
>>>> OK, here's what I've got, cut and pasted directly out of the script:
>>>>
>>>> ********************************************
>>>>
>>>>
>>>>
>>>> echo('Today is... ' . date('l, F dS Y. ').'
' );
>>>> ?>
>>>>
>>>>
>>>> error_reporting(E_ALL);
>>>> ini_set('display_errors','On');
>>>> ?>
>>>>
>>>>
>>>> $db=new mysqli("localhost","whil","secret","test");
>>>> echo '$db is:'.$db.':';
>>>> $conn = mysqli_connect("localhost","whil","secret","test");
>>>> echo '$conn is:'.$conn.':';
>>>> ?>
>>>>
>>>>
>>>> ********************************************
>>>>
>>>> 1. If I comment out the $db and echo $db lines, the next two lines,
>>>> $conn and echo $conn generate the following:
>>>>
>>>> Today is... Monday, August 27th 2007.
>>>> $conn is:Object id #1:
>>>>
>>>> 2. If I remove the $db and echo $db comments, I get the following:
>>>>
>>>> Today is... Monday, August 27th 2007.
>>>>
>>>> Fatal error: Call to undefined function new mysqli() in
>>>> index_listtest.php on line 17
>>>>
>>>> I'm soooooooooo puzzled. :)
>>>>
>>>> Whil
>>>>
>>>
>>
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Excel to xml
am 07.06.2008 20:43:29 von John Dillon
I am on a cPanel type shared server, they don't have a way of converting
an Excel spreadsheet to xml (to read it into the database). This is a
pity because xls files are smaller for the purpose of uploading them.
Is there anyway to do this otherwise on a server, perhaps a different
flavour of server?.
John
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Excel to xml
am 12.06.2008 22:11:26 von James Lucas
ioannes wrote:
> I am on a cPanel type shared server, they don't have a way of
> converting an Excel spreadsheet to xml (to read it into the
> database). This is a pity because xls files are smaller for the
> purpose of uploading them. Is there anyway to do this otherwise on a
> server, perhaps a different flavour of server?.
>
> John
>
Hi,
You could always save the Excel sheet in CSV format, if your server has
phpMyAdmin installed then this should be easy to import into the
database and should be smaller in size than the excel file as well.
If it does not have it installed, you can download it from
http://www.phpmyadmin.net and upload it your own webspace to use it.
Regards
James
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php