PHP 5.3.1 & Mysql problem

Ive been looking arround the internet for 2days trying to find the solutions looked on arch's wiki page didnt find a solution so decided to come ask here
everytime i run a script with mysql in it i get
PHP Warning:  mysql_connect(): OK packet 6 bytes shorter than expected in /srv/http/index.php on line 5
PHP Warning:  mysql_connect(): mysqlnd cannot connect to MySQL 4.1+ using old authentication in /srv/http/index.php on line 5
PHP Warning:  mysql_select_db(): [2002] No such file or directory (trying to connect via unix:///var/run/mysqld/mysqld.sock) in /srv/http/index.php on line 6
any help would be helpful

It appears that you are using the native driver shipped with PHP 5.3+. The native driver only works with MySQL server 4.1+ using the new authentication algorithm and new password style.
Maybe the server you are connecting to still has an old-fashioned password for your account. The solution could be to update your password to use the new style, see:
http://rabaix.net/en/articles/2009/09/2 … tion-issue
See http://dev.mysql.com/doc/refman/5.1/en/ … shing.html for more information on password hashing in MySQL server and how it changed in 4.1.
Best (second) bet is to recompile PHP using MySQL client libraries rather than mysqlnd (this should be the default though). In fact, mysqlnd claims to be complete but lacks essential compatibility features even for 4.1+ servers. There is no point in using mysqlnd as it is a third-party ad-hoc replacement for libmysqlclient. The latter will always be more up to date than anything else, because it is developed together with MySQL server.
Last edited by o_O- (2009-11-30 16:25:06)

Similar Messages

  • Php connection to remote mysql server

    Hi,
    I've stragne problem using php 4.3.10 with Sun One 6.1 on Solaris 9. The connection to a remote mysql server fail. I've correct grants in both servers and the php.ini is setting to permit no limit connection to databases. the code:
    $host='my-remote-server.com';
    $link1=mysql_connect($host,"bla","blabla");
    if$db1 = mysql_select_db("LOGIN",$link1);
    $link = mysql_connect("localhost","bla","blabla");
    $db = mysql_select_db("LOGIN",$link);
    The remote connection fail but the local one works. When i work with another server Sun One 6 in Solaris 8 , everthing work wonderfull with the same deffinitions, it can connect the remote databases but the others machines can't connect the solaris 8 machine. i think there is something wrong in the solaris 9 or/and sun one 6.1 deffinition it avoid remote connection. The problem i don't know what may be wrong, which setting may affect tcp connections from web application in solaris 9/sun one 6.1 plataform.

    we found the problem finally and may be useful for someone. Using the solaris 9 network snifer (snoop) we found that the default php timeout connection for mysql doesn't work ,this value is 60 in the php.ini . After 4 or 5 miliseconds php application closes the connection when it runs from the webserver , running from the shell it doesn't happen.The answer from the other server arrived after 20 or 30 milisecods then the connection to the databases fails. The solution is to put unlimited tiemout , mysql_connection_timeout=-1 then it success to connect the remote mysql server correctly. May be problem without timeout connection in case the other server doesn't answer, then application may wait forever or untill the system or webserver take out the application. I didn't check this posibilty, mainly i'm interesting the applications can work and write in the remote databases. If this definition cause problem as application waiting connection we always can try with another value greater than 60.

  • Need to re-download PHP Event Calendar with MySQL Database

    How do I re-download PHP Event Calendar with MySQL Database purchased earlier.  I need link without having to repurchase.

    This has nothing to do with Adobe or Dreamweaver.  Contact the company from whom you purchased your extension or widget.
    Nancy O.

  • FB/PHP/MySQL Problem

    I originally posted this in the Flash Builder forum before seeing this one
    Hi All.. hope someone can help.
    I've started a very simple application and experiencing a problem regarding creating a new record in a MySQL database via PHP & Zend.
    Here's the snippet of AS:
              newLine.buy_price = cursor.current.buy;
              newLine.sell_price = cursor.current.sell;
              linesService.createLines(newLine);
              createLineResult.token = linesService.commit();
    Here's the snippet of PHP (all generated by FB):
         public function createLines($item) {
              $stmt = mysqli_prepare($this->connection, "INSERT INTO $this->tablename (supplier, sku, product_name, quantity, buy_price, sell_price) VALUES (?, ?, ?, ?, ?, ?)");
              $this->throwExceptionOnError();
              mysqli_stmt_bind_param($stmt, 'iisiii', $item->supplier, $item->sku, $item->product_name, $item->quantity, $item->buy_price, $item->sell_price);
              $this->throwExceptionOnError();
              mysqli_stmt_execute($stmt);         
              $this->throwExceptionOnError();
              $autoid = mysqli_stmt_insert_id($stmt);
              mysqli_stmt_free_result($stmt);         
              mysqli_close($this->connection);
              return $autoid;
    When I run the createLines() function then commit(), I get the following error popup from my application:
    MySQL Error - 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 'lines (supplier, sku, product_name, quantity, buy_price, sell_price) VALUES (?, ' at line 1
    #0 C:\wamp\www\XOM-debug\services\LinesService.php(119): LinesService->throwExceptionOnError()
    #1 [internal function]: LinesService->createLines(Object(stdClass))
    #2 [internal function]: ReflectionMethod->invokeArgs(Object(LinesService), Array)
    #3 C:\wamp\www\ZendFramework\library\Zend\Server\Reflection\Function\Abstract.php(380): call_user_func_array(Array, Array)
    #4 C:\wamp\www\ZendFramework\library\Zend\Amf\Server.php(359): Zend_Server_Reflection_Function_Abstract->__call('invokeArgs', Array)
    #5 C:\wamp\www\ZendFramework\library\Zend\Amf\Server.php(359): Zend_Server_Reflection_Method->invokeArgs(Object(LinesService), Array)
    #6 C:\wamp\www\ZendFramework\library\Zend\Amf\Server.php(553): Zend_Amf_Server->_dispatch('createLines', Array, 'LinesService')
    #7 C:\wamp\www\ZendFramework\library\Zend\Amf\Server.php(629): Zend_Amf_Server->_handle(Object(Zend_Amf_Request_Http))
    #8 C:\wamp\www\XOM-debug\gateway.php(69): Zend_Amf_Server->handle()
    #9 {main}
    As as I see it, the parameters are not being replaced by the actual values, so MySQL is freaking out as it's getting question marks in the statements. What I don't understand is how this is happening! Everything is auto-generated by FB. I created a new project from scratch and used only drag & drop from the Data/Services panel to generate a form for data entry and got the same error.
    Any ideas!?
    Cheers,
    Steve

    Charles Newbury wrote:
    > How can I return to a screen containing the record I
    originally clicked to
    > modify? (it could be way down the list)...
    I answered the same question a couple of days ago:
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=12&catid=189&threadid =1294897&enterthread=y#4687934
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • Php/mysql problems Mac OS 10.4

    After upgrading to Mac 10.4 from 10.3, I get this message on
    my dynamic
    pages
    Can't connect to local MySQL server through socket
    '/var/mysql/mysql.sock' (2)
    I can connect to both the local and remote mysql server from
    the terminal.
    As far as I can tell there is no directory named "mysql", so
    "Hard Drive:var:mysql" mysql doesn't exist.
    php works fine, but I also get a warning:
    Warning: mysql_connect() [function.mysql-connect]: Protocol
    mismatch;
    server version = 9, client version = 10
    Connected successfully
    I've googled all over, I'm stumped.
    Mick

    David Powers wrote:
    > Mick White wrote:
    >
    >> After upgrading to Mac 10.4 from 10.3, I get this
    message on my
    >> dynamic pages
    >> Can't connect to local MySQL server through socket
    >> '/var/mysql/mysql.sock' (2)
    >
    >
    > Try this in Terminal:
    >
    > ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock
    >
    Thanks David, this is what I did along the same lines:
    sudo mkdir /var/mysql
    sudo ln -s /private/tmp/mysql.sock /var/mysql/mysql.sock
    http://forum.mamboserver.com/showthread.php?t=70766
    Mick

  • Apache2 local web server + Perl 5 + mysql problem

    this problem has been bugging me for some months; it's stopping me developing on my new MBP.
    I cannot connect to mysql 5.0.45 database when web sharing w/ Apache2 with either Perl 5.8 & Activeperl 5.10 cgi scripts on Mac OS X Leopard 10.5.2 & 10.5.3
    Although I can connect to the mysql DB when running the Perl scripts from the command line.
    The problem only occurs on my local web server in Mac OS X 10.5.2 & 10.5.3.
    On my old development Mac running 10.3 the code runs fine, as it also does on my remote site.
    server error log: Can't locate DBD/mysql.pm . . .
    I suspect there is a problem somewhere between Apache2, Perl & MySQL.
    Please advise.
    Sarpedon Jones
    Message was edited by: Sarpedon Jones

    I've got the same problem but It sounds like I've gotten farther. I was forced to do an emergency move of some Perl and PHP sites to 10.5.4 when our 10.4 web server refused to authenticate to AD anymore...
    Leopard's Apache/Perl support is terrible. There is not click to add option anymore so you have to manually set up mod_perl. No big deal but the first sign that there isn't reasonable support.
    The bigger issue is that Apple's Perl will not compile some modules.. namely DBD::mysql.
    Normally you'd use "cpan" to install the modules you need. The core module for connecting to a mysql database is DBD.. specifically DBD::mysql
    You should be able to run "cpan" or "cpanp" [cpan plus] to get a cpan interactive prompt. At this point you should be able to compile DBD by issuing either of the following:
    "install DBD::mysql" or
    "install Module DBD::mysql"
    I've tried this on two installs of OS X Server and that module (and others) will not compile on either system. One of my servers had been set up as a Wiki server before but the other had not been running any web services before I started using it as a test bed for my site move. (BTW these sites are unavailable until I can move them).
    There is another bug (noted on mysql's site) with Apple's version of cpan. If you try to add some modules, cpan will report that it needs to install a new, full version of Perl. The recommendation is to not do this, but rather force the install.. "install f DBD::mysql"
    Forcing the install is a questionable idea but it doesn't work anyway.
    I eventually did install perl 5.0.10 on the system in /usr/ and that does allow me to compile the needed Perl mods. However, the global @INC path has the old Perl paths listed so my perl CGIs will not use the new perl install.
    I'm sorry I don't have a solution. Hopefully my troubleshooting will elicit some more feedback.
    steven.

  • MySQL problem with 1and1 hosting

    I have just discovered this group.  I posted a similar post in the Dreamweaver area, but it probably needs to
    be here.
    I was asked to add database functionality to a website hosted by 1and1.  I just started to use DW CS5
    recently and when I tried to connect the MySQL db using Dreamweaver, I got the 404 file not found error
    message.  It has been a while since I have worked with PHP and MySQL, but I have used MySQL many times in the
    past using DW CS4 and using 1and1, so I know that it used to be possible.
    Here is what I have done so far:
    Tried to connect using DS CS5.  Tried to connect using DW CS4.  I contacted 1and1 and they told me that they
    no longer allow MySQL to connect using Dreamweaver.  However, they sell DWCS4 software to be used with their
    higher end hosting packages (which I am using).
    Here are my questions:
    1) Is this a known problem with 1and1?  If so, is the DW that they sell altered to get around this?
    2) Is this how other hosting companies are going, or is this only true of 1and1?

    RobertBoy wrote:
    Tried to connect using DS CS5.  Tried to connect using DW CS4.  I contacted 1and1 and they told me that they
    no longer allow MySQL to connect using Dreamweaver.
    This means that they disabled remote access to their MySQL server for security reasons, meaning that you´ll have to...
    1. set up a local testing server (eg. MAMP, XAMPP) and develop/test your work locally
    2. upload the finalized files to the remote server and run them from there.
    If so, is the DW that they sell altered to get around this?
    Unlikely, because the product EULA declares a "No Modification" restriction.
    Is this how other hosting companies are going, or is this only true of 1and1?
    This is not uncommon with shared hostings in particular, though there may be some which allow remote access. Let´s hope that other forum participants can provide recommendations.

  • Strange PHP compile issue -- old MySQL client version

    I've successfully compiled PHP 5.2.8 from source on two Xserve G5s running 10.4.11. It seems to run all the web apps fine. But when I look at phpinfo(), it reports that the MySQL Client API version is 4.1.22. Previously, when using Marc Liyanage's package version (5.2.4), the MySQL Client API was something like 5.0.45 (at least reasonably current with the MySQL version I had installed).
    So I have two main questions:
    1. What determines the PHP's MySQL Client API version? Is it some code in the PHP source that gets compiled? (In which case, why is the latest PHP source using an old MySQL Client.)
    2. How can I make the PHP I compiled use the latest MySQL Client API version? (Since I've seen warnings that this could cause problems. Incidentally, I'm using MySQL 5.0.67.)
    If it helps, here are the compile options I've used, per instructions online ( http://downloads.topicdesk.com/docs/UpdatingPHP_on_OS_XServer.pdf ):
    ./configure --prefix=/usr/local/php5 --mandir=/usr/share/man --infodir=/usr/share/info --with-apxs --with-ldap=/usr --with-kerberos=/usr --enable-cli --with-zlib-dir=/usr --with-libxml-dir=/usr --enable-exif --enable-ftp --enable-mbstring --enable-sockets --enable-fastcgi --with-iodbc=/usr --with-curl=/usr --with-config-file-path=/private/etc --with-mysql=/usr --with-mysql-sock=/var/mysql/mysql.sock
    I can post the config.log as well if that's helpful.
    ...Rene

    I'm posting this information here as its the top hit when searching apple.com for mac php recompile
    There is a MUCH easier/safer way to install a missing php module then doing a full recompile. Please see and read the comments:
    http://www.pagebakers.nl/2008/12/17/installing-php-soap-extension-on-leopard-10- 5-5/#comment-4931

  • PHP 5.0.4, php apps and zip file problems

    I use various opensource web apps that allow for files to be uploaded in zip format. The app then unzips the files and does what it needs to do with them. ie: Gallery2 uploading photos that are zipped up and placing the enclosed photos into the gallery.
    Anyway, this was working very well with the base install of OS X Server's PHP4.? and Apache 1.4.3
    I upgraded to PHP 5.0.4 using Entropy PHP (recommended by another OS X Server admin). Anyway, I lost the ability to handle the zip files. I am unsure what to look for.
    phpinfo() shows the following about compressed files:
    Configure Command
    './configure' '--prefix=/usr/local/php5' '--with-config-file-path=/usr/local/php5/lib' '--with-apxs' '--with-iconv' '--with-openssl=/usr' '--with-zlib=/usr' '--with-mysql=/Users/marc/svn/entropy/php-module/src/mysql-standard-*' '--with-mysqli=/usr/local/mysql/bin/mysql_config' '--with-libxml-dir=/usr/local/php5' '--with-xsl=/usr/local/php5' '--with-pdflib=/usr/local/php5' '--with-pgsql=/Users/marc/svn/entropy/php-module/build/postgresql-build' '--with-gd' '--with-jpeg-dir=/usr/local/php5' '--with-png-dir=/usr/local/php5' '--with-zlib-dir=/usr' '--with-freetype-dir=/usr/local/php5' '--with-t1lib=/usr/local/php5' '--with-imap=../imap-2002d' '--with-imap-ssl=/usr' '--with-gettext=/usr/local/php5' '--with-ming=/Users/marc/svn/entropy/php-module/build/ming-build' '--with-ldap' '--with-mime-magic=/usr/local/php5/etc/magic.mime' '--with-iodbc=/usr' '--with-xmlrpc' '--with-expat-dir=/usr/local/php5' '--with-iconv-dir=/usr' '--with-curl=/usr/local/php5' '--enable-exif' '--enable-wddx' '--enable-soap' '--enable-sqlite-utf8' '--enable-ftp' '--enable-sockets' '--enable-dbx' '--enable-dbase' '--enable-mbstring' '--enable-calendar' '--with-bz2=/usr' '--with-mcrypt=/usr/local/php5' '--with-mhash=/usr/local/php5' '--with-mssql=/usr/local/php5' '--with-fbsql=/Users/marc/svn/entropy/php-module/build/frontbase-build/Library/ FrontBase' '--enable-openbase_module'
    Registered PHP Streams
    php, file, http, ftp, compress.bzip2, compress.zlib, https, ftps
    BZip2 Support Enabled
    BZip2 Version 1.0.2, 30-Dec-2001

    I wish I could be as optimistic about your configuration, you have/had more than two issues, even after building a PHP that would work for you it had to be reconfigured to obtain optimal performance.
    I noticed other errors in your logs but since they weren't specifically related to your issue with zip or PHP running properly I place a low priority on them and ignored them.
    I eventually found the build issue with the entrophy PHP however Mark wasn't interested in the fix since it basically performed the majority of the tasks that were expected and everything else was considered experimental with no real support provided.
    You did get a better PHP built in the ADE (Apple Developer Environment) targeted specifically for your CPU (although they are universal binaries) and I included some modules I wrote myself that provide some (IMHO) key functionality for a production web service like scanning uploaded files for viruses and the ability to generate RRDTool graphs natively without slowing the process down by having to rely on external resources.
    While I have thoroughly tested the modules I wrote, I have not had the time (or the help) to write proper documentation for them so I might later provide some sample PHP scripts since they are fairly simple to implement.
    The biggest problem I saw was that you had a lot of nice toys but none of them were designed to work smoothly together and the entrophy PHP is a good alternative for someone who needs more than what apple provides but isn't capable of generating something that integrates well in the environment.
    Also to note, the entrophy (or Server Logistics) PHP is an all-purpose/general-purpose solution and isn't ever going to be optimal for any specific architecture due to the build process which is why the one I provided works significantly better, it was built specifically for both architectures individually then combined into a single binary giving you the ultimate performer for either architecture without sacraficing performance or degrading functionality.
    I tend to use as much Apple provided software as I can since it makes no sense to me to build and install any software that is already available and built specifically for the environment other than to waste disk space, freetype is a good example, any that is provided will never include the same features and functionality as the apple provided installation yet all PHP makers seem to build the basic bare-bones freetype and build their PHP off of it expecting to achieve the same feature-rich functionality which it clearly isn't capable of.
    They also include a lot of features which are never used and I have removed and/or substituted some of these in an attempt to provide a more usefull set of features and functionality and I include a very complete pear installation which also contains just about every feature and functionality you would ever require without providing anything that that would be considered fluff.
    I've been watching the performance of the installation for a couple of days now and I'm more than satified that it's a solid performer for you so smile and enjoy, santa was nice to you this year.

  • Ancient MySQL problem, still unsolved

    For the longest time, I've had a strange problem with MySQL. Basically, after a certain amount of time--it could be a few days, or a couple weeks--its CPU usage will go from around 20% to 80%, with exactly the same load.
    If I shutdown MySQL and restart it, CPU load is back to normal. What could this be?
    ...Rene

    With some great help from the MySQL mailing list, I believe I've identified the problem, which is fundamental to Mac OS X's BSD UNIX layer: DNS lookups are not thread-safe in the version of BSD (5?) used by Mac OS X. The workaround is to add skip-name-resolve to my.cnf, and ensure that MySQL's GRANT tables use IPs instead of host names. Here's some resources on the topic, in case anyone else runs into this:
    http://jeremy.zawodny.com/blog/archives/000203.html
    http://bugs.mysql.com/bug.php?id=414
    http://www.mail-archive.com/[email protected]/msg87497.html
    http://lists.apple.com/archives/Opentransportdev/2001/Dec/msg00060.html
    ...Rene

  • EJB 3.0 entity beans generation with MySql - problem

    Hi,
    I am using JDev 10.1.3 Production and using the EJB3.0 CMP wizard to generate the code from a MySQL database. No matter what type I specify for my database columns in schema, code generator always generates the properties of type String only. e.g if a column called Age is specified as Integer in schema, the generator generates setters/getters with String type.
    Can somebody please help me.
    Regards
    Vimal

    Hi,
    I'm experiencing same problems, is this a bug or an feature?

  • JAVA with MYSQL problem

    i am using jdk1.6.0_02,apache tomcat 5.5.23 ,mysql integrated with redhat linux EE 4 and.mysql connector java 5.0.7.bin.jar.
    look at the the following java program
    import java.sql.*;
    public class TestMysql
    public static void main(String args[])
    try
    String driver = "com.mysql.jdbc.Driver";
    Class.forName( driver );
    String url = "jdbc:mysql://localhost/test";
    DriverManager.getConnection( url, "root", "mysql" );
    catch( Exception x )
    {      x.printStackTrace();
    i got the following exception
    java.sql.SQLException: Access denied for user 'root'@'localhost.localdomain' (us *** password:
    YES)
    at com.mysql.jdbc.SQLError.createSQLException(java.lang.String, java.lang.Str ***, int)
    (Unknown Source)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(int) (Unknown Source)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket() (Unknown Source)
    at com.mysql.jdbc.MysqlIO.secureAuth411(com.mysql.jdbc.Buffer, int, java.lang .String,
    java.lang.String, java.lang.String, boolean) (Unknown Source)
    at com.mysql.jdbc.MysqlIO.doHandshake(java.lang.String, java.lang.String, jav a.lang.String)
    (Unknown Source)
    at com.mysql.jdbc.Connection.createNewIO(boolean) (Unknown Source)
    at com.mysql.jdbc.Connection.Connection(java.lang.String, int, java.util.Prop erties,
    java.lang.String, java.lang.String) (Unknown Source)
    at com.mysql.jdbc.NonRegisteringDriver.connect(java.lang.String, java.util.Pr operties)
    (Unknown Source)
    at java.sql.DriverManager.getConnection(java.lang.String, java.util.Propertie s)
    (/usr/lib/libgcj.so.5.0.0)
    at java.sql.DriverManager.getConnection(java.lang.String, java.lang.String, j
    ava.lang.String) (/usr/lib/libgcj.so.5.0.0)
    at Connect.main(java.lang.String[]) (Unknown Source)
    access denied problem. but the user name and password are correct. i can login to mysql by using
    the same username and password.
    but when connecting through java , i can't ? what is the problem?
    can u help me.?
    actually i am working in JSP. and when i got this problem, i created a small java program for testing.
    here i am submitting the java program.

    friend please put your code inside
       // your code goes here  it will more readable and other can solve it better.
    ==================
    and your problem tells that you must set access permission inside
    mySQL server.
    or try with creating new User with password.
    EnJOY.
    Ghanshyam
    Edited by: Ghanshyam on Sep 28, 2007 4:13 PM

  • Zend + FB + MySQL problem

    Hi all,
    I am trying to teach myself the Zend connection to my database with a simple FB4 example, but I can't get it to work at all. It may be something simple, but I can't for the life of me, see it.
    This is my MXML code:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:s="library://ns.adobe.com/flex/spark"
                      xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
         <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
              <s:ChannelSet id="zend_amf_channel_set">
                   <s:channels>
                        <s:AMFChannel uri="http://www.localhost/gateway.php"/>
                   </s:channels>
              </s:ChannelSet>
              <s:RemoteObject id="family_VO" destination="zend-amf" source="family"
                                  channelSet="{zend_amf_channel_set}"
                                  showBusyCursor="true"
                                  fault="membersError(event)">
                   <s:method name="getAllMembers" result="getAllMembersResult(event)"/>
              </s:RemoteObject>
         </fx:Declarations>
         <fx:Script>
              <![CDATA[
                   import mx.controls.Alert;
                   import mx.events.FlexEvent;
                   import mx.rpc.events.FaultEvent;
                   import mx.rpc.events.ResultEvent;
                   //private const GATEWAY_URL:String = "c:\wamp\www\WilliamsFamily\gateway.php";
                   private var memberData:MemberData;
                   [Bindable]
                   private var lang_title:String = "My Attempt To Figure This Stuff Out!";
                   protected function getAllMembers():void
                        family_VO.getAllMembers;
                   protected function clearDataGrid():void
                        member_dg.dataProvider = {};     
                   protected function getAllMembersResult(e:ResultEvent):void
                        member_dg.dataProvider = e.result;
                   protected function membersError(e:FaultEvent):void
                        Alert.show(e.toString());
              ]]>
         </fx:Script>
         <s:VGroup   width="100%" horizontalAlign="center" paddingTop="25">
              <s:Label text ="{lang_title}" fontSize="20"/>
              <mx:DataGrid id="member_dg" height="100">
                   <mx:columns>
                        <mx:DataGridColumn headerText="ID" dataField="id" width="100"/>
                        <mx:DataGridColumn headerText="First Name" dataField="fname"/>
                        <mx:DataGridColumn headerText="Last Name" dataField="lname"/>
                        <mx:DataGridColumn headerText="Age" dataField="age"/>
                        <mx:DataGridColumn headerText="Gender" dataField="gender" width="200"/>
                   </mx:columns>
              </mx:DataGrid>
              <s:HGroup>
                   <s:Button label="Get Family Members" click="{getAllMembers();}"/>
                   <s:Button label="Clear" click="{clearDataGrid();}"/>
              </s:HGroup>
         </s:VGroup>
    </s:Application>
    The family.php
    <?php
    require_once 'MemberData.php';
    class Family
         public function __construct()
              mysql_connect("localhost", "root", "root");
              mysql_select_db("williamsfamily");
         public function getAllMembers()
              //Array of family members
              $members = array();
              //Select all fields from db table
              $result = mysql_query("SELECT * FROM family");
              //if successfuly, go through results
              while ($row = mysql_fetch_assoc($result))
                   //create family member value object and populate with values
                   $member = new MemberData();
                   $member->id = $row["id"];
                   $member->fname = $row["fname"];
                   $member->lname = $row["lname"];
                   $member->age = $row["age"];
                   $member->gender = $row["gender"];
                   array_push($members, $member);
         //return the array of family members to flex
         return $members;
    ?>
    MemberData.php
    <?php
    class MemberData
         public $id;
         public $fname;
         public $lname;
         public $age;
         public $gender;
    ?>
    gateway.php
    <?php
    $debug = true;
    if ($debug)
         error_reporting(E_ALL|E_STRICT);
         ini_set("display_errors", "on");
    else
         ini_set("display_errors", "off");
    require_once "Zend/Amf/Server.php";
    $server = new Zend_Amf_Server();
    require_once "family.php";
    $server->setClass("Family");
    $server->setClassMap("MemberData", "MemberData");
    echo($server->handle());
    ?>
    I was following a tutorial I found that seemed to explain the Zend+WAMP setup fairly well. I changed the php.ini include path to point to teh Zend/Library.
    It seems like I am not connecting to the database at all. Anyone see problems with the code?
    Thanks a million for the help!!

    Solved my own issue. The PDO wrapper is case sensitive when it comes to dealing with Oracle. Thus:
    class Equipment extends Zend_Db_Table
    protected $_name = 'EQUIPMENT;
    protected $_primary = 'ID';
    protected $_schema = 'ZZ';
    protected $_sequence = true;
    Nevertheless, I woul recommend staying away from the PDO wrapper and use standard oci functions.

  • Mysql problem with german special characters

    hi,
    I wrote a software and it worked quite good, but after I installed it on a new machine with j2se 1.4 I've problems with the german special characters.
    this code works good on the old machine (jdk 1.3.1) and prints the wanted characters like �,�,�.
    Class.forName("org.gjt.mm.mysql.Driver").newInstance();
    java.sql.Connection conn;
    conn = DriverManager.getConnection("jdbc:mysql://localhost/testdb?user=testuser&password=xxxx");
    Statement s = conn.createStatement();
    ResultSet r = s.executeQuery("select something from testtb where id='1'");
    r.first();
    System.out.println( r.getString(1) );
    but on the new machine (j2se 1.4) I only receive the character ?.
    I updated my org.gjt.mm.mysql to the current MySQL Connector/J 3.0.9 and added
    conn = DriverManager.getConnection("jdbc:mysql://localhost/testdb?user=testuser&password=xxxx&useUnicode=true&characterEncoding=ISO-8859-1");
    but I've got still the same problem.
    Thanks in advance
    Markus

    with "wanted characters like �,�,�"
    I meant: like &#x00E4;,&#x00FC;,&#x00F6;

  • JSP + JDBC + MySql Problem (Tomcat 4.1)

    I'm completely helpless... whenever I try to retrieve stuff from the db (using a jsp page), I get errors that don't even make sense.
    out.println(stmt.executeQuery("SELECT * FROM newsTbl WHERE articleID = 1").getString("articleTitle"));if I try doing the above, I get a "ServletException : Before start of result set" error that supposedly occurred at this line of the generated servlet:
    if (pageContext != null) pageContext.handlePageException(t);---------------
    If i try this:
    ResultSet rsSec = stmt.executeQuery("SELECT * FROM newsSecTbl");
    rsSec.beforeFirst();  //<-- Even if I don't have this line the result does not change
      out.println(rsSec.next());
      while (rsSec.next()) { ... }I the while loop is never initiated, because rsSec.next() is false... kind of weird if you ask me, I even put two entries into the table to make sure the cursor wasnt at the first record and saying there was no second one (which would have been right if there were only one record).
    I would be very grateful if someone could help me out with this. I've never done any db programming with Java yet, so I dont have a clue what Im doing. By the way, I'm using MySql (indicated in the title) and the server was running and available when I ran the above code.
    Cheers,
    Tom

    You can't do this:
    out.println(stmt.executeQuery("SELECT * FROM newsTbl WHERE articleID = 1").getString("articleTitle"));The ResultSet you get back is a database cursor that doesn't point to the first row yet. The correct idiom is:
    String sql = "SELECT * FROM newsTbl WHERE articleID = 1";
    ResultSet result = stmt.executeQuery(sql);
    String articleTitle = "";
    while (result.next())
       title = result.getString("articleTitle");
    result.close();
    stmt.close();If you've never done DB programming before, I'd recommend that you click on the Tutorials link to the left and go through the JDBC tutorial carefully. You'll save yourself a lot of grief.
    Another good idea would be to separate out all your database code into at least one separate object, independent of the servlet. That way you can test and develop it off to the side until it's 100% solid. Then your servlet can simply instantiate one and use it. All your problems from that point forward will be servlet issues, because you'll know that your database code is working. - MOD
    See if that works better. - MOD

Maybe you are looking for