Delete Query Successful
How can I test whether a delete query on any other query for that matter has been successful deleting a record. I tried below but it does'nt return if the query deleted a record.
$deletequery= "DELETE FROM details WHERE id='$line[id]'
AND orderid='$orderid'
AND location='".LOCATION."'";
mysql_query($deletequery) or die(ErrorDB($realname)) ;
$message = (!$deletequery) ? 'ERROR' : "<font color='#FF0000'>DONE</font>";
echo "$message<br>";
View Complete Forum Thread with Replies
Related Forum Messages:
Successful / Unsucessful Delete
Successful / Unsucessful delete froma data base: i have used code like the folowing to tell me if a DB update has been successful or not but when trying to tell me if it has deleted.. PHP Code:
View Replies !
Mysql Delete - $query = Mysql_query("DELETE
how would i do the following ? $query = mysql_query("DELETE notes, datestamp, abs_value, ID FROM absence_mgt WHERE datestamp='$date' AND ID='$vtc_login' ") or die(mysql_error()); im just getting "Unknown table 'notes' in MULTI DELETE" ?
View Replies !
Delete Query
Here’s what I’m trying to do: - Output the last 60 results in my db - works - Delete a record – does not work Can anyone see why my delete query won’t work? It seems to have two problems: 1) It does not delete a record 2) The header re-direct says can’t modify header information Code:
View Replies !
Mysql Query : Delete From *
When I use phpmyadmin, and run this sql query, it will tell me that it affected X amount of rows (lets say 10). However, when i run my script, it doesnt' tell me that. Code:
View Replies !
Simple Delete Query
This code should delete a row from the database where ID = ID however it doesn't seem to be doing its job PHP Code: <? if(isset($_GET['id'])) { Â Â Â Â Â Â Â Â $query = "DELETE FROM mynews WHERE id = '" . $_GET['id'] . "'"; Â Â Â Â mysql_query($query); Â Â Â Â echo "<p align='center'>Deleted</p>"; Â Â Â Â } else { Â Â Â Â Â echo "<p align='center'>Not Deleted</p>"; } ?>
View Replies !
Delete Query Not Working As Expected
I have 2 different php forms. One makes sure that a user has chosen an unique user name (below): $query_rsApp = "SELECT * FROM users where UserName=".$Registered." "; This Select query works right every time (as far as I can tell). I have a form that I want to use to delete user records. This Delete query works fine if the username and password are both numeric... But if the username or password is text, it returns the error "UNKNOWN FIELD 'whatever'" where whatever is my search criteria that I am trying to use.
View Replies !
Delete Query Takes HOURS
why on EARTH would this query: Code: DELETE FROM `test_zip_assoc` WHERE id > 100000 take an entire day when there are 10 million records in this database: Code: +--------------+------------------+------+-----+---------------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------------+------------------+------+-----+---------------+----------------+ | id | int(12) unsigned | | PRI | NULL | auto_increment | | f_id | int(12) unsigned | | | 0 | | | zip | varchar(5) | | | | | | lat_radians | decimal(12,11) | | MUL | 0.00000000000 | | | long_radians | decimal(12,11) | | MUL | 0.00000000000 | | +--------------+------------------+------+-----+---------------+----------------+
View Replies !
Ftp_put() Successful But Zero Bytes?
I used the following code to upload large files ranging 1-50 MB..the problem is i tried uploading a file of size 1.78 MB and it worked..then i tried uploading a file 2.9 MB and it didn't work..then i tried a uploading a file of size 2.18 MB and it also didnt work..by didnt work i mean that when checking the directory online, there is a file with the name of the uploaded file but its size is 0 bytes!!...i mean the uploading is fine, but the size is the problem.. the upload_max_filesize is set to 60MB just to make sure in wont cause a problem so im pretty sure that's not my problem..can anyone help?... $ftp_server = "//ftp server"; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name = "//username"; $ftp_user_pass = "//password"; $ftp_dir='/HOSTNAME.com/extras/softwares/'.$cat; //$web_location is needed for the file_exists function, the directories used by FTP //are not visible to it will will always return not found. $web_dir='../../extras/softwares/'.$cat; $local_file_name = $_FILES['directory']['name'];//"file.txt"; $source_file = $_FILES['directory']['tmp_name']; $web_location=$web_dir.$local_file_name; //build a fully qualified (FTP) path name where the file will reside $destination_file=$ftp_dir.$local_file_name; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // check connection if ((!$conn_id) || (!$login_result)) { echo "FTP connection has failed!"; echo "Attempted to connect to $ftp_server for user $ftp_user_name"; exit; } else { echo "Connected to $ftp_server, for user $ftp_user_name"; } $upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY); // check upload status if (!$upload) { echo "FTP upload has failed!"; } else { echo "Uploaded $source_file to $ftp_server as $destination_file"; } //use ftp_site to change mode of the file //this will allow it be visible by the world, $ch=ftp_site($conn_id,"chmod 777 ".$destination_file); // close the FTP stream ftp_close($conn_id); //verify file was written if (file_exists($web_location)) { echo "file was uploaded as $web_location"; } else { echo "Could not create $web_location"; } //end if
View Replies !
Checking If Sql Queury Was Successful
$result = mysql_query("SELECT * FROM feed WHERE feed_id = '$id'"); if(!$result) { die("query unsuccessfull"); } else { echo'queury successfull'; } something along these lines, but to be able to check any kind of query, add, delete, update,. the example above does not work me.
View Replies !
Delete Query - Error In Your SQL Syntax; Check The Manual That Corresponds To Your MySQL Server
I have tried to make a delete query but it won't work it gives me a syntax error but I'm unsure where i have gone wrong.... this is what i have got at the moment: Quote$Deletesoldhouses = "DELETE * FROM soldhouses WHERE SoldHouseID = '$HouseID'"; mysql_query($Deletesoldhouses) or die(mysql_error()); Can any one see what i did wrong? 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 '* FROM soldhouses WHERE SoldHouseID = '1'' at line 1
View Replies !
Redirect Successful Login To Url Address
I want to redirect a successful login to a url address held in the mySQL database. I have no problem validating the user name and password, but am unable to find a way to redirect to the a specific address held in the database. Each user will have a specific address asigned. Code:
View Replies !
Display The Users Name Upon Successful Login.
I have a login.php, members.php and members.html. Right now, if you login successfully you are taken to members.php. I want to display the users name upon successful login. I can do this in members.php, however I want to display it in members.html (because in HTML pages I can make layout tables/cells). I store the users first name (f_name) and last name (l_name) in session variables with the following code (from login.php):
View Replies !
Display Error Messages When The Command Is Not Successful
When using exec(), how can I get it to display error messages when the command is not successful.I have tried Code: $command = "dir"; $output = `$command`; echo "$output"; Which works great if everything goes as planned. However, if anything runs that is not successful, I just get a blank page. For example if I inserted "not a valid command" as the $command var I get a blank page, and I want to get the "program is not recognized" dialog.
View Replies !
Set A Session Variable To True If A Login In Is Successful.
I have created a webportal on a private network for a client, and everything is working just great. A problem that I have run into is with sessions. I set a session variable to true if a login in is successful. At the top of each page I check for that variable, and if it is not set then it displays that you are not authorized to view that page. Simple enough. The problem I have is on one of the pages there is a link to open up the web interface for Exchange server. Seems fine opens window user logs in checks his mail etc. When he logs out of exchange and goes back to the webportal he gets the not authorized screen. If I open up the exchange web interface from a browser not from the link it is fine. How is Exchange closing my php sessions. Aren't they totaly differnet systems asp and php.
View Replies !
Redirect On Successful Submisssion To Another Page In Quickform
I have a simple problem while using require_once functionality. (This mail is cross posted on web one is japan, one in google , bear me for reading for the second time -for any chance) Page1.php is using as an input form , and after input, the control will be transfered to pgae2.php with the same Workspace env as page1.php. Page2.php will be displayed as per my requirement, however after the page2.form, again the page1.php will be dusplayed a the tail. Code:
View Replies !
Fwrite() Returns False After A Successful Fopen($file, 'a+b')
I wrote the function below as part of a larger class. The fopen stage works, and, as according to the documentation at www.php.net/fopen that succesfully creates a new file. The fwrite stage returns false, however, on the first time the function is run, but returns true the second time it is run. Can anyone suggest why fwrite only works the second time? There are no entries in the apache log, even with error reporting fully turned up (note that I have removed @ from infront of each function, so would expect something). --- function writeDataToFile ($data, $file) { # Attempt to open the file in read+write mode if (!$fileHandle = fopen ($file, 'a+b')) {return false;} else { # Attempt to write the data #!# For some reason this returns false just after the first time trying to create the file if (!fwrite ($fileHandle, $data)) {return false;} else { # Having written to the file, close it fclose ($fileHandle); # Return a positive result return true; } } }
View Replies !
Warning: Ftp_put(): PORT Command Successful, The FTP Upload Has FAILED!
I am trying to upload a file to a different server through a php script. This script works fine on other servers that I know of. But, not on this one. I am recieving this error. Warning: ftp_put(): PORT command successful in /home/accountname/public_html/testing/admin/includes/classes/feed.php on line 75 The FTP upload has FAILED! Local file: /home/accountname/public_html/testing/feeds/testfroogle.txt Remote file: froogletest.txt I have checked configuration and I can upload with an ftp program using the login info just fine. The script logs in just fine. Creates a file on the remote server. But, won't upload the data. After a while the whole thing appears to log out. I have been searching all over the net all morning. Just can't find the answer.
View Replies !
Delete Record - When The Delete Link Is Clicked The Next Page Is Blank And Nothing Is Deleted.
This is my "delete.php" and this "todo/delete.php?id=64" an example of a link to it generated from the index.php page. When the delete link is clicked the next page is blank and nothing is deleted. What have I done wrong? <? include("dbinfo.inc.php"); mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $id="delete from todo where id='$id'"; mysql_query($id); mysql_close(); ?>
View Replies !
Use Query Result Field As Query Key For New Query..
$query  = "SELECT ProjID, UserID, ProjDesc, file, OrigProj, OrigUser, ProjDate FROM projects"; $result = mysql_query($query); I would like to take the field 'UserID', and utilise it for a Query statement to my users table in my database, to read and fill in information to my table, which looks like this: PHP Code:
View Replies !
Execute An Update Query Based On The Results Of A Select Query
I'm trying to execute an update query based on the results of a select query... This doesn't work - any ideas? This is the code I'm trying to get to run (it updates all products which are set to arrive by a certain date if that date has arrived or passed - and there are products that should and should not be updated in the db this is being tested with...): Code:
View Replies !
Turn Select Query Result Into Hyperlink To Other Query
I have a query which gives results of selecting coursenames from a table called trainingtopics but this does so in a continuous bulk of text without any breaks between each record. my question how do I create line breaks between each record and also how can I force each query result to become a hyperlink which when clicked runs another query that gives details of that course. <?php $user = "root"; $host = "localhost"; $password = ""; $connection = mysql_connect($host, $root, $password) or die ("Couldn't connect to server."); $database = "courses"; $db = mysql_select_db($database) or die ("Couldn't select database."); $sql = "SELECT coursename FROM trainingtopics"; echo $sql."=sql<br>"; $result = mysql_query($sql) or die(mysql_error()); echo $result."=result<br>"; while($row=mysql_fetch_array($result)) { // NOTE this one ABOVE the echo echo "result found!"; echo $row[0]; } ?>
View Replies !
Accessing Query Data From Query Against Multiple Tables
I have a query that gets info from two tables in my database. How do I access the data from the query? I know how to use the mysql_fetch_assoc() when the query in question only pulls information from a single table. How do I do the same thing for multiple tables and then insert the necessary data into my page? Code:
View Replies !
PHP Update Query Mysql: Query Succussful?
I can't seem to successfully test an update query. Below is a piece of code that updates a statistics table. If row today doesn;t exist, a new day must be created. But this doesn't work... thank you for your reply. $today= date("Y-m-d"); $qq="update totals_r set hits_r=(hits_r+1), lang_$lang=(lang_$lang+1), cat_$cat=(cat_$cat+1), rating_$rating=(rating_$rating+1), bussite_$bussite=(bussite_$bussite+1) where date='$today'"; $result_6 = mysql_query ("$qq"); if (!$result_6){ /// IF !ROW_TODAY ==> CREATE NEW DAY $qq_2="insert into totals_r (hits_r, lang_$lang, cat_$cat, rating_$rating, bussite_$bussite, date) values(Ƈ',Ƈ',Ƈ',Ƈ',Ƈ','$today')"; $result_6_2 = mysql_query ("$qq_2"); if (!$result_6_2){ $err_msg_sql_6= mysql_error(); $err_loc_6="$PHP_SELF"." // Query6: update totals_r"; } }
View Replies !
Speeding Up Query/code (query Within Result Set)
I'm looking for ideas on how to speed up this script. Basically it finds all the zip codes in a zipcode table, then looks for all the records in another table with those zip codes. Right now it finds all the zips then within that WHILE, it looks for a record in another table with that zip: PHP Code:
View Replies !
Query - Create The Mysql Query To Get All Fields
I've a table "article". Any article is of a type in table "type1" or "type2" Each type may be of a model in table "model1" or "model2". Each model can be on a certain make, also in 2 tables, "make1" and "make2". they are a few possibilities. "article" can be of "type1" or "type2" "type1" can be of "model1" only - "type2" can be of "model1" or "model2" "model1" can be of "make1" only - "model2" can be of "make1" or "make2" "article" has "type.id" field (char10). If it start with "my" then it's a "type2", otherwise is a "type1" "type1" has only "model1.id" field. "type2" has "model1" and "model2" fields. If one is filled, the other isn't "model1" has only "make1.id" field. "model2" has "make1.id" and "make2.id" fields. If one is filled, the other isn't so here are the possibilities: article -> type1 -> model1 -> make1 article -> type2 -> model1 -> make1 article -> type2 -> model2 -> make1 article -> type2 -> model2 -> make2 Now, I must create the mysql query to get all fields given the "article.id". Is it possible ? How ? will this work ? in pseudo-code article left join type1 articleid = type1id inner join model1 type1id = model1id //inner because if type1, the model is 1 inner join make1 model1id = make1id //inner because if model1, the make is 1 left join type2 articleid = type2id left join model1 type2id = model1id left join model2 type2id = model2id left join make1 model2id = make1id left join make2 model2id = make2id
View Replies !
Delete From $var
Is it not possilbe to have a variable for the table name in a delete statement (mysql database). inside an if this button is hit statement I have: $sql = "delete from $type where id_num='$number'"; mysql_query($sql); echo "$sql"; when it echos $sql it doesnt have the $type var where the table name should be, it just leaves that blank.
View Replies !
Delete A Row
This should be simple enough but for some reason it's not working. The $name is a number which is being posted across when the user clicks submit. I want the PHP to then access the Database with this number and use it to delete the staff ID (which is a PK). With this code I get the error: Warning: ociparse(): supplied argument is not a valid OCI8-Connection resource in /homedir/ilex-s01/jmsuther/public_html/DeleteStaff.php on line 16 Warning: ociexecute(): supplied argument is not a valid OCI8-Statement resource in /homedir/ilex-s01/jmsuther/public_html/DeleteStaff.php on line 17 ; The code is: $name = $_POST["staffnodelete"]; IF ($staffnodelete=="" ) {print "You selected $name - for deletion ";} putenv("TNS_ADMIN=/u1/oracle/Products/shu10g/network/admin"); $con = OCILogon("username","password","10g"); $query = "DELETE FROM staff WHERE staffno = $name"; $query = $query_post [$name]; $stmt = ociparse($conn, $query); ociexecute ($stmt);
View Replies !
Not Able To Delete
I've written a script to display all records in a database table and allow the user to select a record for deletion by entering it's ID number into a form at the bottom of the page. When they click on the Submit button, it refreshes the page & shows the entire record that they selected and it asks if they're sure that they want to delete it. There's 2 radio buttons that that allow them to select either "Yes" or "No". Everything is working fine up to that point. Where I run into problems is that no matter whether they choose yes or no, the record does not get deleted.
View Replies !
Delete Row
I am having a little problem with the following row to delete a row from my table. This script works fine on my home testing server but as soon as I put it onto my main web server it does not work and gives me an SQL syntax error. PHP Code: mysql_select_db($database, $connect); $sql = "DELETE FROM prices WHERE id=$id"; mysql_query($sql) or die(mysql_error());
View Replies !
Row Delete
what i am trying to do is delete all rows except for the last 20 rows, anyone know how this can be done? basically i am keeping track of profile views so i know what members lasts seen who... my questin is how do i delete all but that last 2o for each $Member?
View Replies !
Delete
In one part of a review site i am making it allows top level users to make reviews witch includes uploading a picture and then changing the name to [name of review].[whatever], also it allows people to edit the review and change the picture, how exactly would i go about getting rid of the old picture so that i dont have to do hours of clean up.
View Replies !
Delete From Dir....
I have a field named 'path' in my db that has the exact same number(path) as its counterpart folder under cart/zips. So my path in my db might be �', and in cart/zips you'd have the folder 23423423. There is a corresponding session with each 'path' row. Based on the session, I want to retrieve the path name and delete its counterpart folder name (and all it's sub-files it may contain). The delete_all_from_dir function below is deleting the whole zips folder when I only want it to delete the path folder below it and its contents. Code:
View Replies !
Using Query Result To Do Another Query In Loop
I have 2 tables, one called users2 and one called books. Books has a field called UserId, which is the ID of the user that added the book to the database. My problem, is that i need to take this ID from the book table, and use it to get some information from the user table. Here is my code to get the ID from the book table: Code:
View Replies !
MySQL Query - 2 Steps In 1 Query?
I have two tables and the first one contains 2 main fields- 'user_id' and 'username'. The second table contains 2 main fields- 'poster_id' and 'message'. And what I need to do is lookup the user_id from the first table with the username, then pull * from the message_table if the poster_id matches the value pulled from the first table. Now, I got this working without a problem at all but I had to use 2 queries to do it (1- pull the user_id from the first table by matching it with the username, then 2- using the first id, pull everything from the second table that matches it). Is there an easy way to do those 2 steps in 1 query? I know there must be some way since this seems like a fairly simple and routine problem, but I can't find it online or in any books I have here.
View Replies !
Count Query In Mysql Query
Is it possible to retreave all data from 1 table. and count a number of records where 1 row has the same number as id of the main table? example Table categories id name 1 blah 2 hello Table Threads id name categoryid 1 first 1 2 mid 2 3 noon 1 4 blah 1 5 roar 2.
View Replies !
How To Delete Fields
I would delete with php, all record of a table mysql where the seven left chars of the field is equal to the data in input($seven_chars). I have used the the belowe istrucrion but it do not work.how can I do? mysql_query ("DELETE FROM my_table WHERE substr(myfield,0,7)=$seven_chars");
View Replies !
Delete A Line In PHP
What i want to do is to open a file read the file Select a particular line from the file and delete that line and close the file. How to do it in PHP.
View Replies !
Can't Delete Cookie
Right I am quite new to php but have managed to create a simple log in/log out thing with cookies. All was working fine and as expected until I added a new section of the site. The new section stores another cookie (latest message user has read) so that next time they visit the site it will highlight the 'new' messages. However since adding this I can no longer log out.
View Replies !
Can't Delete Cookie, Help Please~
Page1: <? setcookie("book_id", $book_id ); ?> Page2: <? setcookie ("book_id", $book_id, time() - 3600); ?> Can't delete cookie at once but reload page 2 two times how to delete $book_id cookie without reload?
View Replies !
Cookie Won't Delete
I'm trying to setup a simple user authenication for my site. I'm using cookies to pass the credentials between pages. But the function header() is giving me problems logging in and logging out. As you can see in the code below, I try to redirect the user to a page after setting or deleting the cookies. The scripts redirect okay, but the user never logs in and never logs out correctly. The scripts works correctly (logging in & logging out) only if I comment out the header() function. Here's my code for setting the cookie (login.php):
View Replies !
Delete All Replicated Except One
I ran PHP codes that creating tables and inserting records to tables., But something happened, someone of them is inserted more than once. aa1345 | Ninsonoto aa1345 | Ninsonoto aa1348 | Ayumi Tohina aa1348 | Ayumi Tohina aa1348 | Ayumi Tohina There are thousands of records there. So I think i have to write a script that able to delete all the replicated except one.. e.g : Delete four of aa1348 records.
View Replies !
|