[PHP] Jpgraph troubles
Hi, I've been creating some graphs using jpgraph and they work really well when I view them directly i.e. directly through the script. My problem comes as soon as I try to display them using the img tag within another page. When I do: img src=graph.php / I can't get it to display. It just shows the broken image icon. Any ideas whaty may be causing that? TIA, Jord -- Jordan Elver The office is like an army, and I'm the field general. You're my footsoldiers and customer quality is the WAR!!! -- David Brent (The Office) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Jpgraph troubles
I assume you are sending something similar to the following before the actual pic? header(content-type: image/png); Jpgraph does that for you I think. As I said before, the script works when you access it directly, but not when it's through an img tag. -- Jordan Elver There may be no 'I' in team, but there's a 'ME' if you look hard enough. -- David Brent (The Office) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Jpgraph troubles
I can see what headers are sent. What is the url of the image? I checked using curl -I and found that the correct headers are being sent. I found out it was because I didn't have a certain library I needed included within the graph script. Thanks for your help anyway, Cheers, Jord -- Jordan Elver If work was so good, the rich would have kept more of it for themselves. -- David Brent (The Office) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP graphs
Secondly, I'd like to trace a basic X/Y graph with data provided from a DB, any PHP help? JPGraph is good. -- Jordan Elver Put the key of despair into the lock of apathy. Turn the knob of mediocrity slowly and open the gates of despondency - welcome to a day in the average office. -- David Brent (The Office) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Repeating Templates
Hi, I checked the archives for this but couldn't find a simple answer. I'm working on my own templating class. Mainly as a learning experience, but also because I only want something really simple. I sort of know how to do simple variable substitution. I have something along the lines of this below. $name = 'Bob'; $page = new Template; $page-assign('NAME', $name); $page-display(); Which assigns the variable to a template variable like {NAME}. So, that's fine. What I don't know how to do is repeat bits of templates. Say, from a db query or something. How can I repeat the rows for all the data? Any tutorials or advice would be appreciated. Hope my question is clear :) TIA, Jordan -- Jordan Elver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP
Thanks Greg, I know a bit of PHP but the OOP is a bit harder to understand I think :) I'll check out the PEAR classes. Cheers, Jordan On Thursday 16 Jan 2003 12:25 am, Greg Beaver wrote: Hi Jordan, If you are doing this to learn PHP, that is great, keep plugging. If you want to see working examples of the things you've described, there are a number of scripts out there, both in pear (pear.php.net) and at other repositories like phpbuilder.com and phpclasses.org. You would benefit from examining how other authors have solved the same problems even if you are simply trying to learn php Take care, Greg -- Jordan Elver Statistics are like a lamp-post to a drunken man - more for leaning on than illumination. -- David Brent (The Office) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP
Thanks John, Inheriting would probably be the most modular. I thought this would be the way to go. Ill need to read up on this. I haven't found any clear examples of this kind of OOP, only the real basics (which I still need help with by the way :) ). Use google. Do some more studying before you try to tackle this, or look on phpclasses.org for some examples. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ Nice work on php archittect by the way :) Thanks again, Jordan -- Jordan Elver The office is like an army, and I'm the field general. You're my footsoldiers and customer quality is the WAR!!! -- David Brent (The Office) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] More OOP
Hi guys, After your previous advice. I have been looking at some more OOP for my application. Is this the sort of way a proper OOP application should be constructed? I want to use smarty as my template language as well, how could I integrate that? ?php class Base { function test_base() { echo 'Some other functions in here maybe?'; } } class Error extends Base { function raise_error() { echo 'I am raising an error'; } } class Database extends Error { function connect($details = '') { echo Connecting to the databasebr /; // get connections details list($host, $username, $password, $type) = $details; // connect to the database if($connection = mysql_connect($host, $username, $password)) { $this-raise_error(); } } } class Login extends Database { function Login() { echo Hello, I'm the Login classbr /; // connect to the database $this-connect(); } } $c = new Database; $c-connect(); Any pointers would be great :) Cheers, Jord -- Jordan Elver You don't have to be mad to work here, but you do have to be on time, well presented, a team player, customer service focused and sober!! -- David Brent (The Office) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Authentication programming
Hi Justin, Thanks for that link, looks pretty interesting. I'll take a closer read later. Cheers, Jord -- Jordan Elver Eagles may soar high, but weasels don't get sucked into jet engines. -- David Brent (The Office) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OOP
Hi, I've been doing a little OOP lately and have a few questions. I want to build an application, there a re lots of elements to the application: Authentication, Database, Presentation, Error Handling etc. Now, I want to code this cleanly and make it reusable. So, a class for each of these elements would be a good idea? Say I have an Authentication class. It has to run on it own. Should I build database, error methods into each of my classes? That seems to defeat the point in the first place? At the moment I seem to struggling with how to do somthing right and well, rather than the actual code :) Thanks for any advice you can give, Jord -- Jordan Elver You don't have to be mad to work here! In fact we ask you to complete a medical questionnaire to ensure that you are not. -- David Brent (The Office) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP
I'd recommend you make a separate database class and error class that each of your other classes access. That would make it the most modular and re-usable. ---John Holmes... I was hoping someone would say that :) How could I code that though. I've only just started with OOP and don't understand how I can inherit methods to classes? Is it a good idea to create a new object within each class which, for example, needs to do database stuff or should I inherit the methods? I haven't found any clear examples of this kind of OOP, only the real basics (which I still need help with by the way :) ). Thanks for your help, Jord -- Jordan Elver Is your work done? Are all pigs fed, watered and ready to fly? -- David Brent (The Office) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Authentication programming
Hi, I'm about to start a new project which will require a login system. The system should allow for different types of access on a per page basis. I'm going to achieve the login system using sessions, which I have done before. My problem is that I don't want to have to do much login checking on the actual pages within the system. I would like it to be included and handled oustide of the main application. ?php /* authenticate */ $page_permission = 'admin'; include('includes/login.inc'); /* other page functionality */ ? So, you set the permission for the individual page. I would also like to do this as a class, which I am not experienced in. I haven't found any very elegent solutions to this. Could anyone point out some urls or anything to show me in the right direction? Cheers, Jord -- Jordan Elver There's no 'I' in 'team'. But then there's no 'I' in 'useless smug colleague', either. And there's four in 'platitude-quoting idiot'. Go figure. -- David Brent (The Office) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Checking Checkboxes using Arrays
Hi, This is doing my head in. I'm printing out a lot of countires from a db and i want to select the countries (check their checkboxes) if they are equal to a particular country variable I have set or if they appear in an array. My code is: $european_union = array('24', '17', '1', '58', '74', '80', '73', '83', '101', '103', '119', '144', '164', '186', '193', '212'); print_r($european_union); if(mysql_num_rows($europe_result) 0) { while(list($id, $country) = mysql_fetch_array($europe_result)) { if(($id == $register_country_of_origin) || (in_array($id, $european_union))) { echo\tTD WIDTH=\50%\ CLASS=\pofgreencard\INPUT TYPE=\checkbox\ NAME=\country_id[]\ VALUE=\$id\ CHECKED $country/TD\n; } else { echo\tTD WIDTH=\50%\ CLASS=\pofgreencard\INPUT TYPE=\checkbox\ NAME=\country_id[]\ VALUE=\$id\ $country/TD\n; } } Can anyone give me some tips because if i select a country which is not in the array, it still checks all the boxes of the countires in the array?! I hope this is making sense, I thikn this is what I want ;-) Thanks, Jord -- Jordan Elver Web Developer http://www.theinternetone.co.uk How do I read MIME files??? Quietly, while pretending to be trapped in an invisible box. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] HTTP_REFERER
Hi, I'm writing a 404 handler and in order to report the item that was requested I was trying to get the value of HTTP_REFERER. But, it does seem to get set. Does anyone know how to find thi value? Is there a reason why it would not get set? TIA, Jord -- Jordan Elver Web Developer http://www.theinternetone.co.uk Carpe Aptenodytes! (Seize the Penguins!) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTTP_REFERER
On Friday 23 November 2001 13:39, you wrote: Are you using it as $HTTP_SERVER_VARS[REQUEST_URI] or $REQUEST_URI ? Well, I think I'm buggered then because i just tried to use both and they both report the same value :-( Back to the drawing board. I had the same problem using the latter. The former displays properly. Other than that I can't remember if I changed anything else M: -- Jordan Elver Web Developer http://www.theinternetone.co.uk Unix is not a A-ha experience, it is more of a holy-shit experience. --- Colin McFadyen in alt.folklore.computers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTTP_REFERER
Hi, When I use HTTP_REFERER it gives me the name of the php script which is handling the 404's?! Should that happen? Jord On Friday 23 November 2001 11:41, you wrote: Hi, I'm writing a 404 handler and in order to report the item that was requested I was trying to get the value of HTTP_REFERER. But, it does seem to get set. Does anyone know how to find thi value? Is there a reason why it would not get set? Hi I think you're looking for this $HTTP_SERVER_VARS[REQUEST_URI] M: -- Jordan Elver Web Developer http://www.theinternetone.co.uk testing? What's that? If it compiles, it is good, if it boots up it is perfect. --- Linus Torvalds -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Session and header()
Hi, I've got a login script that uses sessions. To end a login session, I simply delete the session variables and do a session_destroy() which seems to logout everyone ok. The problem comes when I do a header() call afterwards to redirect after logging out. It seems the header() call stops my logging out working correctly?! Does anyone have an idea of why header would interfere with seesion functions? Thank, Jordan -- Jordan Elver http://www.jordanelver.co.uk testing? What's that? If it compiles, it is good, if it boots up it is perfect. --- Linus Torvalds -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP Chat
Hi, Can anyone recommend a good, configurable php chat? I've tried phpMyChat which seems pretty good. Any ideas? Cheers, Jord -- Jordan Elver Web Developer The InternetOne UK Ltd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Accessing lots of variables
Hi, I'm feeling a bit stupid. I have a,load of variables coming from a MySQL connection using list(). The variables are link1 to link 35 inclusive. How can I access each of these variables, check if they are empty, then add them to an array. I don't know how to access then inside a for loop. Can I use $link and append the number on the end somehow? Any help please, Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Merging Arrays
Hi, I've got to different files of words. One on each line. What would be the best way to combine both into one file alphabetically? I thought about: $file1 = file('file1.txt'); $file2 = file('file2.txt'); $both = array_merge($file1, $file2); print_r($both); Any advice? Cheers, Jord -- Jordan Elver Web Developer The InternetOne UK Ltd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Statement Confusion
Hi, Could any one explain what this statemnt means? $i = (!$i)?0:$i; Thanks, Jord -- Jordan Elver Web Developer The InternetOne UK Ltd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Splitting Text
Thanks for that. I ended up using your method as using the LEFT function in a SELECT only grabs characters. Cheers, Jord On Monday 06 August 2001 17:37, you wrote: You can do this several ways... Either use explode(): http://www.php.net/manual/en/function.explode.php ...to split the retrieved data by a space as the delimeter, then use a for() loop to print X number of words... E.g.: $array = explode( , $db_string); for($i = 0; $i 25; $i++) echo $array[$i]; (That will print the first 25 words...) Or, another way to do it is to use strtok() to tokenize the string... http://www.php.net/manual/en/function.strtok.php The manual has a good example of tokenizing a string into individual words... -Original Message- From: Jordan Elver [mailto:[EMAIL PROTECTED]] Sent: Monday, August 06, 2001 5:20 PM To: PHP General Mailing List Subject: [PHP] Splitting Text Hi, Can anyone give some pointers for my problem. I want to pull articles out of a db and then show the first x number of words with a read more link to the rest of the article. Could someone point me in the right direction. I've seen a code snippet for this, but now I can't find it :-( TIA, Jord -- Jordan Elver Web Developer The InternetOne UK Ltd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Splitting Text
Hi, Can anyone give some pointers for my problem. I want to pull articles out of a db and then show the first x number of words with a read more link to the rest of the article. Could someone point me in the right direction. I've seen a code snippet for this, but now I can't find it :-( TIA, Jord -- Jordan Elver http://www.jordanelver.co.uk Oops, my brain just hit a bad sector! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Testing if variable was set
Hi, If I want to test if a variable exists (or has been passed) then I just do: if($var) { // variable is here } But I've noticed that a lot of people do: if(isset($var)) { // variable is here } What's the difference and which is the best way? TIA, Jord -- Jordan Elver while (!asleep()) sheep++; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Printing out usernames and logins
Hi, I'm trying to print out a list of usernames and the times they logged in. I want to print it out like: joe fred frank Then when you click on one of the names it show just there login times, like this, so if I click on fred it prints out: joe fred - login time - login time - login time frank But it doesn't continue printing out the rest of the usernames after it's finished printing freds logins. Any ideas would be appreciated. The code seems to have something to do with the second query, I think :-( The code I'm using is below. Thanks, Jord db_connect(); $sql = SELECT id, username FROM users; $result = @mysql_query($sql); if(@mysql_num_rows($result) 0) { echo'This is a list of Members who have Logged In to their account with times and dates:BRBR'; while(list($id, $username) = mysql_fetch_array($result)) { echoA HREF=\$PHP_SELF?user=$usernameid=$id\$username/ABR\n; if($username == $user) { $sql = SELECT UNIX_TIMESTAMP(time) AS time FROM user_logins WHERE user_id = $id ORDER BY time DESC; $result = @mysql_query($sql); while(list($time) = mysql_fetch_array($result)) { echo date('h:i a l d F', $time).BR\n; } } } } else { echo error('No one has Logged In yet!'); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: [PHP-DB] Printing out usernames and logins
Doh, stupid me. Thanks very much for your help. Your a life saver. Cheers, Jord On Monday 14 May 2001 8:49 am, you wrote: ¥es, U R overwriting Ur result-set from the 1st qry. Store instead the 1st result into an array and iterate it then, sending your second select. U can also use 2 connections, but ... ? Greetinx, Mike Michael Rudel - Web-Development, Systemadministration - ___ Suchtreffer AG Bleicherstraße 20 D-78467 Konstanz Germany fon: +49-(0)7531-89207-17 fax: +49-(0)7531-89207-13 e-mail: mailto:[EMAIL PROTECTED] internet: http://www.suchtreffer.de ___ -Original Message- From: Jordan Elver [mailto:[EMAIL PROTECTED]] Sent: Monday, May 14, 2001 7:35 PM To: PHP DB List; PHP General List Subject: [PHP-DB] Printing out usernames and logins Hi, I'm trying to print out a list of usernames and the times they logged in. I want to print it out like: joe fred frank Then when you click on one of the names it show just there login times, like this, so if I click on fred it prints out: joe fred - login time - login time - login time frank But it doesn't continue printing out the rest of the usernames after it's finished printing freds logins. Any ideas would be appreciated. The code seems to have something to do with the second query, I think The code I'm using is below. Thanks, Jord db_connect(); $sql = SELECT id, username FROM users; $result = @mysql_query($sql); if(@mysql_num_rows($result) 0) { echo'This is a list of Members who have Logged In to their account with times and dates:BRBR'; while(list($id, $username) = mysql_fetch_array($result)) { echoA HREF=\$PHP_SELF?user=$usernameid=$id\$username/ABR\n; if($username == $user) { $sql = SELECT UNIX_TIMESTAMP(time) AS time FROM user_logins WHERE user_id = $id ORDER BY time DESC; $result = @mysql_query($sql); while(list($time) = mysql_fetch_array($result)) { echo date('h:i a l d F', $time).BR\n; } } } } else { echo error('No one has Logged In yet!'); } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Checking query suceeded
Hi Richard, Thanks for the advise. I was just wondering what other people do. I don't think I'll worry about it too much ;-) Cheers, Jord On Wednesday 02 May 2001 3:49 am, you wrote: If I'm doing more than one query on a page what is the best way to check if they all succeeded with out using transactions? You can check each query as it executes, and (perhaps) have your program logic do something intelligent in the case of individual failures. Another possbility is to do all the queries on some temporary table, and then do one big query that inserts/updates from the temp table to the real table... In general, though, once you get a good connection, and if your SQL is valid, queries don't fail very often... Not something you can rely on for mission-critical usage, but you may be over-worried about an infrequent event. Perhaps you could just code it to dump everything to an email to yourself if it ever pukes, so you can fix it by hand. (Kinda dangerous since it could flood your email box if the db goes down completely and you can't get to it to fix it...) -- WARNING [EMAIL PROTECTED] address is not working -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Checking query suceeded
Hi, If I'm doing more than one query on a page what is the best way to check if they all succeeded with out using transactions? TIA, Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] DOCUMENT_ROOT
Thanks for the reply, I'm not using virtual hosts on my local machine but I am on the production machine. What should DOCUMENT_ROOT return? I though it returns the directory of the current script. So if I had a site in /usr/local/apache/htdocs/cha/script.php then I would expect DOCUMENT_ROOT to return /usr/local/apache/htdocs/cha/, is that right? Is it posible to setup a virtual host on localhost? Cheers, Jord On Wednesday 25 April 2001 01:05, you wrote: If you are using Apache virtual host, it will set virtual host's document root. Is this what you want? Regards, -- Yasuo Ohgaki Jordan Elver [EMAIL PROTECTED] wrote in message 01042417535900.00987@localhost">news:01042417535900.00987@localhost... Hi, Has any got any idea why $DOCUMENT_ROOT returns /usr/local/htdocs on my home machine but it should return /usr/local/htdocs/sitename or where ever I put it, but on my production machine it return what it should like /usr/local/sitename or whatever? I'm trying to use it to help include files in different directories (see my previous post, site structure). Got any ideas about this? Cheers, Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Retrieving and Printing Categories
Hi, I've got a load of records that are in different categories. What is the best way to get all the records or selected records and print them in such a way that they are grouped (on the page) in their relevent category, like: Fruit - Apples - Pears - Bananas Vegetables - Carrots - Cabbages etc, etc. Sometime my categories are ina dfferent table, don't know if this matters? How can I do this? TIA, Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] DOCUMENT_ROOT
Hi, Has any got any idea why $DOCUMENT_ROOT returns /usr/local/htdocs on my home machine but it should return /usr/local/htdocs/sitename or where ever I put it, but on my production machine it return what it should like /usr/local/sitename or whatever? I'm trying to use it to help include files in different directories (see my previous post, site structure). Got any ideas about this? Cheers, Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Site Structure
Hi, I have a site structure like: - root --- includes --- admin --- images I'm using headers and footers and they are in the includes directory. My pages in the root directory include the files like: include('includes/header.inc'); Thats woprks fine, but i want to be able ti use the same headers and footers in the admin directory but, of course, the paths are going to be wrong. How can i get around this? Any ideas, Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Site Structure
Hi, Thanks for the reply. I can do that but then the images will not be in the correct location? Jordan On Monday 23 April 2001 15:58, you wrote: give the include() function a complete path: include '/apache/htdocs/include/yourfile.inc.php'; -- Ben Cairns - Head Of Technical Operations intasept.COM Tel: 01332 365333 Fax: 01332 346010 E-Mail: [EMAIL PROTECTED] Web: http://www.intasept.com MAKING sense of the INFORMATION TECHNOLOGY age @ WORK.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Selected Radio Buttons
Hi, I think I'm being stupid. Why won't this code work. The $article_active variable is showing y when I echo it? if($article_active == 'y') { echo"INPUT TYPE=\"radio\" NAME=\"active\" VALUE=\"y\" SELECTEDYes"; } else { echo"INPUT TYPE=\"radio\" NAME=\"active\" VALUE=\"y\"Yes"; } if($article_active == 'n') { echo"INPUT TYPE=\"radio\" NAME=\"active\" VALUE=\"n\" SELECTEDNo"; } else { echo"INPUT TYPE=\"radio\" NAME=\"active\" VALUE=\"n\"No"; } Thanks, Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Updating Sessions
Hi, I've got a multi page form and I'm using sessions to keep track of all the variables between the pages. SO I fill in page one of the form and add the variables to a session. Then I can go on completeing the rest etc. My problem is that I want my users to be able to go back to the pages they have already visited and edit the data (in the form) and then undate the variables in the session. But I can't update the session, so I thought if I called session_unregister and then session_register again then that would work, but it doesn't? How can I get around this? Thanks for any help, Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Selecting Dates
Hi, I'm trying to select records based on dates. I have a table with dates in the format 2001-04-08 and I'm using the query: SELECT name, description, date_time FROM events WHERE YEAR(date_time) = 2001 AND MONTH(date_time) = 04 AND DAYOFMONTH(date_time) = 08 But it doesn't yield any records? I don't really understand why? It seems to be the last bit 'DAYOFMONTH(date_time) = 08' which cause a problem because if I leave it out of the query, it selects all records for a particular month in a particular year as expected. Cheers, Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: [PHP-DB] Selecting Dates
That's what I thought but that doesn't work either? On Sunday 08 April 2001 10:13, you wrote: I'm trying to select records based on dates. I have a table with dates in the format 2001-04-08 and I'm using the query: SELECT name, description, date_time FROM events WHERE YEAR(date_time) = 2001 AND MONTH(date_time) = 04 AND DAYOFMONTH(date_time) = 08 WHERE field_holding_date="2001-04-08" should work. Bye, B. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Passing Arrays
Cheers, that works great. I tried using urlencode but that doens't work like it should in the manual. Thanks, Jord On Thursday 05 April 2001 14:41, you wrote: You have to do this: $myarray = rawurlencode(serialize($myarray)); And then this on your other page: $myarray = unserialize(rawurldecode($myarray)); You should consider using sessions instead. Jordan Elver [EMAIL PROTECTED] wrote: Hi, How can I pass an array between two pages. I've tried using serialize and unserialize. But it doen't return an array. When I use gettype() on it, it say's that the typ-e is boolean? Any ideas? Cheers, Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: [PHP-DB] mysql_result()
Thanks for everyones help with this one, all suggestions appreciated. Cheers, Jord On Wednesday 04 April 2001 17:06, you wrote: Jordan, If you know your result is going to product one row, try using: $row=mysql_fetch_array($result, MSQL_ASSOC); // returns an assoc array where the field names are keys, field value is value $id=row[id]; $name=row[name]; etc. Best regards, Andrew -- Andrew Hill - OpenLink Software Director Technology Evangelism eBusiness Infrastructure Technology http://www.openlinksw.com -Original Message- From: Jordan Elver [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 04, 2001 11:46 AM To: PHP Database Mailing List; PHP General Mailing List Subject: [PHP-DB] mysql_result() Hi, If I knnow that a query will only retrun one row, can I do thiss (below) rather than using a while loop for one record? $id = @mysql_result($result, 0, 'id'); $name = @mysql_result($result, 0, 'name'); $email = @mysql_result($result, 0, 'email'); $address1 = @mysql_result($result, 0, 'address1'); $address2 = @mysql_result($result, 0, 'address2'); $town_city = @mysql_result($result, 0, 'town_city'); $postcode = @mysql_result($result, 0, 'postcode'); Cheers, Jord -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Passing Arrays
Hi, How can I pass an array between two pages. I've tried using serialize and unserialize. But it doen't return an array. When I use gettype() on it, it say's that the typ-e is boolean? Any ideas? Cheers, Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] mysql_result()
Hi, If I knnow that a query will only retrun one row, can I do thiss (below) rather than using a while loop for one record? $id = @mysql_result($result, 0, 'id'); $name = @mysql_result($result, 0, 'name'); $email = @mysql_result($result, 0, 'email'); $address1 = @mysql_result($result, 0, 'address1'); $address2 = @mysql_result($result, 0, 'address2'); $town_city = @mysql_result($result, 0, 'town_city'); $postcode = @mysql_result($result, 0, 'postcode'); Cheers, Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Best way to check if a query succeeded
Hi, i was just wondering what you guys do to check if a wquery suceeded or not? I know about mysql_num_rows() and mysql_affected_rows(), just wondered what you guys do? I normally do something like: $sql = "SELECT something FROM table"; $result = mysql_query($sql); if(@mysql_num_rows($result) 0) { echo'Query Suceeded'; } else { echo'Query failed'; } Cheers, Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Query - Grouping Results
Doesn't seem to work, how would I print that out with PHP? On Monday 19 March 2001 13:52, you wrote: how about something like select distinct name, date_format(time, "%W %D %M %Y") as login from users, user_logins where user_logins.user_id = users.id order by name,time -Original Message----- From: Jordan Elver [mailto:[EMAIL PROTECTED]] Sent: Monday, March 19, 2001 1:43 PM To: PHP Database Mailing List; PHP General Mailing List Subject: [PHP] Query - Grouping Results Hi, I've got a table like: iduser_id ip time 1 2 127.0.0.1 20010316105018 Etc, etc. I do a join on the this table and the users table to get the coresponding username to user_id like this: SELECT users.name AS name, user_logins.ip AS ip, UNIX_TIMESTAMP(user_logins.time) AS time FROM users, user_logins WHERE user_logins.user_id = users.id ORDER BY time ASC How can I display the results grouped by username? So, I want to be able to display: Logins for John Thursday 10th Friday 12th Monday 23rd Logins for Bob Monday 1st Tuesday 2nd Saturday 31st Thanks for any help, Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Query - Grouping Results
Hi, I've got a table like: id user_id ip time 1 2 127.0.0.1 20010316105018 Etc, etc. I do a join on the this table and the users table to get the coresponding username to user_id like this: SELECT users.name AS name, user_logins.ip AS ip, UNIX_TIMESTAMP(user_logins.time) AS time FROM users, user_logins WHERE user_logins.user_id = users.id ORDER BY time ASC How can I display the results grouped by username? So, I want to be able to display: Logins for John Thursday 10th Friday 12th Monday 23rd Logins for Bob Monday 1st Tuesday 2nd Saturday 31st Thanks for any help, Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Login System with access levels
Thanks for all your help. I've settled for an enum field for the time being. I'm going to try something more complex at a later stage. Thanks again, Cheers, Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: [PHP-DB] Sessions in Functions
Hi, Yep I do. I just figured out that it was because I had session_start() inside another function ;-) Thanks anyway, Jord On Friday 16 March 2001 10:43, you wrote: Did you declare $LOGGED_IN as a global variable in your function? e.g. global $LOGGED_IN; _ ~ Richard Allsebrook ~ Applications Developer and Webmaster Easysoft Limited, Thorp Arch Grange, Thorp Arch, Wetherby, LS23 7BA, UK http://www.easysoft.com http://www.easysoft.com - http://www.cinema.com http://www.cinema.com "A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila." _ -Original Message- From: jjelver [mailto:[EMAIL PROTECTED]] Sent: Friday, March 16, 2001 10:41 AM To: php-db Cc: jjelver Subject: FW: [PHP-DB] Sessions in Functions Hi, I have some code which I decided to make into a function. Some of the code updates a session var which holds the current time. It now does not work. // update session variable with new time session_register("LOGGED_IN['time']"); $LOGGED_IN['time'] = mktime(); Are there issues that I should be aware of when I use sessions like this? Thanks, Jord Content-Type: application/rtf; charset="ISO-8859-1"; name="Attachment: 1" Content-Transfer-Encoding: base64 Content-Description: Content-Type: application/ms-tnef; charset="ISO-8859-1"; name="Attachment: 2" Content-Transfer-Encoding: base64 Content-Description: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Login System with access levels
Hi, I've got a db with a username and password in it. I can let people log in, like SELECT * FROM table WHERE username = username AND password = password. But how can I add an access level column so that I can have different levels of security. So admin's can read everything, but users can only read certain sections. How could I add to my db and structure a query? Any ideas would be good, Cheers, Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Getting path of script
Hi, I want to get the path of a script. I know about HTTP_SERVER_VARS["SCRIPT_FILENAME"] this returns someting like: /phpcode/misc/phpinfo.php But I want to strip off the file name and just have the directory path, like: /phpcode/misc/ Any ideas? Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Getting path of script
Hi, Thanks for all the suggestions. I worked out a fix in the meantime: $path = strstr(strrev($SCRIPT_FILENAME), '/'); echo strrev($path); Cheers, Jord On Tuesday 13 March 2001 12:35, you wrote: check out, dirname() // Returns directory name component of path py - Original Message - From: Hardy Merrill [EMAIL PROTECTED] To: Jordan Elver [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, March 13, 2001 5:21 PM Subject: Re: [PHP] Getting path of script How 'bout using a Perl regex with $HTTP_SERVER_VARS["SCRIPT_NAME"] like this: echo "Starting with SCRIPT_NAME=[" . $HTTP_SERVER_VARS["SCRIPT_NAME"] . "]BR"; if (preg_match("/(\S+)\/\S+$/", $HTTP_SERVER_VARS["SCRIPT_NAME"], $matches)) { echo "Found $matches[1]br"; } HTH. -- Hardy Merrill Mission Critical Linux, Inc. http://www.missioncriticallinux.com Jordan Elver [[EMAIL PROTECTED]] wrote: Hi, I want to get the path of a script. I know about HTTP_SERVER_VARS["SCRIPT_FILENAME"] this returns someting like: /phpcode/misc/phpinfo.php But I want to strip off the file name and just have the directory path, like: /phpcode/misc/ Any ideas? Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] DB Abstraction
Hi, I thought it was about time I started using a db abstraction class. Problem is, there are so many out there that I don't which one to start using? I've heard of ADODB (I think). Anyone have any suggestions? Cheers, Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]