mysql_query("UPDATE default SET path = $path WHERE id = $id") or die(mysql_error());
It returns the error:
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 default WHERE id = 15 at line 1
$path is defined in a previous statement and is used multiple times in the page- so I know the variable is set. The mysql connection is not closed at this point- so I know it s not that either.
I am at my wits end here. Can someone please help me out with any suggestions?
i am hosting both php and mssql localy so i am able to change settings if need be
(the resason im using ms sql instead of mysql is the databse i need to use is used for other programs and i need to pull info that the other programs create )
As per suggestions from yahoo answers users I used header function to solve my problem- but on execution it shows warnings and the target page does nt open
Look at the entire code which I tried
<?php
if (!$_POST[ login ])
{
?>
<table cellspacing="5" cellpadding="5">
<form action="<?php echo $_SERVER[ PHP_SELF ]; ?>" method="post">
<tr>
<td valign="top"><b><font size="-3">Username</font></b></td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td valign="top"><b><font size="-3">Password</font></b></td>
<td><input type="password" name="password"></td>
</tr>
<tr>
<td><input type="submit" name="login" value="login"></td>
</tr>
</form>
</table>
<?php
}
else
{
$uid=$_POST[ uid ];
$username=$_POST[ username ];
$password=$_POST[ password ];
$conn=mysql_connect( localhost - - ) or die (mysql_error());
$db=news;
mysql_select_db($db) or die (mysql_error());
continued
-continued
$result=mysql_query("select username from useraccounts where username= $username and password= $password ")
or die(mysql_error());
if(mysql_num_rows($result)==0)
{
header("Location:demo1.php");
}
else
{
63 session_start();
$result=mysql_query($sql);
65 $row=mysql_fetch_array($result);
$_SESSION[ uid ]=$_POST[ uid ];
68 header("Location: demo.php");
}
}
?>
But on running --
Warning: Cannot send session cookie - headers already sent by (output started at c:\apache\htdocs\project\demo1.php:12) in c:\apache\htdocs\project\demo1.php on line 63
Warning: Cannot send session cache limiter - headers already sent (output started at c:\apache\htdocs\project\demo1.php:12) in c:\apache\htdocs\project\demo1.php on line 63
Warning: Supplied argument is not a valid MySQL result resource in c:\apache\htdocs\project\demo1.php on line 65
Warning: Cannot add header information - headers already sent by (output started at c:\apache\.
plz help.
Ok- well first of all this is part of a registration process where the news variable is placed in a database. The news variable is whether or not the user wishes to be part of the monthly newsletter from a checkbox. The form on a previous page links to this code but when I try it out an error occurs saying unexpected T_STRING on this line.
$news=($_POST[ news ] == "on")?"echo "on"":"echo "off"";
Thanks for any help !
Ok- well first of all this is part of a registration process where the news variable is placed in a database. The news variable is whether or not the user wishes to be part of the monthly newsletter from a checkbox. The form on a previous page links to this code but when I try it out an error occurs saying unexpected T_STRING on this line.
$news=($_POST[ news ] == "on")?"echo "on"":"echo "off"";
Thanks for any help !
Warning: mysql_connect() [function.mysql-connect]: Can t connect to MySQL server on 89.46.37.9 (4) in /var/www/frugooscape/index.php on line 9
Can t connect to MySQL server on 89.46.37.9 (4)
No comments:
Post a Comment