Re: PHP advice

From: Date: Mon, 25 Feb 2002 16:54:44 +0000
Subject: Re: PHP advice
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-17268@lists.php.net to get a copy of this message
Hi there :) What happens when you change this line ($query = "select * from auth where password = ".$password.""; ) to this: (no periods) $query = "select * from auth where password = '$password'"; Cheers, Joe :) "Greg Lobring" <globring@hotmail.com> wrote in message news:F116N28f45wSz6btzsY000059bb@hotmail.com... > I dont understand why this is causing me so much trouble, hopefully someone > can help. I have a simple PHP script that takes the user id and password > from a form on a page...here is the php used after submitting the form: > > <? > @ $db = mysql_pconnect("localhost", "blah", "blah"); > if (!$db) > { > echo "Error: Could not connect to database."; > exit; > } > mysql_select_db("blahblah"); > $query = "select * from auth where password = ".$password.""; > $result = mysql_query($query); > $num_results = mysql_num_rows($result); > echo "Number of Rows: ".$num_results.""; > mysql_close($db); > ?> > > It connects fine, and when the query returns NO (0) rows, it appears > correct. However, when the query returns a record, I get the following > error: > > > Warning: Supplied argument is not a valid MySQL result resource in picks.php > on line 16 > > Where line 16 is the the line that says $num_results = > mysql_num_rows($result); > > > Does anyone have any advice? > > Appreciated in advance.. > > Greg > > > > _________________________________________________________________ > Chat with friends online, try MSN Messenger: > http://messenger.msn.com >

« previous php.db (#17268) next »