Re: [PHP-DB] end of line
Try this: echo str_replace ( \n, p, $string); I believe it always stores newlines as \n, since PHP and MySQL are native to Unix/Linux. -- Marcjon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Fwd: IMPORTANT: Please Verify Your Message
I got this email today. Is php doing this? Is this email ligitimate? On Mon, 19 Jul 2004 09:55:58 -0400, [EMAIL PROTECTED], [EMAIL PROTECTED] p.net said: Hello [EMAIL PROTECTED] , [EMAIL PROTECTED], [EMAIL PROTECTED] is currently protecting themselves from receiving junk mail using [1]Spamcease Just this once, click the link below so I can receive your emails. You won't have to do this again. [2]http://www.tgpwizards.com/spamcease2/verify.php?id=69153 References 1. http://www.spamcease.com/cart/affiliate.php?id=3 2. http://www.tgpwizards.com/spamcease2/verify.php?id=69153 -- Marcjon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php, javascript and db - your help is needed
You could use a if/while construct. Something like: select name=\courses\ ?php if ($_POST['studentselect']){ $result = mysql_query(SELECT courses FROM students WHERE student_name = ' . $_POST['studentselect'] . '); while ($row = mysql_fetch_assoc($result)) { echo option value=.$row['course']..$row['course']./option; } } ? /select Basically you would submit the form, and if a student was selected, it would populate the list with their courses from the database. -- Marcjon - Original message - From: G. Cohen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Sun, 18 Jul 2004 19:30:49 +0300 Subject: [PHP-DB] php, javascript and db - your help is needed Hello, I have a HTML form with 2 select boxes, lets say students and courses. When the from loads for the first time, I fill the students select box with data from database. The courses selectbox remains empty. When the user selects a value from the students selectbox (onchange event), I should go to the db to reterive the courses for the selected student and fill the courses selectbaox. I found it very complicated to do the interaction between javascript and php: apparently, I have to submit the from for the selected student id to be passed as a parameter to php (so that php can access the db with the student id and retrieve his courses), and at the same time I want the form to stay with the list of students, and the selected student. This should not be that hard, should it?! this is something trivial, I hope? I also tried using cookies, with no success. If someone knows how to do that, please let me know. Best Regards, G. Cohen -- 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-DB] Multiple SELECT
I know this issue comes up alot, I've looked through the archives looking for a solution, but none of them are what I want. I have two tables with share a common coloumn, username. One is the user table. It's used to store the user's password, username, email and so on. The other table is for the user's profile (if they choose to have one). It contains msnm, aim, yahoo etc address, birthdate and other stuff like that. So far I have this query: SELECT forumusers.email AS email,forumusers.username AS username,forumusers.level AS level, forumusers.lastlogon1 AS lastlogon1,forumusers.lastlogon2 AS lastlogon2,forumusers.settings1 AS settings1,forumusers.confirmationcode AS confirmationcode, forumuserprofiles.sex AS sex, forumuserprofiles.birthdate AS birthdate, forumuserprofiles.address_msnm AS address_msnm, forumuserprofiles.address_aim AS address_aim, forumuserprofiles.address_yahoo AS address_yahoo, forumuserprofiles.address_icq AS address_icq FROM .$godlyness['database_database']..forumusers,.$godlyness['database_database']..forumuserprofiles .$filterbu. ORDER BY username It works, but not the way I want it to. See, it's not a guaruntee that every user will have a profile. So far, if the user doesn't have a profile, it will display the information of someone else. Is there a way to make the returned columns NULL if the row doesn't exist for the user? Oh yeah, I tried doing a WHERE forumusers.username=forumuserprofiles.username It worked, but if I added a AND forumusers.username = 'search string here' it didn't return anything. Any ideas? -- Marcjon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] get all records but limit to 6
I think the problem is he wants to limit after he's sorted them. The only way I know of to do that is to do the whole query without a limit clause, then run through the results but only do whatever you have to do with the first 6. -- Marcjon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP and DBA (db3)
I assume you're using windows XP or 2000 or server 2003 and are using NTFS. When you get a Permission dinied in e:\data\dhidata\meddictool2 it means the server doesn't have permission to access the folder. You need to go into the folder's properties to change that. I'm not sure how your specific situation, but if you're using IIS I can help you. Email me back if you still have trouble. - Original message - From: Dietmar Hilke [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Fri, 11 Jun 2004 12:52:23 +0200 Subject: [PHP-DB] PHP and DBA (db3) Hello! Trying to bring that code to work on win32. --- h1dba_perf_test.php/h1 ?php $handlers = dba_handlers(true); print pre; print_r($handlers); print /pre; $dbtype = db3; $dbfile = C:/dbfile; $nrecs = 100; echo using datafile: $dbfile.$dbtypebr\n; $id = dba_open($dbfile...$dbtype, c, $dbtype); if (!$id) { die(\nbrdhi: could not open dbfile); } for ($i=0; $i$nrecs; $i++) { $key = rand(1, $nrecs); $value = date(D M j G:i:s T Y); if(!dba_exists($key, $id)) { $ins = dba_insert($key, $value, $id); echo inserted $key:$value in $dbfile.$dbtypebr\n; } } dba_close($id); /// Finds in db $success = 0; $id = dba_open($dbfile...$dbtype, r, $dbtype); if (!$id) { die(could not open dbfile); } $success = 0; for ($i=0; $i$nrecs; $i++) { $key = rand(1, $nrecs); if(dba_exists($key, $id)) { $success++; } } dba_close($id); ? --- Result: Warning: dba_open(C:/dbfile.db3,c): Driver initialization failed for handler: db3: Permission denied in e:\data\dhidata\meddictool2\dba_news.php on line 18 Any Ideas? Thanks! dhi -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Marcjon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Forum Software
Of course it all depends on how complex you want these forums to be. I've been working on my own forums system, which can be viewed at http://marcjon.no-ip.com/juicylucy It's made with PHP 5.0rc2 and MySQL 4.0. It does that job (though coding PHP is just a hobby for my right now, so anything that I want does the job). -- Marcjon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Need some HELP (not works)
- Original message - From: Adam Farid [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Mon, 10 May 2004 19:54:51 + Subject: [PHP-DB] Need some HELP (not works) Thanks pepole. I've tried but still does not work. when I put the varaibles name between ' ' I found this error: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING'. I typed in this way print INPUT TYPE='hidden' NAME='User_name' VALUE='$_POST[UserName]'; but nothing a new. I have checked register_globals is on. in my first page I used session_start(); and global $HTTP_SESSION_VARS; I dont know if this cause the problem that I had. Thanks again and more help please. Adam _ Use MSN Messenger to send music and pics to your friends http://www.msn.co.uk/messenger -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try using print INPUT TYPE='hidden' NAME='User_name' VALUE='.$_POST[UserName].'; Actually, if you're using 4.0.x, you can't use $_POST[UserName]. It was implemented in 4.1.0. http://ca.php.net/manual/en/reserved.variables.php#reserved.variables.post Read about it here. -- Marcjon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] another strange MYSQL problem
- Original message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] [EMAIL PROTECTED] Date: Sat, 8 May 2004 23:23:05 +0300 Subject: [PHP-DB] another strange MYSQL problem Hello, First, I use this, and all is ok: SELECT * FROM modele WHERE marca='Aprilia' ORDER BY tip ASC. Then, I use this: SELECT * FROM modele WHERE marca='Cagiva' ORDER BY tip ASC and the records are not ordered ascending by the field tip. In the first case, the records were ordered. Anyone knows what is wrong? Thank you! Best regards, Marius Panaitescu -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Well, this might not answer your question (or it might) but you should not use * in your queries. Specify each column you want to retrieve. This also might fix you problem, but I'm not sure. -- Marcjon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] From MySQL to PostgreSQL
Hi. I developed a forum using php5 and mysql. Right now I'm hosting it on my computer, for version for myself and another for a school I volunteer at. I would like to move the forums to the school's server. Apperently they don't have MySQL, they have PostgreSQL. I was just wondering, how much like MySQL is PostgreSQL? Would it be possible to create general functions (MySQL style) that could also work for PostgreSQL, based on what a config file set? Right now I have a file that's specific to each forum, so I could specify PostgreSQL or MySQL and based on that the function would do the appropriate action. So how much like MySQL is PostgreSQL? -- Marcjon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Session
Do you mean a new browser window or a new browser? Like using IE first and then netscape? If it's the latter, it wont be saved. It generates a new session ID and wont use the same session as the first browser. -- Marcjon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] login script
This is kind of a big thing. Email me and I'll give you instructions/tips on making it. - Original message - From: andy amol [EMAIL PROTECTED] To: php php [EMAIL PROTECTED] Date: Mon, 26 Apr 2004 17:15:27 -0700 (PDT) Subject: [PHP-DB] login script hi, does anyone have a login script which will take data from the table and decide whether the given user is a admin or a normal user. thanks in advance. Also if there is some help on session variable I would like to know. - Do you Yahoo!? Win a $20,000 Career Makeover at Yahoo! HotJobs -- Marcjon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How to display table columns
Well, you would create a table like this echo tabletrtdname/tdtdage/tdtdsex/td/tr; Then, you would do a query (assuming you've already made a connection to your database)... $result = mysql_query(SELECT name,age,sex FROM database.usertable); Then, run through the results... while ($row = mysql_fetch_assoc($result)) { echo trtd.$row[name]./tdtd.$row[age]./tdtd.$row[sex]./td/tr; } Then, end the table like this echo /table; There you have it. - Original message - From: andy amol [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Sun, 25 Apr 2004 19:47:37 -0700 (PDT) Subject: [PHP-DB] How to display table columns hi, I want to display the table coulumns along with those values below it. I am only able to display the table values, now I want to diplay the corresponding table attribut above the value. eg : name age sex abc1m xyz 2f I want to display name, age and sex. I am using mysql as database. thanks in advance. - Do you Yahoo!? Yahoo! Photos: High-quality 4x6 digital prints for 25ยข -- Marcjon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] move_uploaded_file
Windows works a bit different. You have to define which folders and files get access to the internet. After that you can specify the web permissions using the iis snap in. This is of course if you're using iis. I'm not sure for apache or other servers handle it. -- Marcjon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How to write file store file-name to DB...
http://ca2.php.net/manual/en/ref.filesystem.php Look here for write or fwrite. That should be what you want. -- Marcjon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Date SELECT with IF
try the WHERE clause. SELECT name, address, phone, date FROM usertable WHERE date = '-00-00' And please, look at the mysql documentation, or at least the tutorial. -- Marcjon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] include function
did you make sure the previous line had a ; at the end? Check that first. - Original message - From: Craig Hoffman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Tue, 6 Apr 2004 22:24:27 -0500 Subject: [PHP-DB] include function Someone tell me why this isn't working? I keep getting a parser error on line 36 (the last include). I'm running PHP 4.3.5 if that helps. include (include/dbadmin.php); include (jpgraph/src/jpgraph.php); include (jpgraph/src/jpgraph_bar.php); Parse error: parse error, unexpected T_INCLUDE in /Users/choffman/Sites/www/cyclistsedge/top_performace.php on line 36 __ Craig Hoffman - eClimb Media v: (847) 644 - 8914 f: (847) 866 - 1946 e: [EMAIL PROTECTED] w: www.eclimb.net _ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Marcjon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Impact of MySQL Queries
I'm working on a forum. When it displays a forum index, it gets all the topics and depending on the offset, displays only ten at a time. Now that's a single query. But problem comes when I display how many replies each post has. So far, when it does the while loop, it does a query for each item. Here's the code: $indexresult = mysql_query(SELECT uid,userpost,datetime,body,head,editdatetime,edituserpost, sticky,room,locked,lastpostdate,lastpostuser FROM orinsbox.forumposts WHERE ROOM = '.$_GET['room'].' AND .filter($filter). ORDER BY .sortby($sortby).) $while_offset = 0; // This is the counter used to check what post the while loop is on $while_count = 1; // This is how many posts have been displayed (once it has reached the offset) // Print out posts while ($row = mysql_fetch_assoc($indexresult)) // Run through all the posts { $while_offset++; if ($while_offset $offset AND $while_count = 10){ // if the post is in the range $while_count++; // Get num of replies $repliesresult = mysql_query(SELECT uid FROM orinsbox.forumposts WHERE common = '.$row[uid].') or die (Unable to run query, YOU SUCK: .mysql_error()); $replies = mysql_num_rows($repliesresult); // This is setting the image to be used for the post if($row[locked] != NULL AND $row[sticky] != NULL ){$icon = img src=\images/gold_lock.gif\ width=\18\ height=\24\ title=\Locked and Sticky\;} elseif($row[locked] != NULL AND $row[sticky] == NULL ){$icon = img src=\images/silver_lock.gif\ width=\18\ height=\24\ title=\Locked\;} elseif($row[locked] == NULL AND $row[sticky] != NULL ){$icon = img src=\images/gold_nugget.gif\ width=\18\ height=\24\ title=\Sticky\;} else {$icon = NULL;} // $row[descrip] if (!isset($bgcolour) OR $bgcolour == FF){$bgcolour = EE;}else{$bgcolour = FF;} // For alternating backround colours of the cells if (!isset($row[common]) OR $row[common] == NULL){ echo tr bgcolor=\#.$bgcolour.\ height=24; echo td width=\18\.$icon./td tda href=forums.php?room=.urlencode($_GET['room']).doForums=viewtopicobject=.$row[uid].offset=.$offset..$row[head]./a/td td.ucwords($row[userpost])./tdtd.$replies./td tdOn .$row[lastpostdate]; if ($row[lastpostuser] != NULL){ by .$row[lastpostuser];} echo /td; echo /tr;} } else {// Don't post it } } The 'uid' column is the unique number of the post. All posts have this. Now the column called 'common' is for replies. Posts that are to appear in the forum index don't have a 'common' set. If it is a reply, the column 'common' is set to the uid of the post it is a reply too. Example: Post 1: Subject: Hey all how do I do this UID: marforu200401F COMMON: NULL Post 2: Subject: Hey this is how you do it! UID: jayforu200404A COMMON: marforu200401F Is there an easier way to do this, maybe with a sub select statement maybe? I only know basic mysql. I hope this is understandable... Oh yeah, you might wonder why I use the custom offset instead of using the LIMIT and OFFSET clauses in the main MySQL query. The problem with this is that when I order the posts, it would only order them by the one gotten, not them all, which is what I wanted. -- Marcjon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Impact of MySQL Queries
I have IIS 4.x and MySQL running on the same machine. So do queries use up bandwidth? Does it matter if I have 20 queries per page? Will that slow it down if many people started using my site? Currently only I, and some friends for testing, use it. -- Marcjon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] win32 Timestamp problem
Not sure if this'll help you, but I like to store my dates/times using this format: date(Y-m-d H:i:s) It's always a 19 character string, so you could use the substr function to get different parts of the date. substr(date(Y-m-d H:i:s),0,4) would get the year, for example. Hope this helps. -- Marcjon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Forum Script
Hello friends. I am currently trying to develop a forum system. All is going well, but I was wondering if there woud be a way to do something that I'm already doing that might be more efficient. First I'll give you some background... I am using php 4 and mysql 4. I have a database setup, and I have a table set up for forum posts. I have fields for which board it was posted on and which (if any) post it was a reply to. If it wasn't a reply, that field will be left blank. For these fields, I use a unique ID system, which makes an ID based on the poster and when it was posted. Now when I display them, I make a table for the subject (head), author, last post, number of replies etc. I make it do a SELECT query and it gets the results and displays them. Now the problem I come into is with the number of replies. Currently while it's doing the WHILE loop, it performs another query for each post, checking how many posts have there reply field set to the post's current ID. That works fine, but it means I'm doing (up to) 21 queries per page, which I would guess is alot. I was wondering if there would be a way I could get the number of replies as a column in my first query (where I get the forum posts). Or maybe there's a more effective way by getting the number of replies first. I don't really want to store the number of replies in the database, if I can. If I'm not being clear or I'm not using proper netiquette, I appologize, I'm new to this (mailing lists). Any help would be appreciated! -- Marcjon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php