SQL PHP code help please

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
reecec
Forum Contributor
Posts: 218
Joined: Sun Apr 02, 2006 7:12 am

SQL PHP code help please

Post by reecec »

patrikG | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


hi dont know if any one could help please 
what is wrong with this code im sure i have got it all wrong  im a beginer at php 
i have left mysql login out obviosly thats not what the problen is

Code: Select all

<?php
$server = "not shownn";
$dbuser = "not shown";
$dbpass = "not shown";
$dbname = "not shown";
$dbtable = "not shown";

// Connect to the database
mysql_connect($server,$dbuser,$dbpass) or die ("Could not establish connection"); // make connection
mysql_select_db($dbname); // select database

$request = "DELETE FROM login WHERE username= '$deluser'
$result = mysql_query($request);
if($result){
echo "You Successfully Deleted '$deluser'";
} else {
echo "The deleion of'$deluser' Failed";
}
?>
patrikG | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

[url]http://www.rjcdesigns.co.uk[/url]
Last edited by reecec on Thu Apr 13, 2006 6:09 pm, edited 1 time in total.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

You tell us what the problem is. Any error messages?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: SQL PHP code help please

Post by RobertGonzalez »

reecec wrote:

Code: Select all

<?php
$request = "DELETE FROM login WHERE username= '$deluser'
?>
You didn't close your quote or end your line. The line above should be...

Code: Select all

<?php
$request = "DELETE FROM login WHERE username= '$deluser'";
?>
reecec
Forum Contributor
Posts: 218
Joined: Sun Apr 02, 2006 7:12 am

hi

Post by reecec »

thanks it fixed yes sorry about the php box
Post Reply