Thanks for the suggestion Mark but I have just another line of defaults and
the same comments in the browser.

Joseph

> > I always hesitate to make mails too long with code,
>
> In this case it's probably worth it, your first query looks funny:
> $query = ("SELECT
> shouldn't it be
> $query = "SELECT etc.....";
>
> not much, but see what happens...
>
> hth!
>
> cheers,
>
>        Mark
>
>
> > Here's is the whole script:
> > <?php
> >  error_reporting(E_ALL);
> > //error_reporting();
> >
> include$_SERVER['DOCUMENT_ROOT'].'/www.poetryadmin.com/spw_layout.php
> ';
> >  myheader();
> >  include$_SERVER['DOCUMENT_ROOT'].
> >           '/www.poetryadmin.com/html/forms/test option
> > spw_poemtypelist_form.html';
> >
> >      $username="root";
> > $password='';
> > $database="spw";
> > $localhost="127.0.0.1";
> > mysql_pconnect(localhost,$username,$password);
> > mysql_select_db($database) or die('failed to select DB');
> >
> > if (isset($_POST['source'])) {
> > $source = $_POST['source'];
> > echo '$_POST is set.';
> > } else {
> > $source = NULL;
> > echo '$_POST is not set.';
> > }
> >
> > echo "<p>$source</p>";
> >
> >
> > $query = ("SELECT  spw_poems_id  FROM  spw_poems
> >  WHERE spw_poems_title = '{$_POST['poem_title']}' ") or die("Querya
> failed
> > ".mysql_error());
> > $title = mysql_query($query) or die("Query1 failed" .
> mysql_error());
> >
> >  $result = mysql_query($query);
> > if (!$result) {
> >      // there was a problem
> >      echo mysql_error();
> >      echo " SQL: $sql \n";
> > } else {
> >      // read the results
> >      while ($row = mysql_fetch_row($result)) {
> >         $spw_poems_id[] = $row[0];
> >      }
> > }
> >
> > echo "$title";
> >
> > $query2 = "SELECT spw_type_id FROM spw_type
> >  WHERE spw_type_description='{$_POST['poemtype']}'";
> >  echo mysql_result($query2);
> > $type = mysql_query($query2) or die("Query2 failed" .
> mysql_error());
> > echo "$type";
> >
> > $sql = mysql_query("INSERT INTO spw_typelist (
> > spw_typelist_id ,
> > spw_poems_id,
> > spw_type_id) VALUES ('',
> > '$title',
> > '$type')
> >
> > ") or die ("Query3 failed".mysql_error());
> >  // run the query
> >    mysql_query($sql);
> >   if(!sql){
> >     echo "Error inserting your info into mysql:  ".mysql_error();
> >
> >
> >    footer();
> >    exit();
> >    }
> >
> >  ?>
> > > >>Sheila wrote:
> > > >>
> > > >>Are you doing something like this? Query followed by fetch?
> > > >>
> > > >>$result = mysql_query($query);
> > > >>if (!$result) {
> > > >>     // there was a problem
> > > >>     echo mysql_error();
> > > >>     echo " SQL: $sql \n";
> > > >>} else {
> > > >>     // read the results
> > > >>     while ($row = mysql_fetch_row($result)) {
> > > >>        $spw_poems_id[] = $row[0];
> > > >>     }
> > > >>}
> > > >>
> > > >>
> > > >>The array $spw_poems_id will contain all ids returned by the
> query, or
> > > >>it will be empty if there were no matches.
> > > >>
> > >
> > > Joseph Harris wrote:
> > > >
> > > > A bit simpler than that:
> > > >
> > > > echo "mysql_result()";
> > > >
> > > > $title = mysql_query($query) or die("Query1 failed" .
> mysql_error());
> > > > echo "$title";
> > > >
> > > > And $title is then put into the INSERT query.
> > > >
> > > > The process is working.   The SELECT (there are two) picks up
> the form
> > > > entry, and the table has a row filled.    But the id is not
> being
> > selected
> > > > and so the $title gets a zero in the table column instead of
> the
> > appropriate
> > > > id number.   I cannot see why the SELECT does not return the id
> number
> > > > (unless it needs adapting for integers travelling between
> smallint
> > columns).
> > > >
> > >
> > > You've got the function calls reversed. You're asking for
> mysql_result()
> > > before sending the $query to mysql_query();
> > >
> > > Try it the way I've shown. mysql_query() returns a $result and
> that is
> > > fed into mysql_fetch_row().
> > >
> > > Sheila


____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] 
       Send Your Posts To: [EMAIL PROTECTED]
To set a personal password send an email to [EMAIL PROTECTED] with the words: "set 
WDVLTALK pw=yourpassword" in the body of the email.
To change subscription settings to the wdvltalk digest version:
    http://wdvl.internet.com/WDVL/Forum/#sub

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.

Reply via email to