Re: [PHP-DB] Multiple paragraphs; The trick?
Assuming you're using text fields, just include paragraph breaks normally (\n\n) within the field entry. If you're outputting with HTML, you'll definitely need to replace those with p tags, but if you're simply e-mailing the contents plain text, or outputting in some other fashion, it should be straightforward to keep the the formatting intact. Adding a separate table just for the paragraphs seems like more work than necessary, but would certainly work as well. Jelle Ferwerda wrote: HI all, Just a week or so ago I started testing PHP and MySQL databases. Testing is over. I have figured out the basic controls etc. and it is time for the construction of the database and the PhP scripts to get the site up and running. The general layout of the database and its tables is more or less clear to me, except for one important point, for which I would like some advise.. How do you generate multiple paragraphs as output, if they do not have specific characteristics. Say: I am building a database about a sensor, and this page covers like 2 pages of A4 text. Obviously I'd like to make more then one paragraph and add some layoutimagery between paragraphs. How do you put it in a database? (Say: Like this message: The sender is me, the subject is multiple paragraphs, so you should be able to select the message. How do you get the formatting in different paragraphs, since it is not with a specific title, intro paragraph, main text and footer text). Any number of paragraphs and images is possible, so I cannot just create a field for each paragraph. Do you put all text as one entry in one field, with HTML to format the paragraphs? I think it would work, but it doens't seem like it is THE solution.. Or should I add a table in which you put the paragraphs, which you select through your main database, and then sort by paragraph number? Like: Table sensors [Sensor][compagny][country]..[sensor_ID] Table Contents [Sensor_No][Para_No][Content] The answer is probably obvious to you, but for a newbie like me... My database-design book is unfortunatey not made for building databases for the web, and do not explain this sort of structures. Unfortunately: SQL queries fail miserably in my brain.. Probably need a mental upgrade here.. Hope you can help! Thanks, Jelle. -- ___ ____ _ Chris Hobbs / \ \/ / | | |/ ___\| __ \ Head Geek| (___ \ \ / /| | | | (___ | | | | WebMaster \___ \ \ \/ / | | | |\___ \| | | | PostMaster) | \ / | |__| |) | |__| | \/\/\/ \/|_/ http://www.silvervalley.k12.ca.us [EMAIL PROTECTED] -- 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]
Re: [PHP-DB] Opt-In Request Re: Php-db@lists.php.net
Boy, as a list, I _sure_ think it'd be fun to subscribe to this Abundant Living Online, don't you? I mean, I only thought you lived in the biological world, and had to log in to get online - if we can live online, that would really save a lot of time! And cut down on travel expenses. Sorry, it's early, and I haven't had my caffeine yet... [EMAIL PROTECTED] wrote: By popular request, we have designed a FREE newsletter titled . . . Abundant Living Online 8 Spam snipped It is not in any way to be construed as a commercial message. Bollocks. Spammers are such a waste of skin... -- Chris Hobbs Silver Valley Unified School District Head geek: Technology Services Coordinator webmaster: http://www.silvervalley.k12.ca.us/~chobbs/ postmaster: [EMAIL PROTECTED] -- 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]
Re: [PHP-DB] Random
I was sure there was a syntax error in that SELECT statement, but according tho the description at http://www.mysql.com/doc/M/a/Mathematical_functions.html, that looks right on to me. I know this doesn't help a lot, but at least you've had a second set of eyes confirm that your code looks right. John Hurleston wrote: $result = mysql_db_query ($DBName,select * from Contacts order by rand() LIMIT 5 ); Doesn't work at all. :( -- Chris Hobbs Silver Valley Unified School District Head geek: Technology Services Coordinator webmaster: http://www.silvervalley.k12.ca.us/~chobbs/ postmaster: [EMAIL PROTECTED] -- 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]
Re: [PHP-DB] Weird Problem In mysql_connect();
JH has it right - your function has no idea what $host, $user, and $pass are, because they're out of scope. Add the global statements that Jonathan suggested inside your dbConnect function, and all will be well. Dave Watkinson wrote: function dbConnect (){ $link = mysql_connect($host,$user,$pass); } And Jonathan Hilgeman correctly recommended: function dbConnect () { global $host; global $user; global $pass; $link = mysql_connect($host,$user,$pass); } -- ___ ____ _ Chris Hobbs / \ \/ / | | |/ ___\| __ \ Head Geek| (___ \ \ / /| | | | (___ | | | | WebMaster \___ \ \ \/ / | | | |\___ \| | | | PostMaster) | \ / | |__| |) | |__| | \/\/\/ \/|_/ http://www.silvervalley.k12.ca.us [EMAIL PROTECTED] -- 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]
Re: [PHP-DB] CSV TO MYSQL
How about this: ?php $emailstring = [EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED]; @emails = explode(;, $emailstring); foreach($emails as $email) { echo INSERT INTO news VALUES('$email');\n; } ? Rupert wrote: Ok, this is my issue - hope someone can help. Suppose I also need to get this out of the way too - I am a Newbie (god..I hate that word...but it's true.grin!) Anyway, I have a list of email address that I want to dump into a database called (news) - eg. [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] etc.. I separated them with (;'s) like so - [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; etc.. (I suppose I could use commas instead - no prob there) This is what I want to accomplish: Each email address is a separate entry that needs to be downloaded into the database. Just like this: # # # Table structure for table 'news' # CREATE TABLE news ( email char(255) NOT NULL, PRIMARY KEY (email), UNIQUE email (email) ); # # Dumping data for table 'news' # INSERT INTO news VALUES ( '[EMAIL PROTECTED]'); INSERT INTO news VALUES ( '[EMAIL PROTECTED]'); INSERT INTO news VALUES ( '[EMAIL PROTECTED]'); INSERT INTO news VALUES ( '[EMAIL PROTECTED]'); INSERT INTO news VALUES ( 'etc..'); I have a script that gets me to this point: INSERT INTO news VALUES (,[EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED],[EMAIL PROTECTED],etc..); But that is not what I want. I can attach the script for analysis or if anyone has a better idea. I would appreciated it very much. Thanks.. Rupert -- Chris Hobbs Silver Valley Unified School District Head geek: Technology Services Coordinator webmaster: http://www.silvervalley.k12.ca.us/~chobbs/ postmaster: [EMAIL PROTECTED] -- 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]
Re: [PHP-DB] CSV TO MYSQL
= newfile; } } echo /PRE; /* output success information */ if ($save_status == append) { echo font color=greenBDONE:/B Data has been appended to existing file: B . $filename_output . /B; } if ($save_status == newfile) { echo font color=greenBDONE:/B Data has been written to new file: B . $filename_output . /B; } ? /body /html --snip!- Chris Hobbs [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... How about this: ?php $emailstring = [EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED]; @emails = explode(;, $emailstring); foreach($emails as $email) { echo INSERT INTO news VALUES('$email');\n; } ? Rupert wrote: Ok, this is my issue - hope someone can help. Suppose I also need to get this out of the way too - I am a Newbie (god..I hate that word...but it's true.grin!) Anyway, I have a list of email address that I want to dump into a database called (news) - eg. [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] etc.. I separated them with (;'s) like so - [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; etc.. (I suppose I could use commas instead - no prob there) This is what I want to accomplish: Each email address is a separate entry that needs to be downloaded into the database. Just like this: # # # Table structure for table 'news' # CREATE TABLE news ( email char(255) NOT NULL, PRIMARY KEY (email), UNIQUE email (email) ); # # Dumping data for table 'news' # INSERT INTO news VALUES ( '[EMAIL PROTECTED]'); INSERT INTO news VALUES ( '[EMAIL PROTECTED]'); INSERT INTO news VALUES ( '[EMAIL PROTECTED]'); INSERT INTO news VALUES ( '[EMAIL PROTECTED]'); INSERT INTO news VALUES ( 'etc..'); I have a script that gets me to this point: INSERT INTO news VALUES (,[EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED],[EMAIL PROTECTED],etc..); But that is not what I want. I can attach the script for analysis or if anyone has a better idea. I would appreciated it very much. Thanks.. Rupert -- Chris Hobbs Silver Valley Unified School District Head geek: Technology Services Coordinator webmaster: http://www.silvervalley.k12.ca.us/~chobbs/ postmaster: [EMAIL PROTECTED] -- Chris Hobbs Silver Valley Unified School District Head geek: Technology Services Coordinator webmaster: http://www.silvervalley.k12.ca.us/~chobbs/ postmaster: [EMAIL PROTECTED] -- 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]
Re: [PHP-DB] can you help to beginner?
I won't add to the code suggestions already given, but I will share one thought about your tables - you absolutely _should_ be using two. Any given company can have from one service to thousands (take GE, everything from light bulbs to cruise missiles :). The only way to capture that data effectively is in two tables. Andrius Jakutis wrote: Can you help me? I know that for this example its better to use one table, not two, but I am just learning.. -- Chris Hobbs Silver Valley Unified School District Head geek: Technology Services Coordinator webmaster: http://www.silvervalley.k12.ca.us/~chobbs/ postmaster: [EMAIL PROTECTED] -- 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]
Re: [PHP-DB] can you help to beginner?
I realized that as soon as I hit Send - doh! :) Jonathan Hilgeman wrote: Actually, He should be using three. While one company could use many services, you might also have other companies that offer the same service. So there should be 3 tables to allow a many-to-many relationship. See my e-mail response to him. - Jonathan Chris Hobbs [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I won't add to the code suggestions already given, but I will share one thought about your tables - you absolutely _should_ be using two. Any given company can have from one service to thousands (take GE, everything from light bulbs to cruise missiles :). The only way to capture that data effectively is in two tables. Andrius Jakutis wrote: Can you help me? I know that for this example its better to use one table, not two, but I am just learning.. -- Chris Hobbs Silver Valley Unified School District Head geek: Technology Services Coordinator webmaster: http://www.silvervalley.k12.ca.us/~chobbs/ postmaster: [EMAIL PROTECTED] -- Chris Hobbs Silver Valley Unified School District Head geek: Technology Services Coordinator webmaster: http://www.silvervalley.k12.ca.us/~chobbs/ postmaster: [EMAIL PROTECTED] -- 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]
Re: [PHP-DB] listing
Something like: ? for($i=1; $i25; $i++) { ? table tr td ? // php code to output your entry information ? /td /tr /table ? } ? Andrius Jakutis wrote: Hello again, Is there oportunity to write this: some php command to loop entries, the way is written bellow HTML php coding.+ MYSQL - 1 entries information end of loop Something like that: here loop begins table tr td first entry information from table companies (name, telephone...) /td /tr /table loop ends THanks. -- Su pagarba, Andrius Jakutis InternetMedia http://www.internetmedia.lt GSM: 370 82 31332 -- Chris Hobbs Silver Valley Unified School District Head geek: Technology Services Coordinator webmaster: http://www.silvervalley.k12.ca.us/~chobbs/ postmaster: [EMAIL PROTECTED] -- 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]
Re: [PHP-DB] Getting key of row just inserted into mySQL
mysql_insert_id() Grant Boggs wrote: What's the best way to get the primary key of a row just inserted into a mySQL database? -- Chris Hobbs Silver Valley Unified School District Head geek: Technology Services Coordinator webmaster: http://www.silvervalley.k12.ca.us/~chobbs/ postmaster: [EMAIL PROTECTED] -- 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]
Re: [PHP-DB] Querying active directory from PHP
[EMAIL PROTECTED] wrote: Has anyone done anything with Windows 2000 Active Directory from PHP? I'd quite like to try this out but I haven't been able to get anything to work! To begin with I'd like to query basic attributes like user name, phone number, email address Well, having never done this, and not being anything close to an expert in Active Directory (is your confidence soaring yet?), I'd suggest you'll probably be able to treat it like any other LDAP server, and query it through php's LDAP toools. Perhaps posting to the general php list would garner some further responses. IMPORTANT NOTICE The information in this e-mail is confidential rant mode=on Not to pick solely on you, but I find these types of notices very humorous when sent to public mailing lists - it seems like the very act of attaching them to what are essentially public notices would dilute their usefulness if you ever wanted to sue someone over reposting truly confidiential info (include 'IANAL.php';). I'm assuming your employer's mail server attaches these to every outbound message from your company, but perhaps there'd be a way for your postmaster to make it a little less brain-dead by not attaching it to mail sent to certain addresses, namely _any_ public mailing list. /rant I feel better Chris Hobbs Silver Valley Unified School District --- The views expressed herein do not necessarily reflect the views of my employer... but they should! -- 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]
Re: [PHP-DB] Transforming doc files into html
I use the tools from here: http://wvware.sourceforge.net/ I've got a wrapper php script that calls wvhtml like this: passthru(PATH=$PATH:/usr/local/bin /usr/local/bin/wvHtml /var/www/html/$file /var/www/html/$file.html); Where $file is the Word doc that has been previously uploaded. I then redirect to that file with: header (Location: http://www.silvervalley.k12.ca.us/$file.html;); Hope this helps! Cami wrote: Does anybody know if is any way in which when you upload a word document file you can parse it and transform it into an html file? -- Chris Hobbs Silver Valley Unified School District Head geek: Technology Services Coordinator webmaster: http://www.silvervalley.k12.ca.us/~chobbs/ postmaster: [EMAIL PROTECTED] -- 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]
Re: [PHP-DB] search form
You'll need to write two search engines - one for the db, one for the static pages. Then combine the results on your results page. I'm looking at having to do the same thing, and can't think of a different way of doing it offhand. J- E- N wrote: i have a search form and i want it to search the entire site. what will i do if not all the information in my site came from the database ... -- Chris Hobbs Silver Valley Unified School District Head geek: Technology Services Coordinator webmaster: http://www.silvervalley.k12.ca.us/~chobbs/ postmaster: [EMAIL PROTECTED] -- 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]