MLUG: Re: [MLUG] Up against the wall with LAMP...
Re: [MLUG] Up against the wall with LAMP...
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
another thought, write a quick phpinfo file and make sure all the
relevant mysql stuff is ok in the php.ini.

<? phpinfo(); ?>

On 3/28/06, Shawn Parker <EMAIL:PROTECTED> wrote:
> why not just use something like,
>
> $host = "localhost";
> $user = "user";
> $pass = "password";
> $dbname = "database";
>
> $db = mysql_connect($host,$user,$pass) or die('error: '.mysql_error());
> mysql_select_db($dbname, $db);
>
> from there you can write any number of functions and objects to act
> upon the data in the db. such as,
>
> $sql = "insert into table (col1,col2) values ("$field1","$field2");
> $results = mysql_query($sql);
>
> On 3/28/06, Shawn Parker <EMAIL:PROTECTED> wrote:
> > i've never seen (or written) a native php db connect like that, so i'm
> > not sure where the real error could be...but...a lot of times that
> > generic error turns out to be a syntax problem.
> >
> >
> >
> > On 3/28/06, Mike Pepper <EMAIL:PROTECTED> wrote:
> > > I have been working on this forever, and it's time to get rolling.
> > > I bought Paul DuBois's MySQL third edition to assist in learning MySQL.
> > > I have MySQL installed, apache2 installed, php4 installed, and the pear
> > > package. I can connect to the MySQL program both locally and remotely.
> > > All is well up until it's time to bring the web into play.
> > > I can display simple php scripts without a problem.
> > >
> > > Both of these simple scripts work...
> > >
> > > <html>
> > > <body>
> > > <p>Hello World!</p>
> > > </body>
> > > </html>
> > >
> > > and
> > >
> > > <html>
> > > <body>
> > > <p><?php print ("Hello World!"); ?></p>
> > > </body>
> > > </html>
> > >
> > > Both display Hello World! in the browser as expected.
> > >
> > > Deeper into the tutorial he wants to use the c api which should be included in
> > > the packages that I am using.
> > >
> > > The package and version list follows.
> > >
> > > SuSE 9.3 Professional
> > >
> > > mysql  Ver 14.7 Distrib 4.1.10a, for suse-linux (i686)
> > >
> > > PHP 4.3.10 (cli) (built: Mar 22 2005 19:34:44)
> > > Copyright (c) 1997-2004 The PHP Group
> > > Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
> > >
> > > pear:
> > > Configuration:
> > > ==============
> > > PEAR executables directory     bin_dir         /usr/bin
> > > PEAR documentation directory   doc_dir         /usr/share/php/doc
> > > PHP extension directory        ext_dir         /usr/lib/php/extensions
> > > PEAR directory                 php_dir         /usr/share/php
> > > PEAR Installer cache directory cache_dir       /tmp/pear/cache
> > > PEAR data directory            data_dir        /usr/share/php/data
> > > PHP CLI/CGI binary             php_bin         /usr/bin/php
> > > PEAR test directory            test_dir        /usr/share/php/test
> > > Cache TimeToLive               cache_ttl       3600
> > > Preferred Package State        preferred_state stable
> > > Unix file mask                 umask           22
> > > Debug Log Level                verbose         1
> > > HTTP Proxy Server Address      http_proxy      <not set>
> > > PEAR server                    master_server   pear.php.net
> > > PEAR password (for             password        <not set>
> > > maintainers)
> > > Signature Handling Program     sig_bin         /usr/local/bin/gpg
> > > Signature Key Directory        sig_keydir      /etc/pearkeys
> > > Signature Key Id               sig_keyid       <not set>
> > > Package Signature Type         sig_type        gpg
> > > PEAR username (for             username        <not set>
> > > maintainers)
> > >
> > > The program that I am attempting to run is:
> > >
> > > <html>
> > > <head>
> > > <title>U.S. Historical League</title>
> > > </head>
> > > <body bgcolor="grey">
> > > <p>Welsome to the U.S. Historical League Web Site.</p>
> > > <?php
> > > # USHL home page
> > >
> > > require_once "/usr/share/php/DB.php"
> > >
> > > $conn =& DB::connect ("mysql://sampadm:EMAIL:PROTECTED");
> > > if (DB::isError ($conn))
> > >         exit ();
> > > $result =& $conn->query ("SELECT COUNT(*) FROM member");
> > > if (DB::isError ($result))
> > >         exit ();
> > > if ($row =& $result->fetchrow ())
> > >         print ("<p>The League currently has " . $row[0] . " members.</p>");
> > > $result->free ();
> > > $conn->disconnect ();
> > > ?>
> > > </body>
> > > </html>
> > >
> > > The error that I get is:
> > > Parse error: parse error, unexpected T_Variable
> > > in /home/mike/public_html/test.php on line 12
> > >
> > > Feel free to run it for your self.
> > > http://procurement.missouri.edu/~mike/test.php
> > >
> > > I really would like for this to work so that I can follow the tutorials in the
> > > book, and eventually build a form on the web that will access the database.
> > >
> > > At this point I am so frustrated that I can't see straight.
> > > cursing loudly, has not helped at all.
> > >
> > > Thanks for your time in advance.
> > >
> > > Mike
> > >
> > > _______________________________________________
> > > members mailing list
> > > EMAIL:PROTECTED
> > > http://mlug.missouri.edu/mailman/listinfo/members
> > >
> >
> >
> > --
> > shawn
> >
>
>
> --
> shawn
>


--
shawn

_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members