Re: MySQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



GAH!  I don't userstand why this woudl work onyl once, then return a
Error retrieving records.I've even recreated the sql DB, same result.
"Jeff" <jroth1@telus.net> wrote in message
20030801200125.18007.qmail@pb1.pair.com">news:20030801200125.18007.qmail@pb1.pair.com...
> Well, it worked for ONE submission....  I was so excited. :)
>
> Then I went back to enter another test, and when I went back to the page,
it
> displayed everything up to that line again, but JUST output, " Error
> retrieving records. "
>
> ???  Why woudl it work just once?
>
> "Mel Hodges" <Mel@AGoodKnife.com> wrote in message
> 1059767655.3f2ac5673a9ce@www.melhodges.com">news:1059767655.3f2ac5673a9ce@www.melhodges.com...
> > Myfault.. you should be using link_id instead of dbHandletry this:
> >
> > $result = mysql_query($strSQL, $link_id) OR DIE("Error retrieving
> records.");
> >
> >
> >
> >
> >
> >
> > Quoting Jeff <jroth1@telus.net>:
> >
> > > K, that got my a bit further, now it shows half the page but stops at
> the
> > > line:
> > >
> > > $result = mysql_query($strSQL, $dbHandle) OR DIE("Error retrieving
> > > records.");
> > >
> > > With error:
> > >
> > > Warning: mysql_query(): supplied argument is not a valid MySQL-Link
> resource
> > > in C:\FoxServ\www\encana_db.php on line 40
> > > Error retrieving records.
> > >
> > > BTW, thank you everyone for your help.
> > >
> > >
> > > "Mel Hodges" <Mel@AGoodKnife.com> wrote in message
> > > 1059766766.3f2ac1ee68ffc@www.melhodges.com">news:1059766766.3f2ac1ee68ffc@www.melhodges.com...
> > > > Try this:
> > > >
> > > > $strSQL = "INSERT INTO gradients (kwo, lsd, date, well, field, uni,
> > > license,
> > > > formation) VALUES
> > > > ('$kwo', '$lsd', '$date', '$well', '$field', '$uni', '$license',
> > > '$formation')";
> > > > $result = mysql_query($strSQL, $dbHandle) OR DIE("Error retrieving
> > > records.");
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Quoting Jeff <jroth1@telus.net>:
> > > >
> > > > > Yes I'm new at this - sorry for sounding like an idiot.  I'm a
> network
> > > guy,
> > > > > not a coder by any means - just learning.  (Company "project")
> > > > >
> > > > > > First of all, get rid of all those extraneous open and close (
> > > > > > ?><?php) tags that your editor put in -
> > > > >
> > > > > Done - it isn't the editor, I put them there - a lot of diffrent
> > > testing,
> > > > > and havn't had a changce to clean it up yet.
> > > > >
> > > > >  >(or is this code cobbled from
> > > > >  >other places?).
> > > > >
> > > > > No, that's plagerisum. :P  Doing this all form a book I purchased
> which
> > > > > dosn't cover MySQL as much as I had hoped.  Thats what I get for
> buying
> > > it
> > > > > online. :P
> > > > >
> > > > > >Second, the line in question is not valid PHP code.
> > > > >
> > > > > I figured as much, and did as you said, but it's still returning
an
> > > error.
> > > > >
> > > > >  >It's SQL. Put it in quotes, assign it to a variable, and call it
> > > > >  >through a mysql_query() function.
> > > > >
> > > > > Error:  Parse error: parse error, unexpected T_STRING in
> > > > > C:\FoxServ\www\encana_db.php on line 36
> > > > >
> > > > > My new code:
> > > > >  <?php
> > > > > $PHP_SELF = mysql_query(INSERT INTO gradients (kwo, lsd, date,
well,
> > > field,
> > > > > uni, license, formation) VALUES ('$kwo', '$lsd', '$date', '$well',
> > > '$field',
> > > > > '$uni', '$license', '$formation') )
> > > > > ?>
> > > > >
> > > > > > --- Jeff <jroth1@telus.net> wrote:
> > > > > > > Sorry, I just realized that's an older copy of the code, here
is
> > > > > > > the updated stuff - (It's just one more line, the line that's
> > > > > > > giving me greaf. :P  )
> > > > > > >
> > > > > > > <?php
> > > > > > >    $link_id = mysql_connect("localhost","admin","*******")
> > > > > > >             or die("Unable to connect to SQL server");
> > > > > > >         mysql_select_db("database",$link_id)
> > > > > > >             or die("Unable to select database");
> > > > > > >                                          ?>
> > > > > > >
> > > > > > >  <?php
> > > > > > >
> > > > > > > global $PHP_SELF
> > > > > > >
> > > > > > >    ?>
> > > > > > >
> > > > > > >  <?php
> > > > > > >   // echo $results;
> > > > > > >    ?>
> > > > > > >
> > > > > > >
> > > > > > > <HTML>
> > > > > > > <HEAD>
> > > > > > > <TITLE>DB</TITLE>
> > > > > > > </HEAD>
> > > > > > >
> > > > > > > <BODY BGCOLOR="white">
> > > > > > >
> > > > > > > <a href="index1.php"> Home </a>|<a href="list_db.php"> Display
> All
> > > > > > > </a>|<a href=""> Search </a>
> > > > > > > <BR>
> > > > > > > Total Entries:
> > > > > > > <?php
> > > > > > >     $query = "SELECT COUNT(*) FROM gradients";
> > > > > > >     $num_count = mysql_query($query) or die("Select Failed!");
> > > > > > >     $count = mysql_fetch_array($num_count);
> > > > > > >
> > > > > > > ?>
> > > > > > >
> > > > > > > <A HREF="
> > > > > > > <?$PHP_SELF?>
> > > > > > >
> > > > > > > ?complete=1">
> > > > > > > <?php echo $count[0]; ?>
> > > > > > > </a>
> > > > > > >
> > > > > > > <BR><div align="center"><img
src=http://dataguy/logo_small.jpg>
> > > > > > >
> > > > > > > <BR><b>Title for page</B><BR></div>
> > > > > > >
> > > > > > > <?php
> > > > > > > INSERT INTO gradients (kwo, lsd, date, well, field, uni,
> license,
> > > > > > > formation) VALUES ('$kwo', '$lsd', '$date', '$well', '$field',
> > > > > > > '$uni', '$license', '$formation')
> > > > > > > ?>
> > > > > > >
> > > > > > >     <div align="center">
> > > > > > >      <FORM METHOD="post" ACTION="<?php echo $PHP_SELF ?>">
> > > > > > >   <HR><HR>
> > > > > > > <PRE> <b>
> > > > > > >
> > > > > > >             KWL WO#: <INPUT TYPE="text" NAME="kwo" VALUE="">
> > > > > > > LSD: <INPUT TYPE="text" NAME="lsd" VALUE="">
> > > > > > >      Date Completed: <input type="text" name="date" value="">
> > > > > > > Well Name: <INPUT TYPE="text" NAME="well" VALUE="">
> > > > > > >          Fieled/Pool: <INPUT TYPE="text" NAME="field"
VALUE="">
> > > > > > > Unique: <INPUT TYPE="text" NAME="uni" VALUE="">
> > > > > > >           License #: <input type="text" name="license"
value="">
> > > > > > > Formation: <input type="text" name="formation" value="">
> > > > > > >               Perfs: <input type="text" name="perfs" value="">
> > > > > > > Event No.: <input type="text" name="event" value="">
> > > > > > >   Well Fluid Status: <input type="text" name="fluid" value="">
> > > > > > > Well
> > > > > > > Status Mode: <input type="text" name="mode" value="">
> > > > > > >    Well Status Type: <input type="text" name="type" value="">
> > > > > > > Type V/D/H: <input type="text" name="vdh" value="">
> > > > > > >          File Name:  <input type="text" name="file" value="">
> > > > > > > KB: <input type="text" name="kb" value="">
> > > > > > >                 GRD: <input type="text" name="grd" value="">
> > > > > > > Open Hole: <input type="text" name="open" value="">
> > > > > > >                Sour: <input type="text" name="sour" value="">
> > > > > > > Tubing Size: <input type="text" name="tube" value="">
> > > > > > >            Landed @: <input type="text" name="landed"
value="">
> > > > > > > Casing Size: <input type="text" name="casing" value="">
> > > > > > >            Landed @: <input type="text" name="landed2"
value="">
> > > > > > > Shut In Date: <input type="text" name="shut_date" value="">
> > > > > > >        Shut In Time: <input type="text" name="shut_time"
> value="">
> > > > > > > Pres
> > > > > > > TUB/CAS KPAg: <input type="text" name="pres" value="">
> > > > > > >            Tag PBTD: <input type="text" name="tag" value="">
> > > > > > >
> > > > > > > <br>  <HR><HR>
> > > > > > > <INPUT TYPE="submit" VALUE="Submit">
> > > > > > >
> > > > > > > </PRE>    </b>
> > > > > > > </FORM>
> > > > > > > </div>
> > > > > > >
> > > > > > >
> > > > > > > <BR><BR>
> > > > > > >
> > > > > > > </head>
> > > > > > > </HTML>
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > "Jason Wong" <php-db@gremlins.biz> wrote in message
> > > > > > > 200308020214.46435.php-db@gremlins.biz">news:200308020214.46435.php-db@gremlins.biz...
> > > > > > > > On Saturday 02 August 2003 01:46, Jeff wrote:
> > > > > > > >
> > > > > > > > > I tried doing this through the news server, but something
> > > > > > > messed up.
> > > > > > > > >
> > > > > > > > > I just need to know how to make an HTML form write to a
> MySQL
> > > > > > > DB.
> > > > > > > > > This is what I have so far.
> > > > > > > >
> > > > > > > > [snip]
> > > > > > > >
> > > > > > > > And does it work? If it works then congratulations. If it
> doesn't
> > > > > > > work, *how*
> > > > > > > > doesn't it work.
> > > > > > > >
> > > > > > > > If you're new to all this, you might want to start by
reading
> > > > > > > some of the
> > > > > > > > numerous tutorials available (google for them) and follow
> through
> > > > > > > a few of
> > > > > > > > them.
> > > > > > > >
> > > > > > > > --
> > > > > > > > Jason Wong -> Gremlins Associates -> www.gremlins.biz
> > > > > > > > Open Source Software Systems Integrators
> > > > > > > > * Web Design & Hosting * Internet & Intranet Applications
> > > > > > > Development *
> > > > > > > > ------------------------------------------
> > > > > > > > Search the list archives before you post
> > > > > > > > http://marc.theaimsgroup.com/?l=php-db
> > > > > > > > ------------------------------------------
> > > > > > > > /*
> > > > > > > > Sometimes a man will tell his bartender things he'll never
> tell
> > > > > > > his doctor.
> > > > > > > > -- Dr. Phillip Boyce, "The Menagerie" ("The Cage"),
> > > > > > > >    stardate unknown.
> > > > > > > > */
> > > > > > > >
> > > > > >
> > > > > >
> > > > > > =====
> > > > > > Mark Weinstock
> > > > > > mark_weinstock@yahoo.com
> > > > > > ***************************************
> > > > > > You can't demand something as a "right" unless you are willing
to
> > > fight to
> > > > > death to defend everyone else's right to the same thing.
> > > > > > ***************************************
> > > > > >
> > > > > > __________________________________
> > > > > > Do you Yahoo!?
> > > > > > Yahoo! SiteBuilder - Free, easy-to-use web site design software
> > > > > > http://sitebuilder.yahoo.com
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > PHP Database Mailing List (http://www.php.net/)
> > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
> >
> >
>
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux