[nycphp-talk] Additional eyes for troublesome (but simple) mysql functions?
Dell Sala
dell at sala.ca
Fri Dec 1 09:37:14 EST 2006
You should be passing the connection resource ($dbh) to mysql_query
(), not the result of mysql_select_db(). mysql_select_db() just
returns a boolean.
-- Dell
On Dec 1, 2006, at 9:29 AM, R. Mariotti wrote:
> Gentlemen;
>
> I've been playing with this for a full day now trying various
> formats without luck. I'm convinced that I must be missing something.
>
> So, before the weekend come around and I literally forget
> everything I know about this, I thought I would post my error
> sections for some peer assistance.
>
> Can someone please take a look and see if there is anything obvious
> and advise (I'm beyond embarrassment). The lines beginning with
> >>>> are debugging lines to show what is contained in certain fields.
>
> /
> **********************************************************************
> **************/
> /* Determine if Specified 'system_id' is new or existing and set
> action accordingly */
>
> >>>> qb_default->db_host=[raid]
>
> >>>> qb_default->db_user=[qb_user]
>
> >>>> qb_default->db_password=[********]
>
> >>>> qb_default->dbname=[quote_build_test]
>
> $dbh = mysql_connect($qb_default->db_host,$qb_default->db_user,
> $qb_default->db_password);
>
> >>>> dbh=[Resource id #5]
>
> $rtn = mysql_select_db($qb_default->dbname,$dbh);
>
> >>>> rtn=[1]
>
> $sql="select id from $qb_default->system_list where id =
> '$system_id' limit 1";
>
> >>>> sql=[select id from systems where id = '181' limit 1]
>
> $req=mysql_query($sql,$rtn);
>
> >>>> Warning: mysql_query(): supplied argument is not a valid
> MySQL-Link resource
>
>
> As you can see by the Warning message... mysql is stating that the
> $rtn field I am sending is NOT a valid resource. However, it is
> the result of the previous mysql_select_db and seems OK.
>
> What am I missing???
>
> Thanks all!
>
> bobmct
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
More information about the talk
mailing list