Re: SQL Error
| From: | Frank M. Kromann | Date: | Sat, 04 Nov 2000 03:25:29 +0000 |
| Subject: | Re: SQL Error | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-23675@lists.php.net to get a copy of this message | ||
Add som debug information to your script.
print "$query<br>";
just before odbc_exec().
You might have a single quote in one of the columns.
- Frank
>W2K, SQL Server 7, PHP4.
>
>I had this working then I changed one field and I don't know what I did
>wrong but now I get this error:
>
>Warning: SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1:
>Incorrect syntax near 's'., SQL state 37000 in SQLExecDirect in D:\Live
>Sites\www.bloodykisses.com\phptest\moviedb_add.php on line 28
>
>My function starting from Line 20 reads:
>
>20 function
>add_to_database($Title,$Year,$Synopsis,$Also_titled,$Sequel1,$Sequel2,$Actor
>1,$Actor2,$Actor3,$Actor4,$Actor5,$Actor6,$Director,$Length,$Personal_rating
>,$dberror){
>21 // connect to a DSN called bkcontent
>22 $db=odbc_pconnect("bkcontent","user","password");
>23 if(!$db){
>24 $dberror="Couldn't connect to SQL server";
>25 return false;
>26 }
>27 $query="INSERT INTO movies
>(Title,Year,Synopsis,Also_titled,Sequel1,Sequel2,Actor1,Actor2,Actor3,Actor4
>,Actor5,Actor6,Director,Length,Personal_rating)
>values('$Title','$Year','$Synopsis','$Also_titled','$Sequel1','$Sequel2','$A
>ctor1','$Actor2','$Actor3','$Actor4','$Actor5','$Actor6','$Director','$Lengt
>h','$Personal_rating')";
>28 $result=odbc_exec($db,$query);
>29 return true;
>30 }
>
>Does anyone know what is causing this error?
>
>TIA,
>jb
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>For additional commands, e-mail: php-general-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
>