Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
NewSQLDev
Starting Member
2 Posts |
Posted - 2013-04-10 : 21:28:08
|
Hi all ,im new on SQL and i have no idea why it doesnt work QUERYquote: <!DOCTYPE html><html><body><form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">User<input type="text" name="user"><input type="submit"></form><?php$user=$_POST['user'];if(isset($user)){$con=mssql_connect("SERVER","USER","PASSWORD");$ID=mssql_query("select UserUID from PS_UserData.dbo.Users where UserID='$user' ");$item=mssql_query("select ItemID from PS_GameData.dbo.UserItem where UserUID=$ID order by MakeTime");$row=mssql_fetch_assoc($ID);echo $row["UserUID"]."<br>";}?></body></html>
ERROR quote: Warning: mssql_query() [function.mssql-query]: message: Incorrect syntax near 'id'. (severity 15) in C:\xampp\htdocs\index.php on line 14Warning: mssql_query() [function.mssql-query]: Query failed in C:\xampp\htdocs\index.php on line 142
Normaly $ID should give as result "2" (without "" , its INT data )but i got a error "Incorrect syntax near 'id'. (severity 15" |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2013-04-11 : 06:17:34
|
echo the actual value of it. also, shouldn't it be more like this?"select ItemID from PS_GameData.dbo.UserItem where UserUID=" . $ID . " order by MakeTime" |
|
|
NewSQLDev
Starting Member
2 Posts |
Posted - 2013-04-11 : 16:22:15
|
unfortunaly it doesnt work , please keep the comments comming :) |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2013-04-11 : 21:57:02
|
Did you echo the value of the variable? And of the SQL string? That is how to troubleshoot it. |
|
|
|
|
|