Re: [PHP-DB] PHP2 Forum Crashed
Can't help you if you take the site down. It didn't do you any good to post the link if your code is no longer there. Jim ps- I tried to reply directly to you but it seem that Earthlink does not want to accept my e-mails because I am not an EarthLink user. How lame is that!? 550-EarthLink does not recognize your computer (xxx.xxx.xxx.xxx) as connecting from an EarthLink connection. If this is in error, please contact technical support. {I removed the real IP address} ---Original Message--- From: Joseph Allard Date: Tuesday, October 28, 2003 03:26:45 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] PHP2 Forum Crashed Now, I two seperate problems with two different websites. My PHP2 Forum crashed along with the rest of my website --www.dutchspecialops.com. I called GoDaddy.Com, my host provider and they said that the problem was with us not with their server. However, my web designer insist that it is a parse problem. What should I do and how can I find out what the real problem is? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php .
Re: [PHP-DB] mysql field not resolving comaparison condition for zip code locator
Jennifer is correct, the query that you have below will never return anything. The last two AND statements exclude each other. You need to change the greater than and less than signs on them and try it again. For now, don t take what the developer is telling you as the gospel, go with what the logic tells you. It is not possible to have a number that is both larger then 37.6 AND smaller then 37.5, it just isn't going to happen. Corrected SQL: $sql=SELECT City FROM ZIPCodes WHERE Latitude = 122.02671343318 AND Latitude = 121.96888656682 AND Longitude = 37.617091284671 AND Longitude = 37.508048715329; Jim ---Original Message--- From: AdminHMO Date: Tuesday, September 23, 2003 13:35:31 To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] mysql field not resolving comaparison condition for zip code locator Thanks Jennifer, I got the query and the zipcode longitude and latitude from the developer of the zipcode locator. When I contacted them about this issue they had me run this query in the phpMyAdmin against the zipcode date and I still got no data returned. Jennifer Goodie [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I am having trouble implementing a zip code locator program. All of the functions work correctly but the $sql variable. The problem occurs by using the latitude argument as a comparison. The first latitude argument works but when the second latitude argument is added the query returns no data. Here is an example of the $sql variable being used. $sql=SELECT City FROM ZIPCodes WHERE Latitude = 122.02671343318 AND Latitude = 121.96888656682 AND Longitude = 37.617091284671 AND Longitude = 37.508048715329; I think Latitude only goes to 90, so they are all under 122 and none are above 121. Also, you aren't going to get something that is greater than 37.6 but less than 37.5 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php .
RE: [PHP-DB] Browser-Trouble with Query
Sounds like you had a cache problem going on. I wanted to suggest that but got tied up on something else. Whenever you see the same results, even though you are changing the code, try and delete the cache files in the browser, exit the browser, then come back in and try it again. Usually this clears the problem. Jim ---Original Message--- From: [EMAIL PROTECTED] Date: Wednesday, September 03, 2003 03:10:06 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Browser-Trouble with Query Hi, the problem is solved ... but the solution is searched. I renamed the file to mypage2.php and the script works fine. Puzzles me quite a bit. So, if anyone has an idea... I'm thankful for any comments. Thanks to you guys who replied. Sebastian Haag said: Hi guys, Hutchins, Richard said: Two things: First, a copy of your code would help, with line 156 clearly identified. Sure, [...more code goes here...] $query .= $and; $result = @mysql_query($query) or die(Game ID: . mysql_error()); $i = 0; while($row = @mysql_fetch_row($result)) { $game_id[$i] = $row[0]; $i++; } if($game_id $def_id) #156-- { if($choice == 1) frontsDnDst($script, $game_id, $def_id); /*user defined functions are included in an include file at the beginning of the script*/ elseif($choice == 2) coversDnDst($script, $game_id, $def_id); elseif($choice == 3) frontCoverDnDst($script, $game_id, $def_id); } else { echo br/br/Sorry, no matching results found.br/; echo br/A HREF='erase.php'[Zuruuml;ck]/a; exit; } [more code goes here...] Second, usually there's more information with the parse error. Something like expected ',' or ';' that will give you more of a hint. Although, I'm That's all there is. And I have had the ones you are talking about. But not this time. not sure if the PHP.INI file has a setting for displaying that information. At the very least, the code though. -Original Message- From: Sebastian Haag [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 03, 2003 4:12 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Browser-Trouble with Query Hi everyone, I have trouble with a PHP-script querying a MySQL-database. Actually my Opera-Browser has trouble (version 7.11 on a Win2000 machine). It outputs a parse error when i enter that page. Parse error: parse error in /var/www/mypage.php on line 156 After checking all parenthesis over and over, I decided to enter that page with the InternetExplorer (version 5.50). And it worked. What gives me a headache is that I tried commenting out that specific part of the script. Still parse error on the same line. I inserted a bunch of empty lines around line # 156 and I still got the same error at the same line. I don't have any more ideas. I hope you may have a hint. Thank you very much. I appreciate your help! Greetings, Sebastian P.S. PHP version 4.1.2 -- Once a problem is defined - it is half way solved. (Henry Ford) -- 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 -- Once a problem is defined - it is half way solved. (Henry Ford) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Once a problem is defined - it is half way solved. (Henry Ford) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php .
Re: [PHP-DB] how to show online members.
There was a post yesterday on PHP Classes that is this very thing. Go to www PHPclasses.org and search for UsersOnline2. This should help you out a bunch Jim hunter ---Original Message--- From: Smita Manohar Date: Wednesday, March 12, 2003 09:59:42 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] how to show online members. hello all, im writting code for discussion forum. can any one give any idea about how to show online status of members on and off ? - smita. _ Get ball by ball action on your desktop. http://server1.msn.co.in/msnspecials/cricketdownload/contest.asp Get Hutch MSN Cricketer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php .
Re: [PHP-DB] Real Killer App!
Just a guess, but do you have an index on the table that you are using to store the URLs that still need to be parsed? This table is going to get huge! And if you do not delete the URL that you just parsed from the list it will grow even faster. And if you do not have an index on that table and you are doing a table scan to see if the new URL is in it or not, this is going to take longer and longer to complete every time you process another URL. This is because this temp table of URLs to process will always get larger, and will rarely go down in size because you add about 5+ new URLs for every one that you process. But then again, we don't know for sure on anything without seeing 'some' code. So far we have not seen any so everything is total speculation and guessing. I would be interested in seeing the code that handles the processing of the URLs once you cull them from a web page. Jim Hunter ---Original Message--- From: Nicholas Fitzgerald Date: Wednesday, March 12, 2003 10:15:52 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Real Killer App! Rich Gray wrote: I'm having a heck of a time trying to write a little web crawler for my intranet. I've got everything functionally working it seems like, but there is a very strange problem I can't nail down. If I put in an entry and start the crawler it goes great through the first loop. It gets the url, gets the page info, puts it in the database, and then parses all of the links out and puts them raw into the database. On the second loop it picks up all the new stuff and does the same thing. By the time the second loop is completed I'll have just over 300 items in the database. On the third loop is where the problem starts. Once it gets into the third loop, it starts to slow down a lot. Then, after a while, if I'm running from the command line, it'll just go to a command prompt. If I'm running in a browser, it returns a document contains no data error. This is with php 4.3.1 on a win2000 server. Haven't tried it on a linux box yet, but I'd rather run it on the windows server since it's bigger and has plenty of cpu, memory, and raid space. It's almost like the thing is getting confused when it starts to get more than 300 entries in the database. Any ideas out there as to what would cause this kind of problem? Nick Can you post some code? Are your script timeouts set appropriately? Does memory/CPU useage increase dramatically or are there any other symptoms of where it is choking...? What DB is it updating? What does the database tell you is happening when it starts choking? What do debug messages tell you wrt finding the bottleneck? Does it happen always no matter what start point is used? Are you using recursive functions? Sorry lots of questions but no answers... :) Cheers Rich Recognizing that this script would take a long time to run I'm using set_time_limit(0) in it so a timeout doesn't become an issue. The server has 1.5 gig of memory and is a dual processor 1GHz PIII. I have never seen it get over 15% cpu usage, even while this is going on, and it never gets anywhere near full memory usage. The tax on the system itself is actually negligable. There are no symptoms that I can find to indicate where the chokepoint might be. It seems to be when the DB reaches a certain size, but 300 or so records should be a piece of cake for it. As far as the debug backtrace, there really isn't anything there that stands out. It's not an issue with a variable, something is going wrong in the execution either of php, or a sql query. I'm not finding any errors in the mysql error log, or anywhere else. Basically the prog is in two parts. First, it goes and gets the current contents of the DB, one record at a time, and checks it. If it meets the criteria it is then indexed or reindexed. If it is indexed, then it goes to the second part. This is where it strips any links from the page and puts them in the DB for indexing, if thery're not already there. When it dies, this is where it dies. I'll get the UPDATING: titleurl message that comes up when it does an update, but at that point, where it is going into strip links, it dies right there. Nick
Re: [PHP-DB] Define()
The reason it doesn't work may go beyond PHP. You are trying to make an HREF point to an exact location on your hard drive. When the user of your web page clicks the link, they do not have that location on their system so it will fail. Always use relative locations for links. Then once you get that ironed out, skip the defines, just use the variables. Change the code to be: $doc_dir = /store/; $image_dir = /images/; $control_dir = /control/; ?php echo $control_dir ?verify_login.php a href=?php echo $doc_dir ?click here/a and don't forget the 'php' after the ? Jim Hunter ---Original Message--- From: [EMAIL PROTECTED] Date: Wednesday, March 12, 2003 10:51:04 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Define() I am developing an app which needs 3 constants. The value of these constants comes from a database result. This works fine. My problem is that they do not work very well. I am developing on both windows/Linux (depending what I boot into). This is the effect I want $doc_dir = the string of d:/is/clients/client/web/store/ $image_dir = the string of d:/is/clients/client/web/images/ $control_dir = the string of d:/is/clients/client/web/control/ define(HOME_DOC_ROOT,$doc_dir); define(IMAGE_DOC_ROOT,$image_dir); define(CONTROL_DOC_ROOT,$control_dir); The outcome is that 1. I cannot submit pages using action=? echo CONTROL_DOC_ROOT ?verify_login.php 2. I cannot use links as a href=? echo $DOC_HOME_ROOT ?click here/a Has anyone had a lot of use with define and in my scenario. I don't the problem is with the db results, I think it's more of the define(). Like I said above, I am using this on linux as well as windows. == Every chance I get, I try to incorporate Open Source resources into my everyday work. Maybe instead of of paying Microsoft for software, the money can added to my salary. == -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php .
Re: [PHP-DB] some php and database questions!
You are putting too much thought into this. Don't get reporting mixed up with computing. When your admin updates the games and designates who won the game, put a 1 in a column next to the winning team and a 0 next to the looser, if they tie, enter a 1 next to both teams. Then when you want to see a list of who got the most right that week, make a query that matches the choice the player made with the team they chose and count it if there is a 1 in this new column. Most of your work is going to be in writing queries that bring back the right totals. If you try to write a routine to add values to a 'total' column if a given team wins, it just might work. But what if you accidently runit twice or forget to run it. Your results will not be accurate. You also asked about locking people out after a given time. This is very easy, when they fill out a form to pick winners, that form has to be submitted to a PHP script for processing, this is where you check to see if the cut-off time has passed. If so, then you display a message telling them that they are too late and do not accept the entries. Bottom line is leave the calculations to the report (web page) and the data to the database. Jim Hunter ---Original Message--- From: JeRRy Date: Tuesday, March 11, 2003 17:23:47 To: [EMAIL PROTECTED] Subject: [PHP-DB] some php and database questions! Hi, I am currently running a tipping competition where people tip the team they think will win the given game or pick the draw. Each correct entry gets +1 point, each incorrect entry gets 0 points. There is 8 games a round and people submit their entries via a PHP page that updates a mysql database. Now for the admin side of things, to make it easier for admins to update records accordingly without needing to manually add them up one by one. I want a system I can go into where I select the winners of each round. If a tipster has any matches it will credit their accounts +1 for each correct entry and 0 for each incorrect entry. There is 8 games a round (on a weekend) .. So how would I get the entries to update to the correct amount when I select the winners. I'd need the admin page to be something like this. Game1 : team 1 team 2 draw Game2 : team 3 team 4 draw and so on, Probably a drop down menu to select the winner or draw. So what query would I need or PHP code to update the database with +1 for correct matches and 0 for incorrect? Or would I be better to have 1 page per game? I need a safe and reliable way of doing it. Also I am going to have a tipster tally. They will be in order of total score. So order will change from week to week, how can I auto-sort a list using PHP to display on a page without it messing up the score with someone else. So I need the top score to go to the top but take the name also and not just the score, any ideas? For instance: Week 1 bob 7 judy 6 Amanda 5 . Week 2 Judy 10 Amanda 9 bob 8 From week 1 to 2 bob needs to drop down the bottom, Judy needs to move up one and Amanda is to also move up one. I need it to be automatic instead of me having to do it manually. Any ideas? (I think this was discussed about a month ago, if so I appologise for the repeat but the help is very appreciated.) Lastly the games in the week are different from others. There is normally a Friday night games, a few Saturday games and Saturday Night and a few Sunday games. I really don't want to lock people out if they don't submit a tip before the first game. But I do want to lock out any tips made for a game that has already started. For instance: It's 8:05 PM and there was a game to start at 7PM I want to lock out the tips for the first game but allow tips for the remaining games. How can I lock people out? Sure I could remove the option on the page but that does not stop people from loading the page just before the start of the game and sitting on it till the game has finished and than submitting their tips. I need another way, dynamic pages? Or something else? If the easiest option is to lock people right out after the first game has started I will, but I'd prefer to not do that. Feel free to use any database structure you like, any table names are ok. As long as you define what you mean so I can understand what you mean and I can try for myself. Thanks so much in advance, credit will be given. Jerry http://mobile.yahoo.com.au - Yahoo! Mobile - Check compose your email via SMS on your Telstra or Vodafone mobile. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php .
Re: [PHP-DB] retrieve last n records
I guess I am confused, how does one query effect a query that you have in an other part of the page? The two queries are not related. The second thing I am confused on is: Do you want the last n records that were added to the table or do you want the last n records in a given index? Jim ---Original Message--- From: drparker Date: Thursday, March 06, 2003 13:46:58 To: [EMAIL PROTECTED] Subject: [PHP-DB] retrieve last n records I need to retrieve the last n records of a table, n will probably be 2 or 3. I know that I can accomplish this by: select * from table order by field DESC Limit n, but i would prefer not to do this way because it interferes with my sorting mechanism on the main page. Is there any other way to do it? -- 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] retrieve last n records
If it were me I would tackle this in two parts. First create a SQL statement that returns the data you want, you say you can do this so the first part is already finished. Then stuff the data into an array and when you go to display the data to the user, that is when you sort it into the chosen sort order. It is not that hard to sort an array and you might be able to find a class already written to do this on the PHP classes web site. You might even go so far as to display the info in a table that allows the user to click on a column heading and re-sort the data on-the-fly without a round trip to the server. This might add a nice touch to your UI without too much effort. Jim ---Original Message--- From: drparker Date: Thursday, March 06, 2003 14:23:29 To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] retrieve last n records I need the last n records when, say user_id = 3. So it returns all rows where user_id = 3, then, on top of that I need only the n most recently entered records. The problem with the sorting mechanism I have existing is essentially that those last n rows need to be sorted ASC or DESC by every field. So basically, I need to be able to retrieve those last n rows where user_id = whatever, then be able to sort those last 3 rows ASC or DESC by any field. Jim Hunter wrote: I guess I am confused, how does one query effect a query that you have in an other part of the page? The two queries are not related. The second thing I am confused on is: Do you want the last n records that were added to the table or do you want the last n records in a given index? Jim ---Original Message--- From: drparker Date: Thursday, March 06, 2003 13:46:58 To: [EMAIL PROTECTED] Subject: [PHP-DB] retrieve last n records I need to retrieve the last n records of a table, n will probably be 2 or 3. I know that I can accomplish this by: select * from table order by field DESC Limit n, but i would prefer not to do this way because it interferes with my sorting mechanism on the main page. Is there any other way to do it? -- 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] Members area
Gavin, Download PHP-Nuke and look to see how they handle Non-Users/users/Admins and go from there. It's actually quite easy. They have a table structure that you could utilize and some generic routines for determining if a user is logged in or if they are an Admin. www.phpnuke.org Jim ---Original Message--- From: Gavin Amm Date: Wednesday, January 22, 2003 05:05:32 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Members area Hi All, I'm about to start development on a members area for a site. The members area will have 2 levels - Paid Free, with the Paid members having access to more pages. I have not created a members area before am after any advice or links I can get... I think a lot of reading is in order... Particularly: - DB structure fields (I'll be using MySQL if that's relevant) - Sessions (I've seen quite a few threads covering sessions over the last couple of months, so should have some links in my 'inbox' somewhere... But the more the merrier...) - Any PHP suggestions/advice/links - Anything else you can think is relevant... Thanks, this will be a big help. Cheers, Gav -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php .
Re: [PHP-DB] multiple pages
The simplest way is to use the LIMIT keyword in your SQL statement. Set, or allow the user to set, the number of items to show at one time, then keep this number as a hidden field and use it to determine what record to go to when they click the page number or the next button. So a sample would look like: $NumOfRecs = 30; // or any value that the user might choose or whatever you want $start = ($PageToDisplay * $NumOfRecs) - $NumOfRecs; SQLtext = select blah blah blah from mytable limit $start, $NumOfRecs; { get the data and display the page} with this method there is no management except to keep track of the current page and the number of records to display. This can be done with hidden form fields or any other way you choose (cookies, global vars, etc). Hope this helps. Jim ---Original Message--- From: Serguei FRAMPOL Date: Wednesday, January 08, 2003 11:51:31 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] multiple pages Hello everybody, I am PHP-beginner, and I have to code the multiple result pages management - just like search engines display something like that: First Previous 1 2 3 4 Next Last io each page allowing users to link to a dozen neighboring pages directly. Could you give me some tips of how to code this kind of management? Thank you in advance. -- Best regards, Serguei mailto:[EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php .
Re: [PHP-DB] mysql wildcard
If you want all records, remove the where clause. select * from mytable Jim ---Original Message--- From: Edward Peloke Date: Wednesday, January 08, 2003 02:03:04 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] mysql wildcard I have an query: select * from offtime where type='$type' then I just pass the type variable to the page. Is there a wildcard in mysql like there is in sqlserver that I can use to grab all the records? such as select * from offtime where type='%' would grab all. Thanks, Eddie -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php .
Re: [PHP-DB] More Apache Installation problems
Alex, Your setup will not work like you think. To do what you want you are going to need 2 hubs unless you are doing some sort of NAT on the server. I have this exact same setup and have set up many like it. If you write me directly I can help you out on this, there are a few questions I have to ask that you don't want the answers broadcast over a newsgroup. Jim ---Original Message--- From: Alex Francis Date: Monday, December 09, 2002 12:46:03 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] More Apache Installation problems Adam, You are correct. I had two NICs, set up exactly as you describe, but kept getting problems (I would lose my internet connection and have to reboot to get it back. I think I will try againand if that fails, buy a cable modem router. Adam Williams [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... No I think he has his WS with a real IP from his ISP and then his web server plugged into the same hub as his WS but with 192.168.1.1. He'll either need to get a 2nd NIC and give it an ip like 192.168.1.2 or get a cable modem router. Or change his WS to linux and add eth0:0 with 192.168.1.2 :) Adam On Mon, 9 Dec 2002, Gene Dymarskiy wrote: I am a bit confused. Your WS is connected to cable modem and gets public IP assigned by your ISP. Your WS is also connected to a hub shared with your web server. does it mean you have two network cards, one connected to cable modem, and the other to the hub? -Original Message- From: Alex Francis [mailto:[EMAIL PROTECTED]] Sent: Monday, December 09, 2002 2:20 PM To: Gene Dymarskiy Subject: RE: [PHP-DB] More Apache Installation problems I need to have a server assigned IP address on my workstation for my cable modem. -Original Message- From: Gene Dymarskiy [mailto:[EMAIL PROTECTED]] Sent: Monday, December 09, 2002 8:06 PM To: Alex Francis; [EMAIL PROTECTED] Subject: RE: [PHP-DB] More Apache Installation problems I'd check IP address of your workstation. make sure both the WS and the server are on the same subnet. Your WS should have 192.168 address, too. good luck -Original Message- From: Alex Francis [mailto:[EMAIL PROTECTED]] Sent: Monday, December 09, 2002 2:00 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] More Apache Installation problems It seems like a network problem. I can access the network through windows network neighborhood but can't ping it, any suggestions? Gene Dymarskiy [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... make sure both your server and workstation can see each other. try pinging the server: ping 192.168.1.1 -Original Message- From: Alex Francis [mailto:[EMAIL PROTECTED]] Sent: Monday, December 09, 2002 1:39 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] More Apache Installation problems At last I have Apache and PHP running on my server. My server IP is 192.168.1.1 and I have set ServerName 192.168.1.1 in my httpd.conf file. I can access my test files from the server using either http://localhost or http://192.168.1.1, however if I try the same on my main workstation I can't find the server. Is there something else I need to do. -- 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 -- 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 . -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Parse Error...
In that case, your logic is not going to work. You have live PHP code inside a string. You are going to need to build the $message in pieces. Start with the HTML, then add the result from each itteration of your PHP loop to $message then add the trailing HTML to form the complete $message. Your close, but it's just not going to work like you think it will. Jim ---Original Message--- From: Chase Date: Monday, December 02, 2002 04:34:18 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Parse Error... There is a single quote and semicolon on the line under /html that I thought would be defining the end of the assignment. Should I have used double quotes instead of single? Chase Micah Stevens [EMAIL PROTECTED] wrote in message 1038870535.23725.123.camel@tyrell">news:1038870535.23725.123.camel@tyrell... There aren't any closing quotes on your $message variable or semicolon to tell the parser that you're done with the assignment statement. -Micah On Mon, 2002-12-02 at 15:05, Chase wrote: When trying to execute the following script to send the contents of a table via mail() I am getting this error... Parse error: parse error, unexpected T_STRING in FILENAME.PHP on line 36 The portion of this code inside the HTML tags works great for displaying the table on the screen, but when I include it in the larger script for sending a mail message, I get this error. I am sure that it is something simple that I have been too stupid to catch, but any help would be great! Chase Code Follows --- ? $server = ; $user = ; $pass = ; $db = ; $table = ; ? ? $to = CKnott [EMAIL PROTECTED] . , ; $to .= Chase [EMAIL PROTECTED]; $subject = Price File Access History; $message = ' html headtitlePrice File Access/title/head body table border=1 align=center tr td div align=centerbiDate / Time/i/b/div /td td div align=centeribLogged IP Address/b/i/div /td td div align=centeribLogged Username/b/i/div /td /tr $link = mysql_connect($server, $user, $pass); mysql_select_db($db, $link); $result = mysql_query(SELECT * FROM $table ORDER BY 'view_date' DESC,$link); $num_rows = mysql_num_rows($result); if($num_rows) { // print(ptable border=1 align=center); while($row = mysql_fetch_row($result)) { print(tr); print(td$row[0]/td); print(td$row[1]/td); print(td$row[2]/td); print(/tr); } print(/table/p); } else { print(No Files To Show!!); } /body /html '; $headers = MIME-Version: 1.0\r\n; $headers .= Content-type: text/html; charset=iso-8859-1\r\n; $headers .= From: MIC Price File Monitor [EMAIL PROTECTED]\r\n; mail($to, $subject, $message, $headers); ? -- Raincross Technologies Development and Consulting Services http://www.raincross-tech.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php .
Re: [PHP-DB] Credit Card Info Cryptography
There is a simple alternative that you might not be aware of, and that is use Advantage Database (I am assuming that you are using MySQL right now). You can get a free version to try and it provides encryption at the table level. There is a PHP interface for it and everything can be found at www advantage-database.com and go the the developers download area. I have been using it in my everyday development for about 4 years and I love it. I just recently saw that they offer a PHP interface to it as well as an ODBC, VB, Delphi, C++ Builder, JBuilder etc. Store the credit card info in Advantage and leave the rest of your data where you have it. Just a thought... Jim ---Original Message--- From: Doaldo Navai Junior Date: Wednesday, October 23, 2002 12:52:23 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP-DB] Credit Card Info Cryptography Suppose I sell some products online and get user's credit card info via SSL connection. Isn't there any method (free, preferably) of ASSYMETRIC (Public key) cryptography I can use with PHP to store this data in a db?? Or is there any other good option instead of this? TIA, Doaldo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php .
Re: [PHP-DB] Flush database
First make sure that you are storing the IP and the time it was saved in the database. Then I would have 3 queries: 1) a query to see if the IP address is in the database and less then an hour old. 2) a query to save the IP and time into the database 3) a query to delete all entries over 1 hour old. Then when you get a new visitor see if the IP address is in the database and is not less then 1 hour old. Once it clears that test, save the IP and time, then always run the delete query to clear out entries. If you have a lot of traffic to your site you are going to generate a lot of database hits. Good luck. Jim ---Original Message--- From: wade Date: Friday, September 27, 2002 02:02:50 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Flush database I am storing IP addresses in a database, but after an hour has passed I want to delete all the IP addresses from that database. I want to do this based on the server time. Example.. Someone comes to my web page, I store their IP address in my database. So now I write a PHP script that says if that IP returns to my page within an hour, they can't view my page. If they come back after an hour has passed they can view the contents of that page. but only after an hour has passed. Can anyone help me with the syntax or functions that will clear the database after an hour of waiting has passed? Is this possible? Any suggestions, logic or any help on this matter will be greatly appreciated. Thank you -- Should you have any questions, comments or concerns, feel free to call me at 318-338-2033. Thank you for your time, Wade Kelley, Design Engineer Bayou Internet...(888) 30-BAYOU...http://www.bayou.com Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net Vicksburg Online...(800) MISSISSIPPI...http://www.vicksburg.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php .
RE: [PHP-DB] not a valid MySQL result
Change your query to be: $query_cat = select concat(author_names, ' ', author_surnames) as somenewcolname from author, author-cat where author_cat.cat_code = $code and author.author_code = author-cat.author_code; Change somenewcolname to whatever you want the column to be called or leave the as somenewcolname part off if you don't care what the column name is. This should help. Jim ---Original Message--- From: Wilmar Perez Date: Friday, September 06, 2002 12:16:28 To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] not a valid MySQL result Hi guys Thanks for your help. Peter was right I had an error in the sentence, I worked it out but still the same error came up. The mysql_error() function doesn't return any thing. Any idea? Thanks a lot. Hi Couple of points, you probably have an SQL error, I use echo $query; echo 'br'.mysql_error(); which shows the query and the error you use 'author-cat' in the table name and 'author_cat' and 'author-cat' in the where clause which will throw an error. *** Wilmar Pérez Network Administrator Library System Tel: ++57(4)2105145 University of Antioquia Medellín - Colombia 2002 *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php .
Re: [PHP-DB] not a valid MySQL result
Oops, you have one more error that I see, one one line you reference author-cat as a table name and on another you refer to it as author_cat. Make the appropriate change and try it again. One of the table references is wrong and will generate a missing table error. Jim ---Original Message--- From: Wilmar Perez Date: Friday, September 06, 2002 09:57:48 To: php-db mailing list Subject: [PHP-DB] not a valid MySQL result Hello guys This is my first posting to the list, even though I've had some experience with C++, these are my first steps with php and mysql. Well, the thing is that I'm getting the following message: Warning: Supplied argument is not a valid MySQL result resource in /var/www/bva/new/main/colecciones.php on line 35 The code is shown below: $query_cat = select author_names || ' ' || author_surnames from author, author-cat where author_cat.cat_code = $code and author.author_code = author-cat.author_code; $result_cat = mysql_query($query_cat); $num_results_cat = mysql_num_rows($result_cat); //This is line 35 I did the same with a simpler select sentence and it worked alright, so I guess there's a problem with the select sentence but haven't been able to find it. Does anyone have an idea? Thanks a lot for your help. *** Wilmar Pérez Network Administrator Library System Tel: ++57(4)2105145 University of Antioquia Medellín - Colombia 2002 *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php .
Re: [PHP-DB] Can't see the results
Your problem seems to stem from the $content .= $row; $row is an Array and you must use an index to get at any given value it holds. If you need all of the values in $row, use the count() function to get the number of elements (columns in this case), then loop through them adding them to $content along with any separators (IE: commas or semi colons or spaces) etc. the code might look like this: $content = ; // I like to make sure that the variable is always initialized to something before I use it. $num_results_cat = mysql_num_rows($result_cat); for ($i=0; $i $num_results_cat; $i++) { $row = mysql_fetch_array($result); $num_of_cols = count($row); for ($x=0; $x$num_of_cols; $x++) { $content .= , .$row[$x]; } } This will allow you to loop through every row in the query and add every column to the $content variable. Jim ---Original Message--- From: Wilmar Perez Date: Friday, September 06, 2002 14:50:44 To: php-db mailing list Subject: [PHP-DB] Can't see the results Hello guys Thanks to all those you helped me with y the question I made before (not a valid MySQL result) it's working now. Now, I want to display the result of my search with the following code: if($code){ $query_cat = select author.author_names || ' '|| author.author_surnames as full_name from author, authorxcat where authorxcat.cat_code = $code and author.author_code = authorxcat.author_code or die($mysql_error()); $result_cat = mysql_query($query_cat); $num_results_cat = mysql_num_rows($result_cat); for ($i=0; $i $num_results_cat; $i++) { $row = mysql_fetch_array($result); $content .= $row; /* $content .= htmlspecialchars(stripslashes($row[author_names])) . .htmlspecialchars(stripslashes($row [author_surnames])).br;*/ } } But I just get the following: ArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArray I also tried to do it commenting the $content .= $row; and uncommenting the lines that are commented in the code but I just get a blank page. What am I doing wrong? Thanks a lot for your help. *** Wilmar Pérez Network Administrator Library System Tel: ++57(4)2105145 University of Antioquia Medellín - Colombia 2002 *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php .
Re: [PHP-DB] best way to stare true, false
The smallest amount of database storage is going to be with a TinyInt and if you set up two constants to represent TRUE and FALSE then all your code will read correctly and will store correctly. EG: define(TRUE, 1); define(FALSE, 0); now you can use TRUE and FALSE in your program where you would use any variable (just don't use a dollar sign in front of them). This will make your code much easier to read in the long run. Plus, if you create a 'master global' file with all of your custom routines that you use in all programs, you could have these globals there as well avaialable to all your programs without thinking about it again. Remember, keep your code readable, runable and reusable! Jim Hunter Diamond Computing ---Original Message--- From: andy Date: Saturday, August 10, 2002 07:40:19 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] best way to stare true, false Hi there, I am searching for the best way to store true or false inside a MySQL DB. With best I mean the most data efficient way and in the same time the best for fast searching later on the table to find all which are false, or true. I think I did read something about a way to do this with ENUM, but cant remember where and how, all tryes did not succeeed so far. Thanx for any help on that. Andy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php .
RE: [PHP-DB] adding a space in mysql
Richard, You are correct. For Ron to achieve his goal, the SQL needs to be changed to: WHERE name = '$var' If you use the LIKE operator and have a trailing %, that is telling mySQL to match the first characters exactly and then match ANY trailing characters. If you use the equals operator, then you are guaranteed an exact match. If you are concerned about matching any case, then set both strings to UPPER case then do the compare. Jim Hunter ---Original Message--- From: Hutchins, Richard Date: Wednesday, July 31, 2002 13:48:17 To: 'ron wallace'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] adding a space in mysql I haven't set up any text-based searches before, but when you say: snip If the user types 'Wash' I don't want any matches for 'Washington', 'Washing', etc. snip Aren't you, in essence, saying that you want to search for Wash? Meaning that your query could just say WHERE name = '$var' (where $var is set to Wash)? According to the MySql manual, the equal comparison operator works on strings and numbers. But maybe text searches work differently than I thought and it will return strings wherever the letter combination wash appears. If that's the case I'm sure somebody will correct me and I'll learn something in the process. -Original Message- From: ron wallace [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 31, 2002 4:32 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] adding a space in mysql How can I add a space to the end of a varchar string in mysql? I can't seem to do it directly, and I tried str_pad and other things, but no luck so far. The db doesnt hold the value of the space...its getting trimmed somewhere(?) The reason I want to do this is so I can search for exact matches on one word strings without stemming: WHERE name LIKE '$var %'. If the user types 'Wash' I don't want any matches for 'Washington', 'Washing', etc. Thank You All __ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com -- 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 .