Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP / ODBC / MYSQL

Status
Not open for further replies.

rbvcbr

IS-IT--Management
Mar 4, 2007
58
US
When I run this I can write "userid"
where you see Welcome,

But it is not working with my sql statement.
Need code help please. Can somebody fix this.

I tried GET and POST, no luck.

Thank you,

----------------------------------------

Welcome <?php echo $_REQUEST["userid"]; ?>.<br />

<?php
$conn = odbc_connect("dsnname", "username", "password");
if (!$conn)
{
exit("Connection Failed: " . $conn);
}
$sql="SELECT * FROM usersNew where userid =$_REQUEST[userid]";
$rs=odbc_exec($conn,$sql);
if (!$rs)
{
exit("Error in SQL");
}
?>
 
Repeating request.
Any help on originally posted question.
Thank you,
 
Try this for your sql statement:
Code:
$sql="SELECT * FROM usersNew where userid =" .$_REQUEST[userid];
 
By the way, you're also missing quotes in your $_REQUEST statement...you have $_REQUEST[userid]...this should be $_REQUEST["userid"]...I copied yours and realized afterwards that it had no quotes...if you use my sql statement, you will also need to add quotes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top