| Author |
Topic  |
|
|
ITdevGirl
Starting Member
Canada
3 Posts |
Posted - 06/22/2012 : 12:10:41
|
Hello,
I am new to this forum and I was wondering if you could help me. I have a website I am working on a database for, and to insert new data into the table is not a problem, even to output the table isn't an issue.
But a delete query won't work and it doesn't return any errors or echo commands that I put in the steps of the logic.
Should I include my code
Many Thanks |
|
|
xhostx
Constraint Violating Yak Guru
USA
261 Posts |
Posted - 06/22/2012 : 12:33:42
|
quote: Originally posted by ITdevGirl
Hello,
I am new to this forum and I was wondering if you could help me. I have a website I am working on a database for, and to insert new data into the table is not a problem, even to output the table isn't an issue.
But a delete query won't work and it doesn't return any errors or echo commands that I put in the steps of the logic.
Should I include my code
Many Thanks
Could you please paste some of your script so that we can see what you have there.
Thanks,
kml |
 |
|
|
ITdevGirl
Starting Member
Canada
3 Posts |
Posted - 06/22/2012 : 12:35:50
|
<?php if($errors == 0) { echo "success1!\n"; $DBConnect = @mysql_connect("db.start.ca", "nokeekwe", "1rcPass"); if($DBConnect === FALSE) { echo "<p>Unable to connect. " . "Error code " . mysql_errno() . ": " . mysql_error() . "</p>\n"; $errors++; } else { echo "success2!\n"; $DBName = "nokeekwe"; $result = @mysql_select_db($DBName, $DBConnect); if($result === FALSE) { echo "<p>Unable to select DB. " . "Error code " . mysql_errno($DBConnect) . ": " . mysql_error($DBConnect) . "</p>\n"; $errors++; } } } if($errors > 0) {
echo "<p>Please use your browser's BACK button" . " to return to the form and fix your errors.</p>\n"; } echo "success3!\n"; if($errors == 0) {
echo "success4!\n"; if(isset($_COOKIE['jobID'])) { $TableName = "tbljobs"; $SQLstring = "DELETE $TableName.* FROM $TableName WHERE $TableName.jobID = {$_COOKIE['jobID']}"; $QueryResult = @mysql_query($SQLstring, $DBConnect); echo "success5!" . $_COOKIE['jobID'] . "\n"; if($QueryResult === FALSE) { echo "<p>Unable to save your review. " . " Error code " . mysql_errno($DBConnect) . ": " . mysql_error($DBConnect) . "</p>\n"; $errors++; } else { echo "success!\n"; } } } } } ?>
this is a form action page using the method request from a php page that shows the table contents with 2 forms that include two buttons: one form has a delete button and one form that includes an edit button.
Non of the echo commands show and no errors are outputted either. |
 |
|
|
xhostx
Constraint Violating Yak Guru
USA
261 Posts |
Posted - 06/22/2012 : 13:00:14
|
hi,
Try and test $SQLstring = "DELETE * FROM $TableName WHERE $TableName.jobID = {$_COOKIE['jobID']}";
Question: is this a Microsoft SQL database? if so, which version?
Thanks
kml |
 |
|
|
ITdevGirl
Starting Member
Canada
3 Posts |
Posted - 06/22/2012 : 13:08:04
|
Server version: 5.1.50-log Protocol version: 10 MySQL client version: 5.0.27 Used PHP extensions: mysql
changed line to: $SQLstring = "DELETE * FROM $TableName WHERE $TableName.jobID = {$_COOKIE['jobID']}"; still blank page follows without any of the echo commands and therefore I can't even check if $_COOKIE['jobID'] has the right or any value at all...what could be the reason? |
 |
|
|
DonAtWork
Flowing Fount of Yak Knowledge
2111 Posts |
|
|
bitsmed
Yak Posting Veteran
Denmark
98 Posts |
Posted - 06/22/2012 : 17:10:17
|
syntax for delete in all sql databases I have come a cross is:
delete from table where .... |
 |
|
| |
Topic  |
|