Page 1 of 1

SQL PHP code help please

Posted: Sun Apr 02, 2006 7:16 am
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]

Posted: Sun Apr 02, 2006 7:43 am
by patrikG
You tell us what the problem is. Any error messages?

Re: SQL PHP code help please

Posted: Sun Apr 02, 2006 9:47 am
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'";
?>

hi

Posted: Sun Apr 02, 2006 11:28 am
by reecec
thanks it fixed yes sorry about the php box