Re: PHP and MYSQL query

From: Date: Sun, 11 Mar 2001 00:14:04 +0000
Subject: Re: PHP and MYSQL query
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-7280@lists.php.net to get a copy of this message
Use mysql_error() can give a hint of what is going wrong. $result = mysql_query($query) or die( mysql_error()); HTH Jayme. -----Mensagem Original----- De: Oson, Chris M. <CHRIS.M.OSON@saic.com> Para: Jim Ray <jaray@relaypoint.net> Cc: <php-db@lists.php.net> Enviada em: sábado, 10 de março de 2001 16:57 Assunto: RE: [PHP-DB] PHP and MYSQL query > For starters, your statement is wrong... > > $result = mysql_query($strSQL, $db); > > where $db is your connection string to the database you already have opened. > > If you have problems with your sql statement, try something like this and > see > what your results are: > > $strSQL = "SELECT * FROM $TA WHERE $SortField = '$search%' ORDER BY > $SortField"; > print $strSQL; > > $result = mysql_query($strSQL); > > Once you have the results of the query printed out, copy and paste it into > the > command line in mySQL. You'll know if you're doing something wrong or not. > > -----Original Message----- > From: Jim Ray [mailto:jaray@relaypoint.net] > Sent: Friday, March 09, 2001 8:03 PM > To: php-db@lists.php.net > Subject: [PHP-DB] PHP and MYSQL query > > > I have a simpe query that I can not seem to get to work. > > Here is the HTML side: > <td width="27%" align="center"><form > action="luquery.php?DB=csjoa&amp;TA=associates&amp;SortField=company" > method="post"><input type="text" > name="search"><br><input > type="submit"></form></td> > > > > Here is the PHP side: > > The fields are being past, but I get 0 in the results? > > $result=mysql_query("select * from $TA where $SortField='$search%' order > by $SortField"); > > Am I missing something here? > > Thanks for the help. > > Jim > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#7280) next »