Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Script To Read/write/amend/delete On The Tables In A Mysql Db


Running on a unix box and looking for a good (free!) php script I can use to read/write/amend/delete on the tables in a mysql db. Been searching for a while but can seem to find one with a good web front end to use.




View Complete Forum Thread with Replies

Related Forum Messages:
Can't Read/write To MySQL
I recently upgraded from php4 to php5. I would of done it a long time ago but I always get problems with the conversion. Like this for instance. Now I cannot seem to read and write to MySQL what-so-ever. It works fine under the php4 environment but is just not wanting to work under php5. I can make the connection to the MySQL server and even to the MySQL database, but I cannot read or write to the tables! I'm sure it is just some minor detail that I am missing, but meh, I cannot figure it out. Here is my info: Code:

View Replies !
MySQL - Delete Across Two Tables. OT
i cant find the MySQL newsgroup, however i am
hoping to pick up on some expert advice from php/mysql gurus here. I'm
having some trouble performing a delete across two tables.

The tables i have are:

questionnaires (id, name);

questionnaire_questions (questionnaires_id, id, name, qf_type)

The questionnaire_questions table contains a list of questions for a
specific questionnaire (indicated by the questonnaires_id). I would
like to remove a questionnaire, and when doing so all corresponding
questionnaire_questions who have matching id's (questionnaires.id =
questionnaire_questions.questionnaires_id).

I have this statement, however it only works if a questionnaire has
questions... however i would like it to delete even if no questions
exist for that specific questionnaire. The SQL i am using is:

delete questionnaires, questionnaire_questions FROM questionnaires,
questionnaire_questions WHERE questionnaires.id =
questionnaire_questions.questionnaires_id AND questionnaires.id =
THE_QUESTIONAIRE_TO_DELETE_ID

View Replies !
Read/Write
I have an admin page that adds events into a .dat file on the server as plain text. Code:

<?php
//format incoming form data
$content = $eventname."|".$eventdate."|".$eventabout."|".$url."|".$date."|".$author."|".$id."|".$email."|"."";

//rewrite data file with new data
//place newly submitted post at the beginning.
$eventsfile = "../events/events.dat";
$handle = fopen("$eventsfile", "r");
$contents = fread ($handle, filesize ("$eventsfile"));
fclose($handle);
$handle = fopen("$eventsfile", "w");
fputs($handle, $content.$contents);
fclose($handle);?>

The effect is to read the data from the file, put the new data at the beginning and rewrite the file. So I guess my Questions are:

1) If more than one person submit the form at the same time is there any chance for data loss? Does php que file requests?

2) Is there a better way to accomplish the task

3) Any and all suggestions on improvement are appreciated.

View Replies !
Read And Write XML With PHP
I need some examples or an explanation for read some data of a XML file and for write some elements in the file with a form everything with PHP.

View Replies !
Best Way To Amend A Pdf Document?
I already use pdf-php for generating pfd reports.

However, it will not open an existing pdf file for amending. All I want to do is personalise a letter for bulk mailing (customers, not carpet spam).

Does anyone know which pdf tools can do this or do I soldier on regardless?


