Jump to content

kww

New Members
  • Posts

    6
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

kww's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. "you must STILL execute the code to get an existing or create a new database connection on each page request." I figured I was just doing one of those evil forbidden things. I understand how to "create a new database connection". Any hints on how to "get an existing ..." connection?
  2. I'm trying to make a link to an SQL database survive though page reloads, and it's not working. Connecting, I use this: function link_to_converted_database() { $link = mysqli_init(); if (!$link) { die('mysqli_init failed'); } if (!mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 1')) { die('Setting MYSQLI_INIT_COMMAND failed'); } if (!mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 50)) { die('Setting MYSQLI_OPT_CONNECT_TIMEOUT failed'); } if (!mysqli_real_connect($link, 'redacted', 'redacted', 'redacted')) { die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error()); } comment( ' Success... ' . mysqli_get_host_info($link) ); if (mysqli_query($link,'USE conversion_database')) { comment("now using conversion_database."); } else { die('Conversion database unusable (' . mysqli_connect_errno() . ') ' . mysqli_connect_error()); } $_SESSION['mysql_link']=$link; echo "<!--\n"; var_dump($_SESSION['mysql_link']); echo "\n-->\n"; return(true); } Subsequent SQL commands work fine using $_SESSION['mysql_link'], and the var_dump returns: object(mysqli)#2 (17) { ["affected_rows"]=> int(0) ["client_info"]=> string(48) "mysqlnd 5.0.7-dev - 091210 - $Revision: 294543 $" ["client_version"]=> int(50007) ["connect_errno"]=> int(0) ["connect_error"]=> NULL ["errno"]=> int(0) ["error"]=> string(0) "" ["field_count"]=> int(0) ["host_info"]=> string(24) "192.168.1.101 via TCP/IP" ["info"]=> NULL ["insert_id"]=> int(0) ["server_info"]=> string(16) "5.1.48-community" ["server_version"]=> int(50148) ["sqlstate"]=> string(5) "00000" ["protocol_version"]=> int(10) ["thread_id"]=> int(194) ["warning_count"]=> int(0) } After a page changes, all my $_SESSION vars work fine except for $_SESSION['mysql_link']. It's still there, but SQL queries bomb, and var_dump returns: Warning: var_dump(): Property access is not allowed yet in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Property access is not allowed yet in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Couldn't fetch mysqli in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Couldn't fetch mysqli in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Couldn't fetch mysqli in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Couldn't fetch mysqli in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Couldn't fetch mysqli in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Couldn't fetch mysqli in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Couldn't fetch mysqli in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Couldn't fetch mysqli in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Couldn't fetch mysqli in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Couldn't fetch mysqli in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Couldn't fetch mysqli in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 Warning: var_dump(): Couldn't fetch mysqli in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\voicereader\serverstate.php on line 595 object(mysqli)#1 (17) { ["affected_rows"]=> NULL ["client_info"]=> NULL ["client_version"]=> int(50007) ["connect_errno"]=> int(0) ["connect_error"]=> NULL ["errno"]=> NULL ["error"]=> NULL ["field_count"]=> NULL ["host_info"]=> NULL ["info"]=> NULL ["insert_id"]=> NULL ["server_info"]=> NULL ["server_version"]=> NULL ["sqlstate"]=> NULL ["protocol_version"]=> NULL ["thread_id"]=> NULL ["warning_count"]=> NULL } There's got to be a way to save my SQL linkages so that I don't have to reconnect to the SQL database every time I want to see if new data has arrived, but this doesn't seem to be it. My PHP version is PHP 5.3.2.0. Thanks for any help.
  3. <?php $TTS = new COM("SAPI.SpVoice"); $TTS->Speak('Hello world!'); ?> seems to work.
  4. I'm not sure if this is the right forum to ask in, so please point me at another one if it would be more productive. I'm working on an application involving speech synthesis on the server, and I would like to access Microsoft's SAPI 5.4 (http://msdn.microsoft.com/en-us/library/ee125077%28v=VS.85%29.aspx) directly from PHP code, or through a small wrapper of Javascript/Visual Basic if necessary. Can anyone point me in the right direction to get started? The application would be running on Windows 7 64-bit, using PHP 5.3. This application would be running as an independent task so it shouldn't get directly involved with the web server, but that's Apache2.2 if there's some reason that it is important.
  5. Found it, plus a new bug, but I'll open a separate thread for that. This one was nasty. I found out that if I ran PHP by itself on the command line, it could find the SQL functions. It only couldn't when loaded from Apache. Turns out my httpd.conf file was wrong. If it cannot load the file pointed to by PHPIniDir it fails silently. I had an error in it, so PHP was loading without a .ini file, and all the changes I made to mine were ineffective. LoadModule php5_module "C:/Program Files (x86)/PHP/php5apache2_2.dll" AddHandler application/x-httpd-php .php # configure the path to php.ini PHPIniDir "C:/Program Files (x86)/PHP/" ; was just "C:/PHP"
  6. I gave up trying to install MySQL on my Windows 7 machine. Hours of fiddling, and it never could install properly. So, I uninstalled it, and installed it on my Windows XP machine where it seems to be running happily, waiting for someone to connect to it. On my main Windows 7 64-bit machine, I am running Apache Web Server and PHP 5.3.2. I would like to be able to connect to my remote SQL server. I just can't get it to recognize the function calls related to SQL. My php.ini file has extension_dir="C:\Program Files (x86)\PHP\ext" [php_MYSQLI] extension=php_mysqli.dll I've verified that php_mysqli.dll is in that directory, and I don't get any error messages starting PHP. I verified my PATH variable. It successfully does the basic "Hello World" level stuff. However, when trying to access the mysqli functions, I get: Fatal error: Call to undefined function mysqli_init() in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\sqlconnect4.php on line 8 Most installation guides I find assume that I have MySQL installed locally. Is there something special I need to do to deal with the remote server?
×
×
  • 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.