Re: Problem with retrieving Data with MySQL
| From: | Maureen | Date: | Thu, 18 Jul 2002 21:41:07 +0000 |
| Subject: | Re: Problem with retrieving Data with MySQL | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-20641@lists.php.net to get a copy of this message | ||
I was wrong, you can use DATE_FORMAT in the sql query. I usually format it
after I take it out, using php. I apologize.
Maureen <biorn@ebmstpa.com> said:
> First of all, the function mysqlconn does not exist (unless you created it
in
> your script). There is mysql_connect, where you pass the connection
> parameters for the database, ie. hostname, username, password, etc. Then
you
> query the database with mysql_query($sql).
> There is also just mysql($db, $sqlquery) where $db is the database name and
> $sqlquery it the query, which worked in earlier versions, but I have not
been
> able to get it to work on newer versions (or maybe it is just my
> configuration).
> Try echoing $sql in the page to make sure that $issue is what you think it
> should be.
>
> Also, I don't believe you can use the DATE_FORMAT in the sql query (someone
> please correct me if I am wrong). You should format the date after
> retrieving it from the database. To test the query, if possible, do it at
> the mysql command line and see if it works there.
>
> HTH
>
> Maureen
>
>
> "Blaine D. Dinsmore" <dinsmoreb@surfbest.net> said:
>
> > $sql = "SELECT probid,loggerid,DATE_FORMAT(logdate,'%m-%d-%Y') AS
> > date," .
> > "priority,interface,screen,descript,notes " .
> > "FROM bugs WHERE probid='$issue'";
> >
> >
> > "Maureen" <biorn@ebmstpa.com> wrote in message
> > news:200207181924.NAA12893@www2.ebmstpa.com...
> > > It might help if you send the list an indication of what $sql (the
query)
> > > looks like. The only thing it appears to be returning is what was
> > initially
> > > sent to the function.
> > >
> > > Maureen
> > >
> > >
> > > "Blaine D. Dinsmore" <dinsmoreb@surfbest.net> said:
> > >
> > > > Can somone tell me what is wrong with my code here?
> > > > My e-mail does not mail me the results from the the latest database
> > entry:
> > > >
> > > > //////////////////////////////////////////////////////
> > > > // Mail Handler Routine
> > > > /////////////////////////////////////////////////////
> > > >
> > > > function mailer($issue,$host,$sql){
> > > >
> > > > $dbase="lims_issues";
> > > > mysqlconn($dbase,$sql);
> > > > While($row = mysql_fetch_assoc($result)){
> > > > $pid = $row["probid"];
> > > > $lid = $row["loggerid"];
> > > > $ldate = $row["date"];
> > > > $pty = $row["priority"];
> > > > $ifc = $row["interface"];
> > > > $scr = $row["screen"];
> > > > $desc = $row["descript"];
> > > > }
> > > > mail("dinsmoreb@michigan.gov","Issue ID: $issue","A New
> > > > Issue Has Been
> > > > Logged! \n\n".
> > > > " Issue ID: $pid \n".
> > > > " Logged By: $lid \n".
> > > > "Remote Host: $host \n".
> > > > " Log Date: $ldate \n".
> > > > " Priority: $pty \n".
> > > > " Interface: $ifc \n".
> > > > " Screen: $scr \n".
> > > > "Description: $desc \n");
> > > > mysql_free_result($result);
> > > > }
> > > >
> > > >
> > > > The E-mail that is sent looks like this:
> > > >
> > > > A New Issue Has Been Logged!
> > > >
> > > > Issue ID:
> > > > Logged By:
> > > > Remote Host: 20x.2x.xxx.xxx
> > > > Log Date:
> > > > Priority:
> > > > Interface:
> > > > Screen:
> > > > Description:
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > PHP Database Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: 4c[È
> > > > !�CZï� �Ihttp://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
>
--