View Replies !
Dir Read / Write / Edit
I have some files in web server in a dir (e.g. /download/*.*) I don’t want any kind of database support.

Objectives:

- I want to upload files in that dir.
- I want to see all files in that dir.
- I want to delete/Edit the files.
- I want to download the files.
- When I click download the files, In case of Image files (or, any file types that the Brower can open) it open automatically open in to that window (But I want it to download only)..

View Replies !
Read And Write File
I have a file like this:

name
city
435

I want to increase only the last row (example: 435 +1) and leave the others rows.

View Replies !
Text File Read / Write
im trying to make a poll that uses a text file for storing totals, and...well its not working. I have a text file with 5 values seperated by semicolons, like 1;2;3;4;5, and that file is poll1.txt. If I supply the script with an option, it will succesfuly read and show the contents of the file, but when I try to change one of the values and put it back, it fails. It writes to the file with loads of black squares and more semicolons than are in the $newresults variable. Follows is the incorrect code:

View Replies !
Fopen Read And Write Problem
I'm trying to write a script that will read from a text list of songs
that I burned onto my CD (Albums011.txt), then write to the database
text the new text made ready for inserting into a database.

The entries from the Albums011.txt look like this:
Wayne Newton - Wild Cool & Swingin' - 03 - But Not For Me.mp3
Wayne Newton - Wild Cool & Swingin' - 04 - Wives And Lovers.mp3 etc.

and I want to manipulate it them to look in the database.txt like this:
INSERT INTO `lists` VALUES ( "Albums012", "Wayne Newton - Wild Cool &
Swingin' - 03 - But Not For Me.mp3 3.25MB 192k ");
INSERT INTO `lists` VALUES ( "Albums012", "Wayne Newton - Wild Cool &
Swingin' - 04 - Wives And Lovers.mp3 2.88MB 192k ");

The non-working code I've written is below:

<?php

$filename = 'e:mircCDListsAlbums011.txt'
$fp = fopen($filename, "r");
$contents = fread($fp, filesize($filename));
fclose($fp);

$filename = 'e:mircCDListsdatabase.txt'
$fp = fopen($filename, "a");
$string = $contents;
foreach($string as $key=>$val){
$write = fputs($fp, "INSERT INTO `lists` VALUES (
"Albums011","$val");
");
}
fclose($fp);

?>

View Replies !
Read And Write To A Text File
San someone supply me with a PHP script to read and write to a text
file on the server

View Replies !
How Do You Read/write UTF-8-encoded XML Scripts Using PHP?
I have a very simple XML file I created as a sample:

Quote:

View Replies !
Config File, Read And Write?
Does anyone know a function, class or library to easy edit configuration file? Like the XML functions but than for configuration files. Or should I write my own class for this?

View Replies !
Read And Write To Text File
I am trying to do a simple thing: read a line from a text file and write this line to another text file. The problem is: when I write the text into the new file there is an empty space between each characters. EG my original line is abcdef and the result is: a b c d e f  &#8299;. I tried and tried, searched google, but I am stuck... How can I read line n from one file and write it to another file exactly the same?

View Replies !
Read/write Access To All The Files
I recently made a php app for a company that spiders through a server and finds all files of a specified type (html, etc) and then opens the files and does specified things to them. So, the tool needs to be placed on the server and then it needs read/write access to all the files.

It works fine on my local server, but the client says that it fails (message is "failed to write to file" and then it stops). I told him to try it with ALL files and folders set to 777 just for testing purposes and he says that it's still not working. I have no idea what to suggest.

View Replies !
How Do You Read And Write UTF-8-encoded XML Files In PHP?
I have a very simple XML file I created as a sample:

<?xml version="1.0" encoding="UTF-8" ?>
<stuff>.....

View Replies !
Can I Use Php To Read From/write To Other Files On Server
I've got a news section on my page and I want people in the company to be able to fill out an online form to add new news stories so that the website looks constantly updated. all the news stories and scrolling abilities are currently in a javascript file which are written out to the page when a user loads the page. So preferably I'm looking to take in information from a form and write that information into my javascript file if that's possible. r if I can't do the above I want to take in information from my form and write to a database or new file then read that from my javascript file with php.

View Replies !
How To Read And Write Into A Word Document
I am working on a recruitment site and in that we have an option of cv upload. Either text, or word couments (.doc or .rtf) are allowed. I am able to upload the file successfully, but when I try to read that file and try to show in a textarea field I see some junk characters also getting displayed. Can anyone tell me what function should I use to suppress that junk and show only the text?

What I am doing is open the file in read mode, read the entire contents of the file and display it.

View Replies !
Read/write To Excel Or Same Type Of Files.
We need to be able to process invoices through the internet and have the customers be able to download these invoices. We are currently using Excel to do all the information.

I was hoping to be able to use a third party program to generate these files, I have looked into .pdf, and xls files. From what I have read, it is pretty much impossible for me to get a script that will read an xls file, write data from a mysql database to it, then send the file to the customer for them to download/view with the new information.

Is there a different program that works the same that I might be able to use.. or am I stuck trying to make alot of invoicing data look pretty through html tables?

View Replies !
Security Read Write Files And Folders
when i upload files to my webspace i set permission to my files and folders. Im wondering how im unsafe if i grand a folder or file with write permissions to all/everybody. In fact I have the intelligence to understand that ones can places files to my webspace and then execute them. But I dont have the knowledge how to implement it.

How can i write to that folder and files?

View Replies !
Write A Function That Will Read In A Text Document
I'm trying to write a function that will read in a text document containing various bespoke tags which I then expand into the appropriate HTML. I've done most of them but was wondering if someone could help me with this particular one .. I'm guessing I should be using preg_replace but can't seem to get it to work.

I have a variable called $rec_id which is an integer. The following is the conversion I want to perform: Code:

View Replies !
Read/Write Text File Manipulation
I have a script that writes a hit to a text file, but lately I have been noticing that the text file number is decreasing, instead of increasing or stay the same. Could some one be doing this and if so what is a good security measure to put into place to prevent this from occuring? I would prefer not to register the hits in a database; I would rather stick to a text file storage medium for this case.

View Replies !
Use To Read Or Write To A File That Is In Aother / Different Foder
I am learning how to write to a file....Pretty awesome...I understand how it works, but I need to know if I can run my script in this location ( home/folderA ) and edit a text file in this location ( home/folderB ).....I know the file is being read, but the file will not change or update. Code:

View Replies !
Delete From Many Tables
I am trying to delete rows from a mySQL DB that consists of multiple tables. I am trying to use a function PHP Code:

View Replies !
Script That Would Read & Delete A Row From Txt Or Csv File
I need to have a php script that would read a row from a txt file or csv file then display in an html file a random string and after it display this, it would delete it from the txt or csv file. I would like to use it to deliver pre-selected serial numbers and or usernames and passwords. i.e:

username,password,serial
nick,12345,12345678
john,45678,12347890
jack,1211212,1811212

after the script deliver the first row
nick,12345,12345678

it will delete it from the file so that it won't show up again to someone else.

View Replies !
Can I Read/write To The Serial Port, Comm1 Or Comm2 Using PHP?
I don't know if this can be done. Can PHP be used to read/write to the
serial port on a PC? Any replies related to Linux or Windows are
welcome.

Ultimately, I would like to be able to send a character string to the
serial port when a button is clicked on a PHP driven website.

View Replies !
Want To DELETE Row FROM Multiple Tables
I'm looking to delete a single row from multiple tables where they all share a common column name, primaryKey, and a common value - $POST_[primaryKey]. Here is the code:

$query="DELETE FROM assetinfo, emplhistory, income, newuser, preliminfo, primarydata, reoinfo, residencehistory WHERE primaryKey='$_POST[primaryKey]'";
            
            $result=mysqli_query($connection, $query) or die (mysqli_error($connection). "                                 <br> Could't run DB Query to Delete Borrower");

And here is the error msg I'm getting:

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 'WHERE primaryKey='jarreola2'' at line 1
Could't run DB Query to Delete Borrower

Is my query valid? Any other ideas on how to delete a row from multiple tables?

View Replies !
Delete From 2 Tables (join)
How are we all doing this fine day

small problem "man do i hate joins"

I have two tables "categories" and "links"

Links carry the cid field from categories.

PHP Code:

View Replies !
Write A Sql Statement That Will Allow Me To Access Tables In Two Different Databases?
I am using MYSQL and have multiple databases. I can write code to connect to one database or the other. How do I write a sql statement that will allow me to access tables in two different databases?

View Replies !
P3P Compliant, Still Can't Read/write Cookies From IFRAME As 3rd Party Document
I have two sites, both with valid P3P policies that passed the W3C P3P
validator, including the P3P compliant HTTP headers test.

On one of the sites, Site A, I have a web page that loads a document from
Site B in an IFRAME. In this context the web page on Site A is the
"originating" document and the web page on Site B is a 3rd-party document
(since it's from a different domain). I thought that having a valid P3P
policy would make IE6 in the default Medim setting, allow cookies from my
IFRAME document from Site B, but apparently it still does not. I am getting
the dreaded "red-eye" and the document from Site B can't read/write cookies
while in the IFRAME.

Is this correct, that you can't read/write cookies from an IFRAME as a 3rd
party document, even if you have a valid P3P policy that indicates no PII
(Personally Identifiable Information) is collected? Or can I fix this
somehow?

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 !
Code Loop Through The Array And Delete Everything From Each Of The Tables
Will this code loop through the array and delete everything from each of the tables for a particular user. PHP Code:

$tables = array (
"user",
"user_info",
"foo",
"bar"
);
foreach ($tables as $value) {
DELETE * FROM $value WHERE user=$username
echo 'user deleted from '.$value;
}

Also is there a better way to delete all user info across multiple tables? This seems as if it could be quite inefficient.

View Replies !
How To Get Login Script To Read 2 Different Tables
I'm having a very difficult time figuring out how to get my login script to check 2 different tables for login details. Here is what my working code looks like right now to check 1 table. Code:

View Replies !
Read Csv File And Import Data Into Multiple Tables
I want to know , is it possible to read csv file and import data into multiple tables in mysql database. i mean i am not familiarwith csv files. Can the csv files contain data from multiple tables just like .sql file.

View Replies !
PHP/IIS: File Read/Write OK, File Unlink Denied
I've got PHP running fine on IIS (OS: Server 2003, SP1; IIS: 6.0; PHP:
4.3.11).

In PHP, the user uploads a file, which is then processed and the
contents are inserted into a new file, created in PHP, onto the server.

This bit works fine, the new file created by PHP is correctly stored.

Later, once the user confirms the upload and PHP inserts the contents
of the file into the DB, the code tries to remove the file created in
PHP moments earlier, via the unlink() function.

What I see on screen is the following: Permission denied

I have made sure that the permissions for the Internet account that
created (and is trying to delete) the file have full permissions over
this particular folder and the files within it. But the user must have
permission anyway, because they are able to create this file in the
first place.

I've looked at the permissions for the file in PHP, which read: 0666.
So everthing *appears* ok to me; I can't see where the permission issue
is coming from.

View Replies !
Create A Multi Table Database In MySQL And Write To And Retrieve Information Using MySQL.
I am trying to create a multi table database in MySQL and write to and retrieve information using MySQL. I am able to insert and call data easily enough going into one table, but I am having problems with connecting tables and using the idea of normalization.

I am starting simple with an online registration for alumni of an association. My first table in a database is called alumni and it stores there e-mail address, first and last name and year of graduation. Code:

View Replies !
Write To MySql
I've just begun to attempt to read and write to mySql and was starting with a simple applications. It's a flash form that sends the variables out as a POST. Here is my PHP file with (what I thought) would add the results of the form into mySql table. What did I do wrong? PHP Code:

require_once("common.php");  // database connection settings.

mysql_select_db($database_PD, $PD);

$realname = $_POST["realnamevar"];  
$username = $_POST["usernamevar"];
$mypass = $_POST["passvar"];

$query = "INSERT INTO members ( id , realname , username , pass )
VALUES (NULL , '$realname', '$username', '$mypass');

mysql_query($query);

View Replies !
Write To File Or Use MySql?
I am laying out the data model for a small real estate site.

So far whenver I needed small databases, I just created regular files as tables, searched them and put out whatever I needed.

Works fine for small apps.

Have only held my nose into Mysql and it seems that I have to do the exact same searches, except there is an additional layer in between.

Now, assuming that the authors of mysql are really good at what they are doing (as opposed to yours truly) I would not lose any speed by using mysql.

But at what KB,amount of tables,.. size does it really make sense to use mysql rather then simply writing into a straight file?

View Replies !
Write Query In Mysql 4.0
the below is working on mysql 4.1 and above but i dont know how to wrtie it without the subquery

jos_dvd table has a listing of dvds $_COOKIE['location']
josblacklist is a list with the ids of the dvds blacklisted in certain countries
the users country code is stored in

SELECT count(*)
FROM jos_dvd f
WHERE f.published=1
AND f.id NOT IN (
SELECT b.sid FROM jos_blacklist b WHERE b.code = '".$_COOKIE['location']."').

View Replies !
How To Write A Subquery Into Mysql 4.0 ?
I need to write something like this:

SELECT books.idbook, books.title
FROM books
WHERE EXISTS (SELECT * FROM out_of_stock WHERE out_of_stock.city = 'london'
AND out_of_stock.idbook = books.idbook)

I have one table with all records (eg. books titles) and one table with some of this books (may be the ones not in stock) and the city where they are not available.

So what I want to do is to get a list of them from the first table (books) if and only if they are available in the city I am searching into the query.

to better explain, with the following query I am able to see all books not available in the selected city: Code:

View Replies !
Using To Write Xml From Mysql Data.
I need to find out how to write xml data dynamically from mysql data. I have found some info but the code samples I found created parsing errors and never worked.

I want to be able to echo the static xml data to the created file and then echo the values from my table to the propper locations in between the static data.

the syntax for the xml is this:
<_ path="/songdata/1.mp3" rate="64" title="Sidewalk" artist="No Use For A Name" />

The values in quotes are what I want replaced by the data from my mysql table.
The info without quotes is the static data that I want to echo.

This file is to be used as a playlist for an mp3 player.

View Replies !
MySQL 'SHOW TABLES' Doesn't Show Temporary Tables?
I have a function call which creates a temporary table in MySQL, and then a second function call which operates on that temporary table.

I was hoping to do something like this in the second function call to ensure that the table was in fact actually created:

if (mysql_num_rows(mysql_query("SHOW TABLES LIKE 'my temp table name'")))
// do something
else
//error

However, apparently the MySQL SHOW TABLES statement doesn't show temporary tables. Is there another query that I can use to show temporary MySQL tables so I can do this check?

View Replies !
Php-script Sometimes Fails To Write Into MySQL Db
I build an online survey page using sessions to allow scoring on multiple pages. On page 1 users get a random surveyID with the following code: PHP Code:

View Replies !
How Would I Write A Regexp On A MySQL Query
Using PHP 4 and MySQL 4, how would I write a function such that it
takes a valid MySQL query, and a column on which to order the query,
and return a new query ordered by that column?

$query = formNewQuery($query, $orderByCol);

An assumption you can make is that the query will never have multiple
columns on which to order -- e.g. ("ORDER BY COL_A, COL_B"), however
the query could contain the "DESC" keyword -- "ORDER BY COL_A DESC".

View Replies !
How To Write Stored Procedures For Mysql/php?
Where, or What, is a good reference to learn how to write stored procedures
for mysql/php?

View Replies !
Write A File From MySQL BLOB
I am storing a BLOB in a MySQL database, and want to know how to write
it out again to a file on the server, in a specified location, in php.

View Replies !
Write Mysql Data In A XML File
How can I write Mysql data in a XML file using PHP for RSS? Do you have examples?

View Replies !
Mysql And Write A File To Remote Pc
i am runin slack 10.1 apache 2 and mysql that i want to do is for intranet and no for WAN use I have a db and a php web page.i want the user that login (e.g user: namyra, pass : 1234) php go local to user pc and add some lines into c:windows amyra.txt.

is that possible and what i have to use? php supports?

View Replies !
Mysql DELETE
im a stuck again, could some one please tell me why this dosent work;

mysql_query("DELETE FROM messages WHERE from='$fromid', sento='$myid'");

View Replies !
Delete For MySQL
I'm an experienced java/C++/SQL programmer who hasnt used PHP. I'm looking for some generic database access pages for doing dds, edits, deletes, etc., hopefully with some error handling. I'd rather start with a basic shell of code, so I don't have to reinvent the wheel, and can just change connection string, database fields, etc.

View Replies !
Can I Write Php Code To Connect 2 MySQL DB. Like This Case. ?
Can i write php code to connect 2 MySQL DB. like this case. ?

My Environment :

Server < ---- > PC Client

Server =
::: Apache for Linux
::: MySQL Server ( A )

PC Client =
::: Apache for window
::: MySQL Server ( B )


I want
1.1 write php code action like this

php code on Apache for window ( on PC ) connect to MySQL Server ( A )
and get data to
MySQL Server ( B ) instantly.

Can i do like this. ?
and How to ..
Anyone have experience ?

PS. Caz i don't want to connect via 3306 port between server and PC ,
i believe that it 's not secure.

View Replies !
Loading A Series Of MS Write Docs Into MySQL
I have about 50 MS Write files that I need to load into a MYSQL database. Is there any way to load them in quickly without having to copy/paste the data from each file?

View Replies !
How To Write A Wap And Php Website That Share Same Mysql Database?
how to write a wap and php website that share same mysql database? can wap and php integrated in same page or need different page *.wml and *.php pages?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved