Re: Variable Appended To The End of a URL Is Not Working in SQL Query

From: Date: Tue, 02 Apr 2002 05:01:22 +0000
Subject: Re: Variable Appended To The End of a URL Is Not Working in SQL Query
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-91074@lists.php.net to get a copy of this message
The "your_variable" thing was just an example. It actually uses $id (an a real URL). "Tyler Longren" <tyler@captainjack.com> wrote in message news:003001c1da02$f46e65b0$0101a8c0@nightengale... Well, there's not $id variable. And you're trying to select it. Should be this: <?php $db = @odbc_connect('ReviewDatabase', 'root', '') or exit)("Error occured:<br>$php_errormsg"); // next line has changed $sql = "SELECT * FROM tblArt WHERE IDArt = $your_variable"; $cursor = @odbc_exec($db, $sql) or exit ("Error occrued:<br>$php_errormsg"); odbc_close($db); ?> Tyler Longren Captain Jack Communications tyler@captainjack.com www.captainjack.com ----- Original Message ----- From: "Dr. Shim" <ultimatezzz@hotmail.com> To: <php-general@lists.php.net> Sent: Monday, April 01, 2002 10:41 PM Subject: [PHP] Variable Appended To The End of a URL Is Not Working in SQL Query > I have a variable which is appeneded to the end of a URL, like > > > http://www.your_web_site.com/your_page/?your_variable=your_value > > This would return "your_value"; > > echo $your_variable; > > But this wouldn't work, and returns an error > > $sql = "SELECT * FROM fldField WHERE IDField = " . $id; > > > What could possibly be wrong? If you need more info, then tell me. Here's my > code: > > <?php > $db = @odbc_connect('ReviewDatabase', 'root', '') or > exit)("Error > occured:<br>$php_errormsg"); > $sql = "SELECT * FROM tblArt WHERE IDArt = $id"; > $cursor = @odbc_exec($db, $sql) or exit ("Error > occrued:<br>$php_errormsg"); > odbc_close($db); > ?> > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#91074) next »