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 Complete Forum Thread with Replies
Sponsored Links:
Related Messages:
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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 . 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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
MySQL Read Only
I have a guy working with PHP and data from my DB, I want him to see the table etc how what fields i have but don't want to give him access to UPDATE, INSERT DELETE any rows or tables in my DB.
View Replies !
View Related
MySql Read And Compare .
I need a small QUIZ script for my site . I could not find the right script for me, so I decided to do it myself, BUT I am not a a big php programmer . So . The quiz is supposed to have 25 questions, with 3 answers each . BUT ! the thing is that some questions can have one, two or three right anwers correct, and all the right answers have to be corect for the hole question to be corect . So that is my main problem . The script reads from the database the question number ID, the question, the answers (A1, A2, A3) and the value for each answer. (R1, R2, R3 ) . like for A1 R1=0 , that means R1 is wrong . and so on . each question has 3 answers . I CAN NOT get right the code that makes variables for each $_POST and the code that should compare it with the value from the database . Code:
View Replies !
View Related
Mysql Read Only Database
I transferred all my databases from an old server to a new one by simply copying the .frm .MYD and .MYI files across. The problem is all these databases have now become read only. The users that access the databases have all privileges and all the database files are owned my MySQL. Any ideas on how to make the databases writable?
View Replies !
View Related
Mysql Read From Checkboxes.. Foreach?
I've got this code to create a checkbox: <?php echo "<input type="checkbox" name="id" value="" . $row['id'] . "" />" ?> On the form I usually end up with at least two or three checkboxes using a a while statement to read from a database. The only difference is the value, which are all numerical. When the form gets processed it goes through this code: $sql = "DELETE FROM " . $type . " WHERE id = '" . $_POST['id'] . "'"; Which gets the id from the checkbox and deletes that row in the table. The problem is if I select more than one checkbox it only deletes the last one and not the others... I presume I'd need a foreach statement to go through all the checked ones, but I'm not sure how to do so.
View Replies !
View Related
Wrong Summation Using Php To Read Mysql Database
want to read from a database using php commands and grouping by timetype jobdatefrom endyear and nctype and summing the groups for everymonth but instead it sums up for all the months. Here are the Codes i wrote for that: $query = mysql_query("select distinct sum(ChargeTime) as ChargeTime, sum(Amount) as AmounT , ClientName, JobDateFrom,JobDateTo,endYear,NcType from jobs where TimeType=0 group by TimeType, JobDateFrom, endYear, NcType having JobDateFrom>=Date('$startdate') and JobDateTo=('$enddate')");
View Replies !
View Related
Read The Contents Of A Text File Into MySql Using PHP
New to this, have the basics, can build a form and such. My problem is I need to be able to open a file on a pc/s on the network, read the data character by character, check to see if a certain character is present, if it is, update the database and continue reading the file until it comes across the character again, updates the database and so on . . . .
View Replies !
View Related
Read Data From MS Access Into MySQL In Real-time
I am currently working on a project that involves reading information from a inventory system into Access via ODBC and display the info on the web site using MySQL. I would like to create a live link between the MS Access(local) and MySQL (remote) whenever the inventory system is updated MySQL will be updated as well. I know that MyODBC will let me do the opposite of what I would like to accomplish by reading data in MySQL into Access. Is it possible to do the reverse way.
View Replies !
View Related
Email With Attachment - Annot Be Accessed. The File May Be Read-only, Or You May Be Trying To Access A Read-only Location.
It is a basic email with an attachment. The email and attachment are getting sent and received ok. When the recipient tries to open the attachment, the right application opens (eg. Excel) but then throws up an error. I am using base64 encoding. For example: .xls file with base64 encoding: 'testing.xls' cannot be accessed. The file may be read-only, or you may be trying to access a read-only location. Or, the server the document is stored on may not be responding. .pdf file with base64 encoding: There was an error opening this document. The file is damaged and could not be repaired. so the file isn't being decoded right. I have tested on Yahoo and Outlook. PHP Code:
View Replies !
View Related
|