Re: [PHP-DB] Select the specific user data from the database
Then each record needs to have a user filed where their is stored. Then your access query just adds an additional filter to check this value Select * from data_table where user = $user Bastien Sent from my iPod On Sep 5, 2010, at 7:21, nagendra prasad nagendra802...@gmail.com wrote: Hi Experts, I have a mysql database. What I want is that when a user login he can able to see his entries only, so that he can delete, add or edit his entries only. I have 2 different tables one for user details and another for actual entries. Please help me. Best, Guru. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Select the specific user data from the database
I would suggest that you keep authorization separate from data access Bastien Sent from my iPod On Sep 5, 2010, at 9:19, nagendra prasad nagendra802...@gmail.com wrote: PS: Want to check the username from a table and the password from another table. Is it possible ?? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Database management
On Aug 25, 2010, at 19:27, Karl DeSaulniers k...@designdrumm.com wrote: Hello fellow PHPers, Question, 1. Does anyone know of a good Open source MS SQLServer management software for MAC? I have been charged with updating a companies Microsoft SQLServer and I usually work in MySQL. Need a freeware if possible. 2. Is this ok to post here? If it is not, I will never do it again, I swear. :)) Karl DeSaulniers Design Drumm http://designdrumm.com The only freeware one that I can remember is one that was written as a flex app. Can't remember the name, though. Other than that, you could try sourceforge.net for something. Problem is that it being windows based, most people want to charge for it. Bastien Sent from my iPod -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Sqlite inserts inside a PDO fetch loop
Can't you do a limit in the extract SQL and mark the records extracted so that you don't end up extraxting the same ones? Bastien Sent from my iPod On May 28, 2010, at 5:49 PM, Brandon version...@gmail.com wrote: Hello, I have a situation where I am trying to create an index of words contained in a particular table. The table is about 9,400 rows, and the index ends up being 1,500,000 words (rows). While creating the index, I do a select of the table, and extract the words. I cache these word results into an array, and use that array for a prepared insert statement into the word index table. My problem is memory. It maxes out at about 35 MB. This is a bit high, and what I would like to do is do an onset transaction when the array reaches a certain size, like 10,000, then unset the array and continue. The problem with that is I cannot commit the insert while the fetch statement is still pending. I have tried fetchAll instead, but still have similar memory issues. I have also tried to commit the inserts at the end, but that causes Sqlite to hog the memory. Is there any way to fix this, or is this just the cost of doing business with Sqlite? Thanks! B -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Are join queries in phpMyAdmin a security hazard?
No more so than in any other SQL query Bastien Sent from my iPod On Feb 27, 2010, at 9:52 PM, Ben Hubbell s...@benhubbell.com wrote: Hello, My web host does not have join queries in phpMyAdmin enabled. My web host is inexpensive, but their commitment to costumer service is inconsistent. They often dismiss bug reports as feature requests. When pressed to enable join queries in phpMyAdmin several years ago, my web host stated that join queries in phpMyAdmin were a security hazard. Do you know if such a security hazard exists? Regards, Ben -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Storing images
Sure is. Save the data in a blob field. Lots of examples on the net on how to get it there and back out again. Note that you will also find arguments about whether or not to do it in the first place. I prefer not to, as it causes significant performance issues when the image table gets to a certain size. Bastien Sent from my iPod On Feb 3, 2010, at 2:37 AM, Karl DeSaulniers k...@designdrumm.com wrote: Hello List, Forgive me if this is a noob question, but is it possible to fill a database table with actual image data, IE a jpeg? And then call that data to display the image? Or is it better to just reference it stored on the server somewhere and just put the url in the database? Thanks, Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] result set in php pagination
If you change the $_POST to _REQUEST in this piece of code $author_name = $_POST[author_name];' To make it $author_name = $_REQUEST[author_name];' Should fix that issue Bastien Sent from my iPod On Jan 23, 2010, at 4:26 PM, Joe Keenan heresia...@btopenworld.com wrote: This is all that results from the included script on the 2nd display page: div id=c-col div align=center h3Articles by /h3 h4(There are 0 articles in the database.)/h4 /div p/p div align=center a href='results_1.php?currentpage=2author_name='emNext/em/ a a href='results_1.php?currentpage=0author_name='/a /div /div Given that the where clause in the original query is WHERE author_name = '$author_name' I cannot see how passing the author_name in the pagination url will help. Should I somehow pass $author name which was originally picked up from a form as '$author_name = '$author_name = $_POST[author_name];' Clearly I am at a loss here. Could anyone suggest anything in the PHP Manual, or any tutorial or anything at all on the web about sustaining a result set through pagination links when the SELECT clause of the query is modified by a WHERE clause containing a variable. As it stands I am unable to construct a search engine query to cover the matter. Thanks Joe. On 23 Jan 2010, at 20:45, lists-php wrote: You haven't actually indicated what's on the 2nd display page, but I suspect that it's just the select statement, with the (url passed) pagination substituted in. [one can pass the results in an array, but it's unlikely that you're doing that, so your subsequent pages simply re-issue the query] if you're doing that, then you'll also have code that picks up the pagination parameters from the url. you'll need to add coding to pick up the author too, otherwise the 2nd page won't pick it up and use it. also, in our link example in an earlier message: http://...results_1.php?currentpage=2author_name=Editorial you show two ampersands before author_name. there should only be one. also, if your author's name includes a space, you'll need to deal with that. - Rick Original Message Date: Saturday, January 23, 2010 08:23:23 PM + From: Joe Keenan heresia...@btopenworld.com To: Edward Brookhouse eb...@healthydirections.com Cc: php-db@lists.php.net Subject: Re: [PHP-DB] result set in php pagination I have tested the script with echo() which shows that the correct $numrows is returned and then $totalpages = ceil($numrows / $rowsperpage); Everything is correct on the first page of results. The pagination links are displayed correctly but when clicked on the resulting page is empty. For some reason I do not understand the result set does not carry through to the succeeding links in the pagination sequence. Thanks, Joe On 23 Jan 2010, at 19:16, Edward Brookhouse wrote: Isn't there a matching select later that sets up the number of pages? I start with: $offset = ($pageNum - 1) * $rowsPerPage; db_connect_ecelerity(DBUSER, DBUSERPW); $query1 = select * FROM `bouncelog` ORDER BY `insert_date` DESC LIMIT $offset, $rowsPerPage; $numresults=mysql_query($query1); $numrows=mysql_num_rows($numresults); $result = mysql_query($query1) or die('Error, lame query failed'); Then a bunch of display the data stuff but ending with: $query = SELECT COUNT(insert_date) AS numrows FROM bouncelog; $result = mysql_query($query) or die('Error, query lamefailed'); $row = mysql_fetch_array($result, MYSQL_ASSOC); $numrows = $row['numrows']; // how many pages we have when using paging? $maxPage = ceil($numrows/$rowsPerPage); $self = $_SERVER['PHP_SELF']; if ($pageNum 1) { $page = $pageNum - 1; $prev = a href=\$self?page=$page\[Prev]/a ; $first = a href=\$self?page=1\[First Page]/a ; } else { $prev = ' [Prev] '; // we're on page one, don't enable 'previous' link $first = ' [First Page] '; // nor 'first page' link } if ($pageNum $maxPage) { $page = $pageNum + 1; $next = a href=\$self?page=$page\[Next]/a ; $last = a href=\$self?page=$maxPage\[Last Page]/a ; } else { $next = ' [Next] '; // we're on the last page, don't enable 'next' link $last = ' [Last Page] '; // nor 'last page' link } echo $first . $prev . Showing page strong$pageNum/strong of strong$maxPage/strong pages . $next . $last; echo /table; echo $first . $prev . Showing page strong$pageNum/strong of strong$maxPage/strong pages . $next . $last; ? -Original Message- From: Joe Keenan [mailto:heresia...@btopenworld.com] Sent: Saturday, January 23, 2010 1:16 PM To: php-db@lists.php.net Subject: [PHP-DB] result set in php pagination I am using php and mysql. The problem which I am hoping someone can help me with concerns pagination of the result set of a search of a single table. I got the pagination script I am using from a Sitepoint tutorial and it works just as it should for this query SELECT article_id, category_name, author_name, title, article_caption,
Re: [PHP-DB] scheduler
Scheduled task? Bastien Sent from my iPod On Sep 23, 2009, at 6:46 AM, Vinay Kannan viny...@gmail.com wrote: Hi, I am developing a web application in PHP, the db is mysql. I want to develop something like a batch file, which would run everyday, query mysql and throw the output to another table which would then perform some additional functions. Is something like this possible?? i am working on windows thats why said a batch,but not rigid about the batch, it cud even be Java. Thanks, Vinay -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Local version of php/mysql site
On Sep 21, 2009, at 6:51 PM, Chris dmag...@gmail.com wrote: Zeth Lietzau wrote: Hi all, I've developed a web site where users complete a web form which pushes their data into a MySQL database. At the back end they can run reports of their input from this database. At the high end, users enter input into the form a few hundred times a day. Our site has about 99% uptime, but users have been asking for the development of a local version for them to use during the 1% downtime. Basically, I need to recreate the form so that upon submission is writes the data to a file on the users machine, which can then be uploaded to the site when it's back up. Does anyone have any resources that I could use to get started with this? You can't write to the local machine without using activex or a java applet (maybe flash or silverlight will allow it as well, not sure). Your browser won't allow it. Even if you could, your form is still on your webserver - which is unavailable anyway. You can write to the web server filesystem and then have that file for download, but that still requires the website working. I don't have any suggestions about how to get around those, all I can think of is the client either installs it locally on their desktop (using WAMP if they are on windows for easy apache/php/mysql installs) or provide a version they can run on one of their own servers in-house. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This sounds like a job for AIR. You can pass back the data as XML for the initial load into the local SQLlite db. Then periodically add to it throughput the day. All the processing will need to be handled by either the db or JS. The local db can also be loaded and then synced up to the master when needed Bastien Sent from my iPod -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] DELETE mySQL query
On Aug 16, 2009, at 12:23 AM, Ron Piggott ron@actsministries.org wrote: Is there a way to do the math in a DELETE statement (All 1 step; See my sample below pseudo code below). I am trying to delete the record if it is more than 3 hours old and the value of approved is still 0. DELETE FROM `guest_book` WHERE `guest_book`.`date_submitted` + 3 hours = '$current_time' AND `guest_book`.`approved` = '0' LIMIT 1 Check out the timediff function in mysql's SQL http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_timediff Bastien Sent from my iPod -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Making two columns
On Aug 15, 2009, at 2:26 PM, Ron Piggott ron@actsministries.org wrote: I am needing help changing this code so the result of the mySQL query will display in two columns with the CSS tags around it. The number of records being displayed is based on the mySQL query and will increase as more poetry is added to the site. echo div class=\poetry_lists_container\\r\n; echo ul class=\lists\\r\n; $i=0; while ( $i $number_of_records ) { echo lia href=\http://www.the-lords-haven-online.info/ poetry/ . stripslashes(mysql_result($poems_result, $i,pieces.reference)) . /\ . stripslashes(mysql_result ($poems_result,$i,pieces.title_of_piece)) . /a/li\r\n; ++$i; } echo /ul\r\n; echo /div\r\n Divide the total number of rows in 2 and create a second div when the halfway point is reached Bastien Sent from my iPod -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysql_query
On Aug 10, 2009, at 4:15 AM, Ron Piggott ron@actsministries.org wrote: I have the syntax mysql_query(INSERT INTO );); If this is successful I want to do update a column in one of my tables $query = UPDATE ... ; mysql_query($query); How do I test if the INSERT INTO mysql_query, in order to trigger the UPDATE? Ron You could use the REPLACE syntax in mysql http://dev.mysql.com/doc/refman/5.0/en/replace.html Bastien Sent from my iPod -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Code optimization
On Aug 6, 2009, at 7:52 PM, Ron Piggott ron@actsministries.org wrote: Is there a way to optimize this with better mySQL query? # Select today's Bible verse mysql_connect('localhost',$username,$password); @mysql_select_db($database) or die( Unable to select database); $query=SELECT * FROM verse_of_the_day_Bible_verses WHERE `assigned_date` = '-00-00' AND seasonal_use = $verse_application ORDER BY RAND() LIMIT 1; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); # Checking to see if each verse has been used once and # if so reset the used column and select a fresh Bible verse if ( $num == 0 ) { mysql_connect('localhost',$username,$password); @mysql_select_db($database) or die( Unable to select database); $query=UPDATE `verse_of_the_day_Bible_verses` SET `assigned_date` = '-00-00' WHERE `assigned_date` '-00-00' AND `seasonal_use` = $verse_application; $result=mysql_query($query); mysql_close(); mysql_connect('localhost',$username,$password); @mysql_select_db($database) or die( Unable to select database); $query=SELECT * FROM verse_of_the_day_Bible_verses WHERE `assigned_date` = '-00-00' AND seasonal_use = $verse_application ORDER BY RAND() LIMIT 1; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); } $bible_verse_ref=mysql_result($result,0,bible_verse_ref); $bible_verse_text=mysql_result($result,0,bible_verse_text); $bible_verse_translation=mysql_result($result, 0,bible_verse_translation); $bible_record=mysql_result($result,0,record); $bible_store_catalog_reference=mysql_result($result, 0,store_catalog_reference); $bible_teaching_devotional_messages_reference=mysql_result($result, 0,store_teaching_devotional_messages_reference); # Now make the web page show today's Bible verse # and mark this Bible verse used so it won't be randomly selected from the database until each verse has been used mysql_connect('localhost',$username,$password); @mysql_select_db($database) or die( Unable to select database); $query=UPDATE `verse_of_the_day_Bible_verses` SET `assigned_date` = '$todays_date' WHERE `record` LIKE '$bible_record'; $result=mysql_query($query); mysql_close(); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Doing the update based in a primary key for the table would be faster that the various bits of the where clause Bastien Sent from my iPod -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] newbie: how to return one iteration *per unique date (DAY!)* in a timestamp column?
On Aug 4, 2009, at 6:21 PM, Chris dmag...@gmail.com wrote: Govinda wrote: I should have given an example .. select count(*) as record_count, date(column_name) as date_field, 'my_table' as table_name union all select count(*) as record_count, date(column_name) as date_field, 'my_table_2' as table_name and end up with: count | date | table_name --- 5 | 2009-01-01 | table 1 10| 2009-01-01 | table 2 Ben, Chris, This is as far as I could get so far: $query = SELECT COUNT(*) AS landing_count, date (solarLandingDateTime) AS solarLandingDate, 't7solar_landingALIAS' AS t7solar_landing UNION ALL SELECT count(*) AS confirm_count, date (solarAweberConfDateTime) AS solarAweberConfDate, 'aweber_7solar_confirmALIAS' AS aweber_7solar_confirm UNION ALL SELECT count(*) AS thankyou_count, date(solarAWDateTime) AS solarAWDate, 'aweber_7solar_awALIAS' AS aweber_7solar_aw; $foundUniqueDateROWS = mysql_query($query) or die(query failed: .mysql_error()); giving this error: query failed: Unknown column 'solarLandingDateTime' in 'field list' but I most certainly do have a column named 'solarLandingDateTime' in the table named 't7solar_landing'. So I am not sure what it's unhappy. With a union the columns have to have the same name (or alias). Eg: SELECT COUNT(*) AS count, date(solarLandingDateTime) AS unique_date, 't7solar_landingALIAS' AS origin FROM tablename UNION ALL SELECT count(*) AS count, date(solarAweberConfDateTime) AS unique_date, 'aweber_7solar_confirmALIAS' AS origin FROM tablename etc -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Correction the column names will come form the first query, but they need to be the same datatype in those columns. So if the first query has a date datatype, the subsequent queries must have date columns in the first position Bastien Sent from my iPod -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] 500 records (articles) - SELECT ALL or USE WHERE
On Aug 4, 2009, at 7:18 PM, Martin Zvarík mzva...@gmail.com wrote: I need to do about 5 queries: 1) pick the top visited articles 2) pick the recent articles (limit 10) 3) pick the most commented articles etc. Now, I have 2 choices: 1) SELECT ALL records and use PHP for conditions 2) do 5 queries on MySQL --- Imagine it has 500 long text articles. Which of these 2 options is better for performance? Thanks, Martin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Ensure that you can return the same data for each type of query and then join then with a UNION statement and do it all in one query Bastien Sent from my iPod -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] newbie: how to return one iteration *per unique date (DAY!)* in a timestamp column?
On Aug 3, 2009, at 12:29 AM, Govinda govinda.webdnat...@gmail.com wrote: Oops, forgot to mention that with the alias you can change the ORDER BY clause to use the aliased column data: ORDER BY solarLandingDate DESC this will only use the returned data instead of the entire column. If you are aliasing a column it is better to use the optional AS keyword to avoid confusion. MySQL's DATE function returns dates formatted as '-MM-DD' so DATE_FORMAT is not needed here. Niel, Bastien, thanks for your efforts to lead me to understanding this! I tried everything you both suggested. Ideally I would have some clear docs that outline the syntax for me, for such an example as I need.. and I would be able to check my code myself. Meanwhile, In every case, I just get every record in the table back as a result. So then I thought, try and make even a *simple* DISTINCT work, and then move on to the date thing... so I try this: //$foundTrackingRows=mysql_query(SELECT DISTINCT solarLandingDir, solarLandingIP, solarLandingDir, solarLandingDateTime FROM . $whichTable. ORDER BY solarLandingDateTime DESC LIMIT $Maxrecs2Show) or die(query failed: .mysql_error()); In all the records in this table, there are only 3 possible values in the 'solarLandingDir' column (TINYTEXT): diysolar solar_hm (null) but I still get all the records back, with each distinct 'solarLandingDir' column value represented several times. So something really basic is missing in my understanding/code. Can you see what it is? -Govinda -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php The issue is with the select distinct, if you wrap the date in the parantheses for the with the distinct, the example I sent last night works fine. Select distinct ( date_format( solarLandingDate , '%Y-%m-%d')), solarLandingIP,... If you don't place the distinct parentheses around the date, the engines tries for a distinct on the entire row, which is why you end up with all rows Bastien Sent from my iPod -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] finder
On Jul 16, 2009, at 5:50 PM, Emiliano Boragina emiliano.borag...@gmail.com wrote: Hi again… I searching in www and find this (to do the finder): $sql = SELECT buildings.*, citiy.* FROM buildings, city WHERE buildings.idcity = city.id ; Dont understand “building.*”... what do it means? Thanks. + _ // Emiliano Boragina _ // Diseño Comunicación // + _ // emiliano.borag...@gmail.com / // 15 40 58 60 02 /// + _ _ De: Dan Shirah [mailto:mrsqua...@gmail.com] Enviado el: Miércoles, 15 de Julio de 2009 09:17 a.m. Para: Emiliano Boragina CC: php-db@lists.php.net Asunto: Re: [PHP-DB] finder But with that it doesnt difference between full and empty field… If the user want search on two posibilities on ten... Maybe I'm not understanding what you're asking... Or maybe you don't understand the query... Say your form has 10 checkboxes. If the users picks 3 out of ten boxes and clicks submit, the example I gave you will search your database looking for all records that match the 3 check boxes. if $houses equals $_POST['houses'] then $houses will be empty if the checkbox was not clicked and will not be included in the query. Select all columns ( fields ) from the building table Bastien Sent from my iPod -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] resize 10 upload image
On Jul 10, 2009, at 10:18 PM, Emiliano Boragina emiliano.borag...@gmail.com wrote: Hi again… How do I do to resize more than one image when I upload using php and not any library like the “gd” I have this: $folder=../products; copy($_FILES['5']['tmp_name'],$folder.'/'.$_FILES['5']['name']); $picture5=$_FILES['5']['name']; copy($_FILES['6']['tmp_name'],$folder.'/'.$_FILES['6']['name']); $picture5=$_FILES['6']['name']; . . . thanks + _ // Emiliano Boragina _ // Diseño Comunicación // + _ // emiliano.borag...@gmail.com / // 15 40 58 60 02 /// + _ How do you expect to resize an image without using gd, do you have imagemagik installed? Bastien Sent from my iPod -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] oci8 1.3.4 working for months on my simple browser based php
If I had to guess the config.w32 is the window 32 bit config file. So I would try the other Bastien Sent from my iPod On May 31, 2009, at 15:28, Fred Silsbee fredsils...@yahoo.com wrote: For months I've had a Oracle 11g1 browser based table access site/ program working. I do regular Fedora 9 yum updates and have seen some pecl/pear stuff whizzing by. Just tried the Oracle 11g1 browser based table access site/program and NOTHING shows on the Firefox 3.0.10 screen. Not even an error. /etc/httpd/logs/error_log says something about cannot open php_oracle.dll or php_oci8.dll That is good...there isn't any dll on Linux. Proble: downloaded oci8-1.3.5 and the README file says to run ./ configure but there are 2 files config.m4 and config.w32 nothing in this README file works...is it up to date? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Date formatting question
See the date function Http://www.php.net/date Bastien Sent from my iPod On Apr 8, 2009, at 21:41, Jack Lauman jlau...@nwcascades.com wrote: I need to reformat the output of the 'dates' field from '2009-04-08' to 'Wed. Apr. 8th'. Any help would be appreciated. Thanks. --- for ($counter = 0; $counter mysql_num_rows($resultID); $counter++); while ($row = mysql_fetch_object($resultID)) { print tr; print td . $row-dates . /td; print td . $row-times . /td; print td . $row-am_pm . /td; print td . $row-height . /td; print td . $row-cond . /td; print /tr; } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Dynamic text for every user
On Mar 14, 2009, at 8:27, Wilson Osemeilu engrwi...@yahoo.com wrote: How do i create a table with user id and password, where every user get to see a dynamic text related to them only I get the same dynamic text when every user logs in but i really want them to see their details in the mysql database only. Please help php/mysql users Thanks It's pretty simple. Select * from content where id = $id and page='$page' To get the content for a specific page Bastien -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Retrieving Image Location in MySQL
Bet the image is not readable from the web server. Bastien Sent from my iPod On Mar 7, 2009, at 5:04, Sashikanth Gurram sashi...@vt.edu wrote: Hi, Yes. But I assign the location of the image ( C:\Users\Sashikanth \Desktop\Bldgs_lots\Burruss.jpg) to the $location variable by using the mysqli_fetch_array($data) command. I send a query to the db and the result is obtained and the image location is stored into $location. So it is pretty straightforward. But I cannot understand why is it not displaying the picture after retrieving the image. Should I use any other additional commands to display the picture? Or do I need any changes in my PHP configuration file? I have checked the Config file and the ; sign infront of extension=php_gd2.dll has been removed. Thanks, Sashi Hello, Does something like this work on your php script? $location=..\..\Bldgs_lots\Burruss.jpg OR $location=..\Bldgs_lots\Burruss.jpg GR Muhsin Sashikanth Gurram wrote: This is the location where I have saved my images. /C:\Users\Sashikanth\Desktop\Bldgs_lots\Burruss.jpg /I have loaded the above location exactly into my database. But when I call it using /echo img src='$location' border='1' height='150' width='200' alt='$build' ;/ It is simply giving me some blank empty space, with the name of the picture in the blank space (Since I am using alt). So, as I see it, the retrieval part is working fine, but the displaying of the image is not functioning properly. I am using a WAMP server. Any kind of suggestions are welcome. Thanks, Sashi PS: For Reference, I am posting my entire code below again. The image retrieval part is towards the end of the code. /html body form action=mysqli.php method=post br div align=center Building Name:select name=name option value= Select a Building/option option value=Military BuildingMilitary Building/option option value=Monteith HallMonteith Hall/option option value=New Residence Hall-Career Services SiteNew Residence Hall-Career Services Site/option option value=Williams HallWilliams Hall/option option value=Women's Softball FieldWomen's Softball Field/option option value=Wright HouseWright House/option /select /div input type=submit / /form img src=mysqli.php? ?php // Connects to your Database $host=**; $user=***; $password=; $dbname=*; $cxn=mysqli_connect($host, $user, $password, $dbname) ; if (!$cxn=mysqli_connect($host, $user, $password, $dbname)) { $error=mysqli_error($cxn); echo $error; die(); } else { echo Connection established successfully; } //Define the variables for Day and Month $Today=date(l); $Month=date(F); $build=$_POST[name]; $low_speed=2.5; $high_speed=4; $hour=date(G); $minute=date(i); if ($minute=00 $minute=14) { $minute=00; } elseif ($minute=15 $minute=29) { $minute=15; } elseif ($minute=30 $minute=44) { $minute=30; } else { $minute=45; } $times=10:$minute; $sql=SELECT buildingname, parking_lot_name, empty_spaces, distance, round(distance/($low_speed*60),1) AS low_time, round(distance/($high_speed*60),1) AS high_time, Location FROM buildings, buildings_lots, parkinglots, occupancy2, Image where (buildings.buildingcode=occupancy2.building AND buildings.buildingcode=buildings_lots.building_code AND parkinglots.parking_lot_code=buildings_lots.parking_lot_code AND parkinglots.parking_lot_code=occupancy2.parking_lot AND Buildings.BuildingCode=Image.BuildingCode) AND buildingname='$build' AND month='$Month' AND day='Monday' AND Time='$times'; $data = mysqli_query($cxn,$sql); if (!$data=mysqli_query($cxn,$sql)) { $error=mysqli_error($cxn); echo $error; die(); } else { echo br; echo Query sent successfully; } echo br; echo h1 PARKING LOT INFORMATION h1; echo table border='1' cellspacing='5' cellpadding='2'; echo tr\n thBuilding/th\n thParking Lot/th\n thEstimated Number of Empty Spaces/th\n thDistance (Feet)/th\n thEstimated walking time to the building/th\n /tr\n; while ($row=mysqli_fetch_array($data)) { extract($row); $building = $row[0]; $parking_lot = $row[1]; $Number_of_Empty_Spaces = $row[2]; $Distance = $row[3]; $time_l = $row[4]; $time_h=$row[5]; $location=$row[6]; echo tr\n td$building/td\n td$parking_lot/td\n td $Number_of_Empty_Spaces/td\n td$Distance/td\n td$time_h - $time_l mins/td\n td$location/td\n /tr\n; } echo /table\n; echo img src='$location' border='1' height='150' width='200' alt='$build' ; ? /body /html/ mrfroasty wrote: Hello, It might be something with location where the script is located and the image.I think is normally the case if they arent on the same directory... If not you might want to try saving your image locations with something like ../../image_folder/image.jpg I am not
Re: [PHP-DB] Storing Image Location in MySQL
On Feb 22, 2009, at 5:17, Joao Gomes Madeira jpcg@gmail.com wrote: Hey Sashi You want something similar to this: (you must have GD installed on Apache) you can have this working by doing something like this in HTML: img src=picture.php?qry=123 and having as picture.php: ?php ... get the record from the database using query string and then ... $err=1; if ($img = file_get_contents('/yourpath/yourfile.jpg', FILE_BINARY)) { if ($img = imagecreatefromstring($img)) $err = 0; }} if ($err) { header('Content-Type: text/html'); echo 'htmlbodyp style=font-size:9pxError getting image.../p/body/html'; } else { header('Content-Type: image/jpeg'); imagejpeg($img); imagedestroy($img); } ... Cheers JP -Original Message- From: Sashikanth Gurram sashi...@vt.edu To: php-db@lists.php.net Subject: [PHP-DB] Storing Image Location in MySQL Date: Sun, 22 Feb 2009 03:43:06 -0500 Dear All, I am trying to store the location of a image into MySQL database, so that I can call it back from PHP to display it in a browser. For this purpose, I have created a table with two columns (BuildingCode, Location), where building is the primary key and location is the location where my picture is stored on my PC. My image is stored at /C:\Users\Sashikanth\Desktop\burruss.jpg/ on my PC. The following table is an output from MySQL. +--+-+ | BuildingCode | Location| +--+-+ | 176 | c:/users/sashikanth/desktop/burruss.jpg | +--+-+ Considering my original Image Location on my PC, will the above table be of any help if I try to retrieve the image using PHP? Is there any mistake in what I have done till now? I know that this may be a very basic question and i have searched through the internet quite extensively but could not find a solid answer. Would appreciate it greatly if anyone can help. Thanks, Sashi -- ~ ~ Sashikanth Gurram Graduate Research Assistant Department of Civil and Environmental Engineering Virginia Tech Blacksburg, VA 24060, USA -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Note that the image needs to be accessible by apache. You may want to store those images in a folder in or just above the web root and perhaps create an image upload routine Bastien -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] printable pdf
I like dompdf from www.digitaljunkies.ca. I do something similar and just pass that class the HTML for the page Bastien Sent from my iPod On Feb 4, 2009, at 0:04, Ron r...@silverbackasp.com wrote: Hi All, I'm creating a billing system wherein a user can view invoices. and if the user wants to print it a click on a button will generate a pdf file of their invoice. pdf or any other printable format will do. TIA Regards Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Work Online From Home
Of course it is sincere as in we sincerely want to spam all of you Bastien Sent from my iPod On Feb 4, 2009, at 21:36, Foster Sidower n...@nic.fr wrote: Hi, Our organization starts recruiting employees willing to take part in well-paying research studies conducted by leading online businesses. Your opinion as a consumer is important for the success and profitability of many business ventures. You can earn very well for participating in on-line surveys, focus group discussions, and product/service evaluations. If you want to become one of our highly valued survey takers, please write back to goodnight.esther1...@gmail.com and I will send you more information. Please excuse us if this email is unwanted for you and we have disturbed you in some way, but this is a serious and sincere enquiry. Sincerely, Ann Stevenson Assistant HR -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] data from db to a page and then to another page
The easiest way is to pass the record id via a $_GET and then query for your record a href='details.php?id=$id'band name/a Bastien Sent from my iPod On Jan 7, 2009, at 4:54 AM, Mika Jaaksi mika.jaa...@gmail.com wrote: I already can get the data from database to a page. Now I want to make link from that data to next page and on that new page it should show all the data that is related. example: data from database -- page1 where listed: band1 (a href) band2 (a href) band3 (a href) ... and when clicking for example band3 -- page2 where listed band info: bandname bandhistory bandmembers ... So, how should I do this? Should I somehow use $_POST method to send/ deliver band_id to the next page? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Echoing a variable within a variable.
A couple of options: 1. Use eval($databaseString); there are risks as it could be used to execute arbitrary code should the database be compromised. 2. If your data string is enclosed in single quote php won't evaluate the variables. Consider changing the outside quotes to double quotes. Bastien Sent from my iPod On Jan 6, 2009, at 2:30 PM, Stephen Sunderlin stephen.sunder...@verizon.net wrote: I'm emailing an html file through phpmailer and the sql look up is getting the html from a table and setting it into a variable. Within the html from the table are also variables that are also being called by the same sql that is looking up the html variable. However the variable in the html are echoing as $var instead of the assigned value being called from the sql look-up Not sure what the solution is. Any thoughts. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mktimestamp help
$endDate = date('Y-m-d', strtotime(+6 months); Should be close Bastien Sent from my iPod On Dec 30, 2008, at 8:43 PM, Ron r...@silverbackasp.com wrote: Hi, I'm trying to do online subscription on my site. I need to determine the expirationdate of the subscription, given the date today is the start of subscription and duration type of example 6 months. $subscriptiondate = date(Y-m- d,mktime(0,0,0,date('m'),date('d'),date('Y'))); $expiredate = date(Y-m- d,mktime(0,0,0,date('m'),date('d'),date('Y')) + 2592000); the 2592000 timestamp for 1 month. how can i compute the timestamp for 6 months or maybe 1 year or more. Thank you Regards, Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php