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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php/MySQL error message

Status
Not open for further replies.

smiffy47

Programmer
Apr 6, 2004
95
GB
I am trying to find my way about php/MySQL as processed by DWMX2004. I have put together a couple of pages that
(i) insert text data to a MySQL and
(ii) edit that data.
My pages work fine on my local WAMP5 server, but when I put the pages on to my remote server I hit a problem. The first page operates fine, links to the database and will insert the data I send. However when I try to move to the next page I just receive the following message:

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

How is it that the page can work on my server and fail on the remote one?
How can I tell which is "line 1"
Any guidance please?
I attach the URL of the Code in a .rtf file.
Thanks.

Life...It's difficult not to take it personally.
 
Thanks. But as a greenhorn in the whole SQL/php world I need a bit more guidance here. (Up until now I've just let DW do the coding work for me)
Perhaps and example of how I might use your

echo($what_the_command_string_is);
exit;

code would help me over the next hump of ignorance.

Steve

Life...It's difficult not to take it personally.
 
The difficulty I am having here is that I receive the error message

"You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1"

but I can't see/tell which section of my code the error report refers to.
The error report is the only response I get to the page.
As far as I can see the page, rejected by the remote server is the same as the code accepted by my localhost.

Life...It's difficult not to take it personally.
 
The error doesn't refer to your PHP code, but to your actual MYSQL query. Which is why Chris suggested, you output the query before actually running it, so you can check that its formed correctly.

From your code, I see two places where you run a query, but I haver no way of knowing which one is producing the error. So I would place Chris's code before each call to mysql_query() and check the produced query line to make sure its correct.

Place it here:
Code:
  mysql_select_db($database_tormented, $tormented);
[red]echo($updateSQL);
[/red]  
$Result1 = mysql_query($updateSQL, $tormented) or die(mysql_error());

and here:

Code:
mysql_select_db($database_tormented, $tormented);
$query_rstSix = sprintf("SELECT * FROM chk_sixmonth WHERE ck_pk = %s", $colname_rstSix);
[red]echo($query_rstSix);
[/red]

Reasons for it, maybe that your local server is a newer version than the one on your web host and the query produced by dreamweaver is not supported by the web host, but is by your local version.



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top