Re: [PHP] What are these weird variables??
On 6/3/05, Brian Dunning [EMAIL PROTECTED] wrote: I'm using a class that I downloaded, and to access the database it uses variable names in all caps, like this: those are constants: it's like a variable, except once you define it, it stays set at that value and you can't change it. And it no longer works, says it can't connect to the database. What's the deal with those variables in all caps, and why won't mine work? The above class is inside a defined function, are my variables not valid inside that function? well, if you have variables in the body of your script, and you want to use those same variables, you should declare them global in your function. http://us3.php.net/variables.scope hope that helps drew -- dc .. drewcore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php forum and (almost certainly 0T) client editor
On 5/31/05, Leif Gregory [EMAIL PROTECTED] wrote: FCKEditor http://www.fckeditor.net/ It rocks. i'm currently working on a content management system designed for less-than-computer-saavy users that utilized fckeditor to create/edit content. i found it pretty easy to integrate (their documentation site helped quite a bit) and havent had any troubles. it just generates plain html (no special markup language like bbcode) but that just saves you the trouble of writing a parser. drew -- dc .. drewcore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql + addslashes + stripslashes
I do suspect though, that the problem lies with how I am using addslashes and how I am not using it. Any definitive help would be much appreciated. i'm not an expert at this, but i think that since you're using mysql to store your data, you shouldn't use addslashes() and use mysql_real_escape_string() instead... http://us4.php.net/manual/en/function.mysql-real-escape-string.php but that's just me. i would run any user input through that function to make sure that it's 'safe' to put in your database. of course, i would also be checking the input to make sure that it safe by other means as well. hope that helps. -drew -- dc .. drewcore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hello, I'm new...
i think that you're best bet would be to find some open source community software and go with that. i built a community site from scratch one time, and while it was a lot of fun, it proved to be much more difficult that i had anticipated. so the next client that asked for a similar site ended up with a modified version of the other site with phpbb2 for a message board, another package for a photo gallery (can't recall the name right now), etc. so, in short, find some already written code, modify it a bit to suit your needs, and go with that. it'll save you a lot of time. On 5/13/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi all, I have only recently started to look at php, I hope this list dose not mind 'noob' questions. I have got 'Programming PHP' by Rasmus Lerdorf, Kevin Tatroe and 'Web Database Applications with PHP and MySQL' Hugh E. Williams, David Lane. I would like to create a 'community' website and was wondering if there was a framework available to get me started? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- dc .. drewcore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Strange comparison behaviour
is upgrading your php out of the question? i would go with at least 4.3.x if not 5... unless you don't have root access on your server... in which case, i have no advice... On 5/13/05, Erwin Kerk [EMAIL PROTECTED] wrote: Bogdan Stancescu wrote: You probably mis-typed something: [EMAIL PROTECTED] ~]$ php ? if (info == 0) echo is 0\n; else echo not 0\n; ? Content-type: text/html X-Powered-By: PHP/4.3.11 is 0 Tried that, but notice the PHP Version, it is failing in PHP 4.1.2! Erwin Kerk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- dc .. drewcore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: editor that typesets the php code
well, i'm not sure what to do after your code is done, but as far as editors go, theres a free one out there that does syntax highlighting for a ton of languages (php included) called Vim... it comes with a graphical version called gvim that i do all of my coding on. no debugging features for php (afaik) but you can set up debuggers through vim (never tried though). http://www.vim.org -- dc .. drewcore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource
just put a @ symbol before the function calll, eg while ($myrow = @mysql_fetch_row($result)) { etc On 4/25/05, Mark Sargent [EMAIL PROTECTED] wrote: Hi All, get the following error when calling data from mysql, *Warning*: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in */var/www/html/phpmysqltable.php* on line *36 * Below are snippets of my code, Line 22: $result = mysql_query(SELECT product_name, product_model_number, product_serial_number FROM Products,$db); Line 36: while ($myrow = mysql_fetch_row($result)) { printf(trtd%s %s/tdtd%s/tdtd%s %/td/tr\n, $myrow[1], $myrow[2], $myrow[3]); I'm following a webmonkey.com tut for php/mysql. http://webmonkey.wired.com/webmonkey/99/21/index3a.html Cheers. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- dc .. drewcore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with install to one page only
lisa, i think your problem may be simple enough... but if this doesn't work, i dunno... i'm guessing that you're using some webhost right? well... Note: Your file should be present in the same folder where HEC/ is present E.g: ~/testcal.php [your file where you want to display event calendar] ~/HEC/ [unzipped HEC package] ( I made a page called testcalendar.php and put it in the foldeer HEC, but I am getting error messages. okay.. you put your file (testcalendar.php) in the HEC folder, but you're supposed to put it in the same folder as the HEC folder... using windows, the path would look like this: c:\folder\subfolder\testcalendar.php c:\folder\subfolder\HEC\ but http addresses are written in unix style, so it looks like this /folder/subfolder/testcalendar.php /folder/subfolder/HEC/ hope that makes a little more sense to you... just move that file up one directory and try running it again. drew -- dc .. drewcore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Post shorter code
dont fight guys, it makes me nervous... :) d On 4/21/05, Petar Nedyalkov [EMAIL PROTECTED] wrote: On Thursday 21 April 2005 18:21, Ryan A wrote: It also helps if you quote a bit from the original post so new people to the thread will know what you are talking about... for example: I have no idea about which thread Jason(above) is talking about It's just up to Netiquette ;-) I dont think the above qualifies for netiquette all that much, because I have never found fault with Jason's netiquette, sometimes people just forget and it gets really confusing to the reader who comes in late. OFFTOPIC Forgetting is also an issue in Netiquette ;-) A lot of people forget the rules, it's not a problem. I just meant that we have to be careful. /OFFTOPIC Cheers, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.10.1 - Release Date: 4/20/2005 -- Cyberly yours, Petar Nedyalkov Devoted Orbitel Fan :-) PGP ID: 7AE45436 PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436 -- dc .. drewcore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: 1 web site, 3 servers, 3 countries - best practises?
well, i guess it all depends... are you talking about having one server in south america that acts as your database server, one server in asia that's your web server, and then another server in north america that servers some other task? or are you talking about having a localized database, http, etc, server for each location (read: continent/country)? the first is easy... it'll all just mesh... the second is more difficult. drew -- dc .. drewcore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Streaming video BLOBs from MySQL
i would approach this from another angle... why not store the videos as regular files on your server, then store the filenames as varchar (or something similar - whatever suits you best) on your database. then you can just pull up the filename from the db, and then load it the old fashioned way... and based on what you said before, it should stream. but that's just the way i'd do it... *grin* drew On 4/16/05, Ryan A [EMAIL PROTECTED] wrote: On 4/17/2005 2:08:43 AM, Chris Boget ([EMAIL PROTECTED]) wrote: If I make one pass and get 1mb of the blob...the browser is simply going to load that 1mb only, right? How do I keep looping and refreshing the users browser, or in this case, flash player? Thanks for any ideas! Look into flush(); yeah... you gotto ...or it starts to pile up after a few days :-) -Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.9.13 - Release Date: 4/16/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- dc .. drewcore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: using rand()
i guess a good question would be which one of these methods has more overhead - having php calculate the random numbers for queries, or having the mysql db pick them at random itself? i don't really focus that much on optimization, but if you expect heavy traffic on your site, it might be in your best interest to find out which one executes quicker. On Apr 8, 2005 9:41 AM, kyriacos sakkas [EMAIL PROTECTED] wrote: first I would suggest you get the largest value from the auto increment field (maybe use last_insert_id()). Then use rand(1,$cno_max) three times to get three random cno numbers, then select ... from ... where cno=$val1 or cno=$val2 or cno=$val3 should return the three values. rand() can also be directly in the sql statement. Also manual suggests using mt_rand instead of rand for better performance. K.Sakkas Ryan A wrote: Hey, need some advise on what would be the best way to do this: I have a table with these fields: cno (just a auto_increment field), username, sex (2 values: man, woman), has_pic (0=no,1=yes), pic_name I need to randomly get 3 womens pictures and one guys picture from the above table... I know I need to use rand() and i thought maybe shuffle() but am getting a bit lost in the logic part...help please? Thanks, Ryan -- Kyriacos Sakkas Netsmart Development Team Tel: + 357 22 452565 Fax: + 357 22 452566 kyriacos(at)netsmart.com.cy http://www.netsmart.com.cy Taking Business to a New Level! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- dc .. drewcore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adding Loop / If support to a simple template engine
a parser is a program that i will take some preformatted text, extract the information from it, and then do work with that information. xml programs users parses to pull data from between the tags. in your case, you'd have to have some sort of declaration in your code that sets apart code blocks you want replaced, invent some sort of system of replacing that code on demand, then write that code that implements your system. a little difficult, and out of my scope, i'm sure. unless i spent two weeks with minimal sleep. drew On Apr 6, 2005 9:37 PM, James Williams [EMAIL PROTECTED] wrote: Richard Lynch wrote: On Wed, April 6, 2005 7:04 pm, James Williams said: Hey fellas, I'm makin a forum right now and as a sub project, I'm making a template engine / class. Right now all it does is variable replacement, however I am curious as to how I can implement support for loops and if statements. I would appreciate any ideas that you may have, thank-you! You'll have to write a parser. Or use something like bison/flex/yacc to create one for you. This is not something you want to try to knock out in an afternoon because you're bored. :-) Thank-you, but what exactly does a parser do? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php