RE: [PHP-WIN] works on one server and not another
| From: | toby z | Date: | Fri, 11 Oct 2002 10:12:02 +0000 |
| Subject: | RE: [PHP-WIN] works on one server and not another | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-16335@lists.php.net to get a copy of this message | ||
ya tim uttam s right
check ur register globals on both ur machinez
n anothr thing to be checked
make sure the table fields u r giving in ur query r
the same as those in the db (i screwup alot vid this
:$)
n anothr good programmin practice tip bonus
make a file with connection to db n the user n include
it in all the other file will save u some time ;)
luck .....
toby ......
--- Uttam <uttam@lml.co.in> wrote: > is the
register_globals setting in php.ini is same
> in both the machines?
>
> i think u need to use $_POST[name] instead of
> $name...
>
> regds,
>
> -----Original Message-----
> From: Tim Blackwell
> [mailto:timblackwell@hotmail.com]
> Sent: Thursday, October 10, 2002 18:46
> To: php-windows@lists.php.net
> Subject: Re: [PHP-WIN] works on one server and not
> another
>
>
> below is the html form and php file that inserts the
> info into the
> database.
>
> for some reason it's not passing the data from the
> form to the php
> script
> and i'm getting undefined variables. it ends up
> just inserting a blank
> record into the database.
>
> these are the errors i get?
>
> Notice: Undefined variable: name in
> e:\web\addtutorial.php on line 26
>
> Notice: Undefined variable: date in
> e:\web\addtutorial.php on line 26
>
> Notice: Undefined variable: max in
> e:\web\addtutorial.php on line 26
>
> Notice: Undefined variable: room in
> e:\webaddtutorial.php on line 26
>
> Notice: Undefined variable: tutdesc in
> e:\web\addtutorial.php on line 26
>
> Notice: Undefined variable: name in
> e:\web\addtutorial.php on line 31
>
___________________________________________________________
> <html>
> <head>
> </head>
>
> <body>
>
> <h1>Add a tutorial</h1>
>
> <form action="addtutorial.php" method="post"
> onsubmit="return
> FrontPage_Form1_Validator(this)"
> language="JavaScript"
> name="FrontPage_Form1">
> <table border=0 height="133" width="800"
> style="border-collapse:
> collapse" bordercolor="#111111" cellpadding="0"
> cellspacing="0">
> <tr>
> <td height="17" width="160">Tutorial</td><td
> height="17"
> width="640">
> <input type="text" name="name"
> size="20"><br></td>
> </tr>
> <tr>
> <td height="17" width="160"></td><td
> height="17" width="640">
> </td>
> </tr>
> <tr>
> <td height="17" width="160"></td>
> <td height="17" width="640">
> </td>
> </tr>
> <tr>
> <td height="17" width="800" colspan="2">
> </td>
> </tr>
> <tr>
> <td height="1" width="160"></td>
> <td height="1" width="640">
> </td>
> </tr>
> <tr><td colspan=2 height="26"
> width="800"> </td></tr>
> <tr><td colspan=2 height="26"
> width="800"><input type=submit
> value="Submit"></td></tr>
> </table>
> </form>
> </body>
> </html></textarea>
>
>
________________________________________________________________________
> _
>
> <html>
> <head>
> <title>Add Tutorial to database</title>
> </head>
> <body>
> <h1>Add Tutorial</h1>
> <?
> if (!$name)
> {
> echo "You have not entered all the required
> details.<br>"
> ."Please go back and try again.";
> exit;
> }
>
> $db = mysql_pconnect("localhost", "", "");
>
> if (!$db)
> {
> echo "Error: Could not connect to database.
> Please try again
> later.";
> exit;
> }
>
> mysql_select_db("quick");
> $query = "insert into quickie values
> ('".$name."')";
> $result = mysql_query($query);
>
> if ($result)
> {
> echo "$name has been added to the tutorial
> database";
> }
> else
> {
> echo "you screwed up, fix the database ";
>
> }
> ?>
>
> </body>
> </html>
>
___________________________________________________________
>
> "Toby z" <blue_myth_1@yahoo.com> wrote in message
>
news:20021010082231.40991.qmail@web20803.mail.yahoo.com...
> > hay tim
> >
> > y doesnt it work ?????
> > vat error do u get
> >
> > its really strange coz i ve XP at my home n win2k
> pro
> > at my workplace and all the code i bring from
> home
> > vorks on my vrkplace machine
> >
> > do do lemme no bout any errors i MIGHT b able to
> help
> >
> > goodluck
> >
> > toby....
> >
> > --- Tim Blackwell <timblackwell@hotmail.com>
> wrote: >
> > this works on a windows XP machine i have but when
> i
> > > put it on a w2kserver
> > > it doesn't work?
> > >
> > >
> > > <html>
> > >
> > > <body>
> > >
> > > <?
> > >
> > > @ $db = mysql_pconnect("localhost", "", "");
> > >
> > > mysql_select_db("database_name");
> > > $query = "insert into table_name values
> > > ('".$name."')";
> > > $result = mysql_query($query);
> > >
> > > ?>
> > >
> > > </body>
> > > </html>
> > >
> > >
> > >
> > > --
> > > PHP Windows Mailing List (http://www.php.net/)
> > > To unsubscribe, visit:
> http://www.php.net/unsub.php
>
=== message truncated ===
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com