Database Reading..
I have a mysql database named userdata setup. like this
Database = userdata
Under userdata are the columns
buddy and username
what i want to do is make a page that has a textbox with a button on it that says view data.
when you type one of the usernames in the textbox then you would hit view data.
when view data is hit. it will search the database for every row in the column username that = textbox
then display all of the rows it found .
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Reading Database Problem
I'm having a problem reading the database. But I assume its due to the fact that I have done some very bad coding lol... I'm still fairly new. So forgive me. A little info... I'm trying to set up a so called counter. When someone opens a page it will check to see if someone has been to the site before and if they have it will add a 1 to visits. And if the person hasn't been to the site before it will insert their ip along with 1 visit to the database. As you can see this is being done by reading the persons ip address. But instead of updating an ip address with visits... It keeps inserting and inserting. Never updating.. Code:
Reading Tab Delimited File Into Database
I have a .tab file that I need to write to the database. I've read it in, but for some reason it's not reading correctly. I'm truncating the complete database and then reloading it with whatever is in the tab file. I keep getting an error when trying to run my current code which is: Code:
Reading And Displaying A Date From A MySql Database
I've just started using php, and although I am very impressed by it, there are some things with which I am confounded! What I'm trying to do is read in a Date from a mySql database and then display it on screen (the Date is in the usual yyyy-mm-dd format). If I use SQL on phpadmin SELECT Date FROM details WHERE details.Name = "Paul Lee" LIMIT 0 , 30 The result comes up 2005-01-01, so this seems to work. But if I use the following: $db = mysqli_connect("localhost","root",""); @mysqli_select_db($db, "personnel") or die ( "Unable to select database" ); $query = 'SELECT Date FROM details WHERE details.Name = "Paul Lee" LIMIT 0, 30' $result=mysqli_query($db, $query); echo "<br>"; echo $result; mysqli_close($db); I get "Object id #2" displayed on screen. I have tried to use the explode function to separate the months, year and day using the "-" as a delimeter, but this doesn't work, and I can't seem to get the other php date/time functions to work either.
Reading Barcode, Updating Access Database
I am writing a tracking system using barcode readers. I have a simple page with two entry points, one to display the form to receive a scanned serial number and the other to do the upload to an Access database. It works okay with a button on the upload screen to return to the form screen but I want to return to the form screen without an OnClick event handler. Basically, I want the user to see the "Enter serial Number" prompt and be able to do scan after scan without having to click on anything else. I need to display the status of the upload after each scan. I have tried using windows.location.href, header(location:etc) , $PHP_SELF etc but without any success. Can anyone help with syntax to reload or load the page (including entry point and status variables) after the database is updated without the user having to do any clicking? Or is this best handled in Javascript?
Reading Database BLOB With Showing Progress Information
I'm dealing with a very tricky problem and can't seem to find the answer with google. the problem is: i want to store huge data (binaries) inside a mysql databases blob - to later store those data to a file somewhere else (from where i can connect the database). problem comes into play, when I try to output a "progress" of the reading of this data (kind of "xx bytes of XXX bytes already transmitted"). Does PHP / PDO /PEAR:DB has those Buffered Read capabilities for Table Columns ?
Reading A Gif
I want to read a gif and display it on the browser.the code i use is as follows.. ------------------------------------------- $fp = fopen("../images/Powered1.gif","rb"); $size = filesize("../images/Powered1.gif"); for($i=0 ; $i<$size ; ++$i) echo fgetc($fp); ------------------------------------------- but the gif is not shown.well i guess in the binary mode when i use feof() it reads the end-of-file character before the end!!
Reading XML With PHP
First of all I want to say I do not have very clear understanding of XML and PHP and what you can do with those two. Now the problem I have is: There is that booking company that sends data to me via XML and I have in my server to read that XML and store it in a DB. What I have no Idea how to do is read that XML. To start with, I though they were using $_POST to upload an XML file, but it seems they do not as when I get a request in my script I print_r the $_POST and it is empty. The same with $_GET, empty. Do you have any idea of other ways that they might send the XML data and how can I read them with a PHP4 script?
Reading
I must read an HTML-free web page. The only documentation I have is this : : temp: This request will return an HTML-free web page, consisting of a simple ASCII string of pipe-delimited data. The data will be in the format of : "PROBE1_NAME|TEMP|PROBE2_NAME|TEMP…" How can I do ?
Reading A TXT
I have a huge TXT with a list of streets: street 1 street 2 street 3 I would like the php to read them and place them in the same order as they appear in the database inside the street column. I know how to do it when txt looks like street 1, street 2, street 3 but don't know how to handle with the line breaks. Any hints?
Images In Database Vs. Image References In Database
i kept all of the uploaded images as files on the server, and created links to them in the database. I have been changing things around now (especially directories) and I am thinking of storing the images in the actual database. I read somewhere that this can be considered a bad practice, so i was wondering what the consensus here was. In my opinion, modifying all of the code to point to the correct directories everytime a page location changes seems like a pain in the a**.
Reading Categories
I have a text file called cat.dat which contains the username and the categories they have selected. Another file users.dat is for username and password. Now, my authentication part is working fine, but I can't read the cat.dat file to get their selected items.
Reading Url Values
I am able to pass values to the URL as this shows. I can get the id value and select data from mysql, but I cannot access the ln value. I have use various combos and acannot get it to read the ln value and display it. What am I doing or not doing? I have used get, post and result: $id=$_GET[id]; $ln=$_POST[ln]; echo $_RESULT[ln]
Reading A Timestamp
I am having problems converting a timestamp....it stored as 14 digits like this: YYYYMMDDHHMMSS and i use the following to convert it: $add = date("F d, Y, h:ia T",time($added)); but i always get the current time rather than the converted time from the timestamp....any ideas?
Reading And Writing With Php
In my script i have 1 seperate fopen() sequence to read the file, so it can put it into a textarea. Then i have another fopen() sequence that will the values i have in the textarea, but for some odd reason it doesn't work! I hope I did an OK job at explaing this. But heres my code! PHP CODE:
Reading In Multiarray
I wrote some code to read in a file and I'm curious as to is this is a decent way to do it or if there is a much more elegant way. Essentially I want to convert a text file that into a ul in html for my nav menu. This way I can easily add and remove links without messing with any other code(Except of course where the link points to). Anyways, the code works as far as getting the links into a multi-array that I can work with but not sure if its the best way or not. Code:
Reading Cookies
I'm setting cookie with PHP3 function setcookie(); in one script. I get no warning while processing the script, but when I try to read the cookie in another script nothing is returned. I tried several combinations, but still no result.
Reading Array
I have an array with N values, I want read it from the position X to the end of array...
Reading Folders
If I had several folders full of images, how can I get PHP to open the folder, read the image names and save the image names (inc extension) to a MySQL database? What I am trying to do is create an image gallery using PHP/MySQL, so that everytime i take a load of pics, all I would have to do is get PHP to read the contents of the folder and add the filenames to a MySQL database rather than having to manually input the names into the database
PHP Reading Of JAvascript
I am new to PHP. But this seems like a terrific language. I have been using JavaScript up to now but it looks like I will be changing to PHP. Seems to have more potential. I am confused about using data in a JavaScript cookie in a PHP file. The JavaScript Cookie document.cookie = "order=" + escape("website = " + website + "*" + "sale = " + sale + "*" + "name = " + name + "*" + "addr1 = " + addr1 + "*" + "addr2 = " + addr2 + "*" + "city = " + city + "*" + "countycode = " + countycode + "*" +"state = " + state + "*" + "zip = " + zip + "*" + "mr = " + mr + "*" + "fname = " + fname + "*" + "lname = " + lname + "*" + "dept = " + dept + "*" + "phone = " + phone + "*" + "ext = " + ext + "*" + "email = " + email + "*" + "#"); variable: website = value: website delimiter: * End of cookie: # Is there a command to convert a JavaScript cookie to a PHP cookie? I have tried to read the cookie in PHP with no success. $_COOKIE['order']; $_COOKIE['order=']; How do I pick out the variables and values in PHP from the JavaScript cookie?
Reading COM1 With Php-win
I need to read incoming bytes on a COM port but I do not want to have the script hang if there is nothing to read. Is there any way to have PHP interrogate a COM port buffer to see if there is any content before reading it? Any other method to achieve the result would also be welcome.
Reading An MYSQL Row
I have a small problem. I want to read 3 colums that have information in MySQL. Here is an example: I have one column for users (userid), passwords (passid), for e-mail (emailid), and url(siteid). How can I read passid, emailid, and siteid and put them into a text box for a form. like: <!-- beginning --> $connect = @MYSQL_PCONNECT($host,$user,$pass); $query = MYSQL_DB_QUERY($db,"SELECT userid,passid,emailid,siteid FROM users WHERE userid = $user_logged") <!-- end --> what do i do to enter passid, emailid, and siteid that belong to $user_logged into their own text box , like in a form?
Reading A Cookie
I did try to find the answer to this before posting, so this isn't a knee jerk reaction. What I am trying to accomplish is to have a script that opens a cookie, reads a value, and then use a switch/case to take action based on that value in the cookie. I want to set the cookie manually, so I don't need setcookie(). I see that in PHP it stores the cookie in memory. Is there a way to have PHP just read a cookie from the desktop machine? Does it have to set it first? Am I better off with Javascript for this? The situation is that we have 4 computers. We also have 4 different types of specialty printers, each for a different function. We don't know which computer will be hooked up to which printer, and they may be switched out routinely. We are trying to develop a simple script that reads the value of the cookie which tells it which printer to print to and what to print. This way, we can easily switch computers around as needed, and will only need to change the value in the cookie to have it access the correct code so that it prints the correct information in the correct format.
Reading A File
For some reason I can open a file, but I can't read it (I checked with is_readable() and is_writeable() and both returned true). I'm trying to open a file just copied, so maybe that's the reason why I can't read it, and I would have to reload the page. PHP Code:
Reading As Browser
I have a file, for example... lets say it looks like this: ----------- <HTML> <BODY> MyStuff <?PHP do some php stuff ?> </BODY> </HTML ---------- I need to read it into an array/variable, however, I need to have the php code already executed, as if I was reading through a browser, instead of strait off of the disk. I can't have it simply printing... like require or include would do... I need it as a variable... I considered eval, but that doesn't return anything.
Reading Tar.z File
i wanna extract and read data from a tar file i have tried www.phpclasses.org/browse/package/529.html thing. but that is not working for .z file. any idea how to do that ?
Reading Gifs
I know current versions of GD cant write gifs, however can they read them? Im wanting to convert some images to jpegs, is this possible?
Reading Fille
How can i read a file which is not text file using fopen . I used fopen command to read files with different extension like .php, jpeg, gif. It reads only files with txt extention and html extension. When I try to read image files either it displays binary characters or produces some error and closes internet explorer. When i read .php files it reads but displays some command like print command just like print..... like how HTML php editor displays when we saw html preview in php editor. how can i extend the fopen command to read .php, and image files.
Reading The Address Bar
I'm working on a CMS site with an SEF component that changes the URI's. I want to be able to read the URI in the address bar, so REQUEST_URI isn't going to be my solution. Is it possible to read the address bar within PHP, or do I need to find a javascript code that can do this and then create a variable that can be passed to PHP?
Reading Last Entry Only
I am sending data to a text file, and displaying the data on the return page. Then it emails that entry only. (this works fine) But when I call the second page, it displays everything in the text file. Is there a way to to call the last entry to the text file only?
Reading JPEG Tag
I'm writing kind of a picture gallery and I would like to view information about each picture. So how do I read the JPEG tag in PHP? I been looking around the internet for a solution but haven't found any yet.
Reading Dir In Another Server
I have this: http://www.OTHER_SERVER.com/photos/photo1/ http://www.OTHER_SERVER.com/photos/photo2/ http://www.OTHER_SERVER.com/photos/photo3/ http://www.OTHER_SERVER.com/photos/photo4/ .... Each folder has lots of photo files and a text file with some description. I need to use [opendir] and [readdir] to get the file names in each of them. The question is: How can I read that dir in *another* server? PS.I cant do it fro the same server, once it must be done dynamicly and the OTHER_SERVER has no PHP.
Reading POP Boxes
I've been looking round for something that will read the contents of a pop box and populate a MySQL table. The e-mails will all be of a fixed format and include a jpeg as an attachment. I need to put the following columns in: sender subject body filename (possibly appended to the date to mitigate the risk of The script would also need to save the attachment to a predetermined folder. Does anyone know of anything that would do this? Alternatively, how much would it cost for someone to get this working for me?
Reading Files Into PHP
how can I read files into PHP. I can make a listing of a directory, but reading the file content into the PHP goes wrong. ==== script ========== <?php $handle=opendir('nieuws'); while (false!==($file = readdir($handle))) { if ($file != "." && $file != "..") { $fp = fopen($file,"rb"); fpassthru($fp); fclose($fp); echo $fp; echo "<HR>"; } } closedir($handle); ?> ===========
Reading A File
I've got the following script: <? $inhoud = file("/opt/scripts/sc/sc_trans.log"); $inhoud = implode("", $inhoud); $inhoud_array = explode(" ", $inhoud); for($i=0; $i < count($inhoud_array); $i++){ $titel1 = explode("[DECODE] Opened ",$inhoud_array[$i]); $titel2 = explode(".mp3",$titel1[1]); $titel = $titel2[0]; $part1 = explode("<",$inhoud_array[$i]); $part2 = explode(">",$part1[1]); $tijd= $part2[0]; $tijd= ereg_replace("@"," ", $part2[0]); echo "[$tijd] $titel "; } ?> While running this I get: PHP Notice: Undefined offset: 1 in /opt/scripts/shoutcast/crphp on line 9 How do I solve this?
Reading And Using MP3 Headers
I'm currently trying to database all of my MP3 samples of my vinyl records for a new site that I am working on. I'm also trying to be clever at the same time - which in turn *should* save me some time. Can anyone point me in a direction which should lead me to useful information regarding MP3 headers, ID3 tags and the sort and how I would read/use these in PHP.
Reading Not From Cache
I wrote an php script which creates a tex document and convert it with "passthru ("texi2pdf generate.tex");" into a pdf file. After that an java script pops up a new window with the generated pdf file. Unfortunately, my browser always shows an old pdf file from the cache which was created earlier. How can I force to load the recent pdf file?
Reading Cookies
I'm trying to set up a user name/password setup to my site. The username/password system works now. BUT now, I need cookies. I'm having problems trying to make it so when you go to the homepage, it tells you if your logged in or not in the upper right corner. The cookies are called register and login. I have this code to work with.
Reading A .txt-file With Php
I have the following problem and it would be nice, if someone could help me out on this problem: content of file.txt #1: Michael #2: Dennis #3: Karl the following file writes only the first line of file.txt: <?php $fp = fopen("file.txt","r"); if ($fp) { $line = fgets($fp, 100); echo "$line<br><br>"; fclose($fp); } ?> Now I would like to have a PHP-file, which can write every line in different orders (the order should be write in the PHP-file) for example: #2: Dennis #1: Michael #3: Karl
Reading A File
I have a file which has a bunch of entries (student's data). Its structure looks like Number1|ID|name|surname|emailaddress As can be seen, the entries are seperated by a "|". Now I would like to create 5 arrays where I store all the entries seperatly, for instance an array for the ID, one for the name .... How do I read out the file and save the data to the arrays?
Reading Values From Url
what am I doing wrong? I've got a link like this: <a href="dispcalendar.php?month=1&year=2007">view the calendar for the rest of the year.</a>then on dispcalendar.php I have: showYear($month, $year);But it doesn't seem to be reading the values sent in the url as I just get a blank page.
Reading A M3u File
I'm trying to read a .m3u file.. I'm almost done but got one problem.. I'm trying to remove every non related info for the song info.. meaning the #EXTINF: etc... I've managed to strip the #EXTINF but the problem comes to removing the number after that... Code:
Reading Cookies
how to use PHP to read ALL cookies? I know how to read a specific cookie... echo $_COOKIE["name"]; or something like that..But instead of having to input the name of the cookie, how do I read all of them?
PHP Reading A Link...
Is there a way to use PHP to read a specific link and extract certain information from it. For example... To have the script read a website and to look for <table Id="somthing"> and get the <a tag and take the link and information under it? Does this make sense... is it possible.
Reading Image
how I can read image using php then store it into an array. How do i do this?
Reading From Db On Different Domain
I am building a site where a client can put in rental property information. They name their listing also. They can view it from the same site by going to a page "/listings.php?name=mylistingname". It stores it in a mysql db. However, if they want to keep the listing, they have to register a domain name. I now need to be able to show their listing info on their domain name using the template that I made. What are my options? How do I allow a domain to read another domains db? Do I have to move my template over to each domain and use the query SELECT from listings WHERE id = 1 (etc for each listing)? Is there a better way? (redirect) Here is what i use for a db connection: <?php # FileName="Connection_php_mysql.htm" # Type="MYSQL" # HTTP="true" $hostname_mysql_connect = "localhost"; $database_mysql_connect = "dbname"; $username_mysql_connect = "dbusername"; $password_mysql_connect = "dbpassword"; $mysql_connect = mysql_connect($hostname_mysql_connect, $username_mysql_connect, $password_mysql_connect) or trigger_error(mysql_error(),E_USER_ERROR); ?>
|