473,399 Members | 3,302 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Problem with deleting from a database

Hi

I got a little problem with deleting from my database, i'm making a
simple newsscript. I get a Parse error: syntax error, unexpected
T_ELSE on line 24, I have written the error as a comment further down
in the source delete_news.php on line 24.

Would be really nice if someone could help me on this :)

**** delete_news.php ****

<form method="get" action="delete_news.php">
<?
include ("db.php");

mysql_connect("$dbhost","$dbusername","$dbpasswd") ;
mysql_select_db("$dbname");
if(!$submit)
{
$result = mysql_query("select * from add_news order by id") or
die(mysql_error());
while($r=mysql_fetch_array($result))
{
$title=$r["title"];
$id=$r["id"];
?>
<INPUT TYPE="RADIO" NAME="id" VALUE="<?php echo $id;?>"><br>
<?php echo $id;?><br>
<?php echo $title;?><br>
<?
}?>
<input type="submit" value="submit" name="submit"></form>
<?
}?>
<?
else // I get a Parse error: syntax error, unexpected T_ELSE (24)
{
$sql = "DELETE FROM add_news WHERE id=$id";
$result = mysql_query($sql);
echo "News deleted!";
}?>
Jul 17 '05 #1
1 1546


}?>
<input type="submit" value="submit" name="submit"></form>
<?
}
else // I get a Parse error: syntax error, unexpected T_ELSE (24)
{
$sql*=

--
Sat_
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Chris Bolus | last post by:
I'm a teacher using MS Access on an RMConnect 2.4 network. On some workstations both I and my students sometimes get an error message when attempting to insert a command button on a form which...
2
by: Robert McGregor | last post by:
Hi all, I've got a Front End / Back End database that was working just fine. One day i opened the FE to find that if I tried to open one of the linked tables from the database window, nothing...
1
by: Richard | last post by:
I have a MSAccess 2000 database that adds peoples info from the database to Outlook Contacts using Automation - this works fine. Problem comes when entering a birthday field to Outlook - What...
13
by: Bob Darlington | last post by:
I have a repair and backup database routine which runs when a user closes down my application. It works fine in my development machine, but breaks on a client's at the following line: If...
4
by: JN | last post by:
Hi all, I have some pages where I need to delete/update database records. Everything is fine until I hit the refresh button on the browser (IE). This will cause the pages to repeat the last...
5
by: George | last post by:
VB.net 2003 standard, XP windows home edition. Installed first application OK today. When I removed the application via Control Panel, there were no problems and the app folders were deleted. ...
2
by: azmiza | last post by:
Hi everybody, I need your help. I want to view my sql database and its work very well which is display in my web browser but once I want to press button yes, its not working, I check the...
4
by: sphinney | last post by:
I'm not exactly sure how to start this post. My question is pretty simple, but it will take a little bit of context before I can state it. (And thanks in advance for taking the time to read this!) ...
1
by: Kyosuke18 | last post by:
Hi everyone, I have a problem in deleting a data that is connected on the database.. I tried this code but it shows me an error: Run-time error '-2147217900(80040e14)': Syntax error in string in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.