[PHP-DB] Re: [PHP] reading a URL...
Here's the mail I sent yesterday right after your question. I sent it to the general PHP list (you posted it there). But obviously your never read that list. Don't post any questions there then. There are people putting time in answering your questions, so you have to make sure they don't do this for nothing. Post your questions only to lists you actualy read!!! Anyway, I had already answered your question, so here's that answer. This is the quickest, easiest and most common way of using the variables you get by GET or POST: Just use $id in your code. That should do the job. Variables that are passed using GET or POST you can just use in your code. Ofcourse you have to add the $-sign. So if you use the URI: http://www.arandomsite.com/news_story.php?id=123 You can just use: "SELECT xxx FROM yyy WHERE id=$id" RenzE. On Mon, Mar 26, 2001 at 02:26:27PM +, [EMAIL PROTECTED] wrote: 'ello, Is it Possible, in PHP to read a URL? What I am trying to do is this... I have many news stories in a database, and a single static news page, that calls the story, and the corresponding headline. I have looked about on-line, and seen a common URL,... http://www.arandomsite.com/news_story.php?id=123 I have adopted this method, and it only displays the top most story in my database, no matter what news ID I use. Can I get the ID number from the URL?, and then pass that to the SQL statement? I cannot find a tutorial or similar on-line anywhere. Hope you can help, Tris... P.S, after getting this all set up, my boss asked me to turn everything into .jsp pages. SO, I am off to buy a "JSP in 20 seconds" Type books, any ideas? ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. ** -- 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 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] Indexing help
replies below: ""M. Verheijen"" [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Dear reader, A newbie mysql/php-question here! I've filled a mysql-database with about 1600 records. All these records contain items which are on sale on a website. Every row contains an integer defining the category to which a item belongs. At the left of the website there are buttons linked to a php-page which does a selection like this: select * from PRODUCTS where SUBCODE = \"$SUBCODE\" As you might have guessed, every button is a link in the form of: a href="products.php?SUBCODE=8"img src="../button2.gif" border="0"/a This all works well, but now my questions! Is it wise to make an index for the integer column? I assume it is because it's the row almost all queries are using in there where-statements. What kind of speed increase can I expect, will it increase the speed of query's if the workload goes to 2000 queries a hour? What's the best way to make this index, how does it works. i always work on the theory that i index columns that i use in the select section of a query, or a where. keys will be indexed automatically (AFAIU). the speed increase will be dramatic. i used postgres and didn't index a field (accidently) and then ran queries.then indexed it and the speed increase is huge. as for making indexes it depends what tools you use. most tools such as mysql-admin etcc will let you create indexes by a pointy clicky interface. true purists might insist on: CREATE [UNIQUE] INDEX index_name ON table [USING acc_name] from the sql command line. I've read about the use of indexes in the mysql-manual and phpbuilder.net, but both are kind of short and don't tell what you're doing exactly. Anybody of you have some pointers to good webresources about indexing. i don't think you need to get into what particular type of index it is (hash, etc) but they are generally a good thing. Yes, I know a long list of questions ;) I hope that some of you can give me a clue or two. log lists of questions are a good thing and should be warmly welcomed by everyone. With best regards, Maarten Verheijen -- 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 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-DB] get_browser()
hi all how does everyone feel about the get_browser function?? Is the general impression it's overkill, and also flawed since it depends on the browser.ini file being up to date, or it is widely used? I'm about to need to use browser detection I'm wondering if a simple get_env("HTTP_USER_AGENT") will be far simpler thanx in advance.. si --- Studio 24 Ltd | tel. 01223 501 892 PO Box 88 | fax. 0870 063 1216 Cambridge | mob. 07974 074 547 CB4 1XH | www.studio24.net -- 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] get_browser()
i use get_env("HTTP_USER_AGENT") to log browser types and it works fine. to be hones i didn't know about the get_browser function ... user agent suplies loads of info though about browser, platform etc. Steve Brett Internal Development EMIS Ltd. "Privileged and /or Confidential information may be contained in this message. If you are not the original addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, please delete this message, and notify us immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by my firm or employer unless otherwise indicated by an authorised representative independently of this message." Egton Medical Information Systems Limited. Registered in England. No 2117205. Registered Office: Park House Mews, 77 Back Lane, Off Broadway, Horsforth, Leeds, LS18 4RF -Original Message- From: Simon R Jones [mailto:[EMAIL PROTECTED]] Sent: 27 March 2001 09:55 To: [EMAIL PROTECTED] Subject: [PHP-DB] get_browser() hi all how does everyone feel about the get_browser function?? Is the general impression it's overkill, and also flawed since it depends on the browser.ini file being up to date, or it is widely used? I'm about to need to use browser detection I'm wondering if a simple get_env("HTTP_USER_AGENT") will be far simpler thanx in advance.. si --- Studio 24 Ltd | tel. 01223 501 892 PO Box 88 | fax. 0870 063 1216 Cambridge | mob. 07974 074 547 CB4 1XH | www.studio24.net -- 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 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] table 1 to table 2
I was thinking that MySQL doesn't support subselects ?! Or is there a new MySQL-Version which does support them ? Greetinx, Mike Michael Rudel - Web-Development, Systemadministration - ___ Suchtreffer AG Bleicherstrae 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: Cal Evans [mailto:[EMAIL PROTECTED]] Sent: Monday, March 26, 2001 9:53 PM To: [EMAIL PROTECTED]; PHP-DB Subject: RE: [PHP-DB] table 1 to table 2 insert into table2 Select * from table1 where myConditionIsMet; Cal http://www.calevans.com -Original Message- From: Tobe Johnson [mailto:[EMAIL PROTECTED]] Sent: Monday, March 26, 2001 1:41 PM To: PHP-DB Subject: [PHP-DB] table 1 to table 2 Using PHP, I need to run a query against one MySQL database table (table1) and transfer the results into another identical MySQL database table (table2). Am I simply overlooking something simple on how to do this? Can someone give me input or direction on the best way to do this? Thanks in advance Tobe -- 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 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 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-DB] Re: How to print last row in an array using WHILE?
What you are missing is the first row, not the last row. To explain: mysql_fetch_row() operates with an internal pointer which moves one step down the result set with each call to the function. The first time it is called, it returns the first row, and moves its pointer to the second row. The second time it is called, it returns the second row, and moves its pointer to the third row. And so on. When it gets to the end, it returns false. Your while() structure is exactly what's needed to iterate through the result set. But because you call mysql_fetch_row() once before starting the while loop, the first row disappears. When the while loop starts, the internal pointer points to the second row. So just remove the first mysql_fetch_row() call, and it should work fine. Jon Valvatne On Mon, 26 Mar 2001, Bob Stone wrote: Dear PHP Helpers, I have an array created by an mysql select statement. I have the code to display the "rows" from the select statement. Everything works fine except that only n-1 rows from the array will display. For example if the array contains four rows only three will display. If the array contains one row, nothing displays on the screen. I understand that a WHILE loop will count down to zero and then since it becomes false will quit, but how do I get the last (or first) row to print? Here is the code: HTML HEAD TITLE/TITLE /HEAD BODY BGCOLOR="#FF" TEXT="#00" LINK="#FF" VLINK="#800080" ?php $db = mysql_connect("localhost" , "phpuser" , "phpuser"); mysql_select_db("SVT",$db); // display individual record if ($user_name) { $result = mysql_query("SELECT * FROM svt_members WHERE user_name='$user_name'",$db); $myrow = mysql_fetch_array($result); while ($myrow = mysql_fetch_array($result)) { printf("Full Name: bfont color=\"green\" size=\"5\"%s %s %s %s\nbr/b/font", $myrow["salutation"], $myrow["first_name"], $myrow["mid_name"], $myrow["user_name"]); printf("Credentials and Degrees: bfont color=\"blue\" size=\3\"%s/font/b Job Title: bfont color=\"blue\" size=\3\"%s/font/bbrCompany/Institution: bfont color=\"blue\" size=\3\"%sbr/font/bAddress: bfont color=\"blue\" size=\3\"%s %sbr/font/bCity: bfont color=\"blue\" size=\3\"%s/font/b State/Provence: bfont color=\"blue\" size=\3\"%sbr/font/bCountry: bfont color=\"blue\" size=\3\"%s/font/b Postal Code: bfont color=\"blue\" size=\3\"%sbr/font/bVoice: bfont color=\"blue\" size=\3\"%s/font/b Fax: bfont color=\"blue\" size=\3\"%sbr/font/bE-mail: bfont color=\"blue\" size=\3\"%s\nP/b/font", $myrow["cert_deg"], $myrow["job_title"], $myrow["institution"], $myrow["address_1"], $myrow["address_2"], $myrow["geo_loc"], $myrow["state"], $myrow["country"], $myrow["zip"], $myrow["phone"], $myrow["fax"], $myrow["e_mail"]); } } ? form method="post" action="?php echo $PHP_SELF ?" Enter Last Name To Search: input type="Text" name="user_name"p input type="Submit" name="submit" value="Click To Search" /form /BODY /HTML Thank you very much for your help. Best regards, Bob Stone __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/?.refer=text -- 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-DB] Re: Betr.: [PHP-DB] Structure Question
I thought that it was good db design to have no repeating data in your db but to use a relationship instead? Jord On Tuesday 27 March 2001 14:42, you wrote: Jord, I don't see quite why you should want to use two tables, you can easily put all the information in one table and have one column which holds the filetype. There's (almost) no speed profit to put the information in several tables. Have fun, Maarten Verheijen Jordan Elver [EMAIL PROTECTED] 27-03-01 13:37 Hi, I want to keep filenames of different kinds of media(real sudio, qt, mp3) for articles in a db table. Would it be best to store each kind of media in a different table like one table for real audio, one for quicktime, one for mp3. Or, would it better to store them all in the same table but with another table telling me what kind of file it is? Like: media table id | name | filename | type_id media types type_id | name Any ideas folks? 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]
Re: [PHP-DB] Structure Question
Why don't you just store the file names in a db? iets much easyer Hi, I want to keep filenames of different kinds of media(real sudio, qt, mp3) for articles in a db table. Would it be best to store each kind of media in a different table like one table for real audio, one for quicktime, one for mp3. Or, would it better to store them all in the same table but with another table telling me what kind of file it is? Like: media table id | name | filename | type_id media types type_id | name Any ideas folks? 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 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] Structure Question
I am. Jord On Tuesday 27 March 2001 14:06, you wrote: Why don't you just store the file names in a db? iets much easyer Hi, I want to keep filenames of different kinds of media(real sudio, qt, mp3) for articles in a db table. Would it be best to store each kind of media in a different table like one table for real audio, one for quicktime, one for mp3. Or, would it better to store them all in the same table but with another table telling me what kind of file it is? Like: media table id | name | filename | type_id media types type_id | name Any ideas folks? 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 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] SQL Select?
On Sat, Mar 24, 2001 at 08:55:13PM -, Grant wrote: Is there any way of using a string in an SQL query instead of using the table name. Something along the lines of $result=mysql_query("SELECT * FROM $tablename",$db); this doesnt work it come up with a parse error Your problem is probably on a line above this one. Because this line should be valid. I do stuff like this all the time and it works without any problems so far. ?php // First of all, I use a variable to hold my sql statement: $sql = "select * from $tablename"; // Then perform the query: $result = mysql_query($sql, $db) or die("$sqlbr".mysql_error($db)); ? This allows you to see the sql that is actually being executed, and you also get to see the actual mysql error. -- Jason Stechschulte [EMAIL PROTECTED] -- It is, of course, written in Perl. Translation to C is left as an exercise for the reader. :-) -- Larry Wall in [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]
[PHP-DB] MySQL manager
Hi, can anybody tell me for some cool MySQL database manager ? Thanks, Rosen Marinov -- 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] MySQL manager
www.mysqlfront.de I have used it and found it to be great. However I am a beginner and if there is a better product please let me know. All the best Lisa -Original Message- From: Rosen [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 27, 2001 3:26 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL manager Hi, can anybody tell me for some cool MySQL database manager ? Thanks, Rosen Marinov -- 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]
AW: [PHP-DB] Structure Question
I think you should store all files in a table with an extra table with the filetypes (like you suggest in the end of your mail)!! In my opinion this is a well designed database modell, 'cause you have only one table (instead of 10 or twelve depending on the count of your datatypes), but you are able to select over the filetyp criteria!! Stefan Siefert -Ursprngliche Nachricht- Von: Jordan Elver [mailto:[EMAIL PROTECTED]] Gesendet: Dienstag, 27. Mrz 2001 14:38 An: PHP Database Mailing List Betreff: [PHP-DB] Structure Question Hi, I want to keep filenames of different kinds of media(real sudio, qt, mp3) for articles in a db table. Would it be best to store each kind of media in a different table like one table for real audio, one for quicktime, one for mp3. Or, would it better to store them all in the same table but with another table telling me what kind of file it is? Like: media table id | name | filename | type_id media types type_id | name Any ideas folks? 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 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-DB] Why mysql function in php don't support prepare statement?
As title, I can't have some query like "insert into table (a, b, c) where (?, ?, ?) and then fill the value in the loop. This kind of statement often have better performance, why php don't support this? -- 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] Editing DB entries via form
use isset($checkbox) where $checkbox is the name of the check box on the page that processes the form. Steve Brett Internal Development EMIS Ltd. "Privileged and /or Confidential information may be contained in this message. If you are not the original addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, please delete this message, and notify us immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by my firm or employer unless otherwise indicated by an authorised representative independently of this message." Egton Medical Information Systems Limited. Registered in England. No 2117205. Registered Office: Park House Mews, 77 Back Lane, Off Broadway, Horsforth, Leeds, LS18 4RF -Original Message- From: Randall Barber [mailto:[EMAIL PROTECTED]] Sent: 27 March 2001 16:14 To: [EMAIL PROTECTED] Subject: [PHP-DB] Editing DB entries via form What I have is an extremely scaled down version of a news DB. What I am not experienced in doing is the following: I want to have a page, say 'myEditNews.php'--and it will list the news items in the database with a checkbox and an edit button. The check box will be used for marking news items to delete. The edit button is obvious :). HOW: Say a person checks the 1, 5, and 9 check boxes and hits delete. How do I know in the myEditNews.php file that those particular boxes were checked?? When I figure this out, I will use a loop to delete the news items one at a time from the database (unless there is a better way). My understanding of check boxes is that they are not sent from the form unless they are checked. Here's what I have so far: 1) Use hidden fields as flags. All hidden fields have same name so that when they are submitted to PHP they go into an ordered array. 2) The corresponding checkbox fields will be checked. The value of the checkbox will have the news item DB primary key ID to delete on. for(i=0; odbc_fetch_row(...) != false; i++) { echo "input type='hidden' name='newsItem' value='0'input type=checkbox name='newsItem".i."' onClick='javascript:if(document.myForm.newsItem[".i."].value == 0) { document.myForm.newsItem[".i."].value = 1 } else { document.myForm.newsItem[".i."].value = 1; }'"; } Am I making this hard on myself? I have seen it done, but now that I want to find an example these sites escape my notice. Any help is appreciated, RDB -- 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-DB] Connecting and Viewing a Database
Does anyone know how to connect and display table rows from an ODBC source MS Access MySQL databases? -- 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]
AW: [PHP-DB] Connecting and Viewing a Database
Maybe you tell us, which system you are running, like linux, or windows. If you use linux you should try to use unixODBC (Tutorial for uinxODBC and PHP: www.unixODBC.org).. If you use windows, it should be done by uncommenting the odbc-library in php.ini like: extension=php_odbc.dll Greetings, Stefan Siefert -Ursprngliche Nachricht- Von: Anyangwe, Tanwani [mailto:[EMAIL PROTECTED]] Gesendet: Dienstag, 27. Mrz 2001 17:49 An: '[EMAIL PROTECTED]' Betreff: [PHP-DB] Connecting and Viewing a Database Does anyone know how to connect and display table rows from an ODBC source MS Access MySQL databases? -- 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 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-DB] How do you define table row indexes?
The following code: $result = mysql_query("SELECT * FROM motor_vehicle",$db); $strSep = 'nbsp;|nbsp;'; while ($myrow = mysql_fetch_array($result)) { echo $myrow['id'].$strSep; } Gives me the following error: Warning: Undefined index: id in C:\PHP\Test_Scripts\testdb2.php on line 16 -- 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] Hold that insert!
I have the insertRecord function which is supposed to be called only when you hit submit. For some reason I'm blanking out on how to do this. The function and function call ARE on the same page. I think I just need some logic to indicate "stop" and "go". Every form has a submit button right? Submit buttons are form elements (whose value is submitted when the button is clicked), just like any other form field. So I have something like this: INPUT NAME="submit" TYPE="submit" Value=" Click Here! " In my PHP code, I check the value of $submit; if it's empty, I know the form data hasn't been submitted yet (if it had, $submit would have the value " Click Here! "), so in that case I display the form. If it does not have an empty value, the user has clicked the submit button, so I can go ahead processing the form data. Like this: if ( empty($submit) ) { ### Display the form } else { ### Do some checks to make the the data is OK ### Do the Insert, or whatever else is to be done } - Darryl -- Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED] Education Research Technology Services, http://gollum.usask.ca/ Department of Computing Services, University of Saskatchewan -- "Go not to the Elves for counsel, for they will say both no and yes" -- 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] Indexing help
Columns used in the WHERE clause is the good identifier for which columns to index. You don't want to index every column you select. Typically adding indexes decreases insert performance. The more indexes the slower inserts operate, because the indexes also must be updated. Adding an index to a column which is used in a where clause can dramatically increase table row selection. The database server does not have to scan the full table, instead it can use the index to lookup which rows to return. On small static tables the performance gain can be nominal. Larger tables where there are a lot of rows to check for a match, will see the largest performance gain. Think of a dictionary. You already know the index: words are alphabetically sorted. Just think if it wasn't, you'd have to look at every word to see if you've got a match. Without indexes, that's what the computer has to do. The computer (dbms) picks which index to use based on whats column in the where clause. Order By clauses can also benifit from an index. -Joe ""Steve Brett"" [EMAIL PROTECTED] wrote in message 99pjr2$20s$[EMAIL PROTECTED]">news:99pjr2$20s$[EMAIL PROTECTED]... replies below: ""M. Verheijen"" [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Dear reader, A newbie mysql/php-question here! I've filled a mysql-database with about 1600 records. All these records contain items which are on sale on a website. Every row contains an integer defining the category to which a item belongs. At the left of the website there are buttons linked to a php-page which does a selection like this: select * from PRODUCTS where SUBCODE = \"$SUBCODE\" As you might have guessed, every button is a link in the form of: a href="products.php?SUBCODE=8"img src="../button2.gif" border="0"/a This all works well, but now my questions! Is it wise to make an index for the integer column? I assume it is because it's the row almost all queries are using in there where-statements. What kind of speed increase can I expect, will it increase the speed of query's if the workload goes to 2000 queries a hour? What's the best way to make this index, how does it works. i always work on the theory that i index columns that i use in the select section of a query, or a where. keys will be indexed automatically (AFAIU). the speed increase will be dramatic. i used postgres and didn't index a field (accidently) and then ran queries.then indexed it and the speed increase is huge. as for making indexes it depends what tools you use. most tools such as mysql-admin etcc will let you create indexes by a pointy clicky interface. true purists might insist on: CREATE [UNIQUE] INDEX index_name ON table [USING acc_name] from the sql command line. I've read about the use of indexes in the mysql-manual and phpbuilder.net, but both are kind of short and don't tell what you're doing exactly. Anybody of you have some pointers to good webresources about indexing. i don't think you need to get into what particular type of index it is (hash, etc) but they are generally a good thing. Yes, I know a long list of questions ;) I hope that some of you can give me a clue or two. log lists of questions are a good thing and should be warmly welcomed by everyone. With best regards, Maarten Verheijen -- 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 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 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] Hold that insert!
Click Here! "), so in that case I display the form. If it does not have an empty value, the user has clicked the submit button, so I can go ahead processing the form data. Like this: if ( empty($submit) ) { ### Display the form } else { ### Do some checks to make the the data is OK ### Do the Insert, or whatever else is to be done } I do something similar. However, my layout is like this: -- if( isset( $submit )) { errorChecking(); if( $noErrors ) { doDBInsert(); header( "location: blah" ); exit(); } // end if( $noErrors ) showErrors(); } // end if( isset( $submit )) displayForm(); -- This accomplishes a few things: * The code is easier to follow * If there is an error in the form, the errors display and the form re-displays. There is only one section of code that deals with the form, not two as there would be in an IF/ELSE situation. But then, this is just me. :) Chris
Re: [PHP-DB] get_browser()
Is it easier to update every web page you code with get_env("HTTP_USER_AGENT") ; or easier to grab a new browser.ini file? ""Simon R Jones"" [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... hi all how does everyone feel about the get_browser function?? Is the general impression it's overkill, and also flawed since it depends on the browser.ini file being up to date, or it is widely used? I'm about to need to use browser detection I'm wondering if a simple get_env("HTTP_USER_AGENT") will be far simpler thanx in advance.. si --- Studio 24 Ltd | tel. 01223 501 892 PO Box 88 | fax. 0870 063 1216 Cambridge | mob. 07974 074 547 CB4 1XH | www.studio24.net -- 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 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-DB] Multiple rows for one column in a MySQL table?
Hi, Is it possible to have multiple rows for one column of a MySQL databes? and if so how would I insert another row into the column in question? eg: idNamePhone Number 1Kev 123123 2John 234234 345345 3 Paul 789789 Thanks, Kev.
Re: [PHP-DB] Hold that insert!
I like your simplicity and straightforwardness. My code tends toward: switch($submit) { case: "Accept": .. insert record break; case: "Delete": .. delete record break; case "Cancel": .. cancel record changes and return to previous condition break; } if($submit) { show form } else { show list } where list is a display of the records in the database (browse) and the form is a one record dataentry/modification/delete form. On Tuesday, March 27, 2001, at 10:46 AM, Boget, Chris wrote: I do something similar. However, my layout is like this: -- if( isset( $submit )) { errorChecking(); if( $noErrors ) { doDBInsert(); header( "location: blah" ); exit(); } // end if( $noErrors ) showErrors(); } // end if( isset( $submit )) displayForm(); In Light and Love EaTrom Order of Melchizedek Michael's Legions - EaTrom's Site: http://www.blazing-trails.com Spirituality Conspiracy - -- 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] How do you define table row indexes?
In article [EMAIL PROTECTED], [EMAIL PROTECTED] ("Anyangwe, Tanwani") wrote: $result = mysql_query("SELECT * FROM motor_vehicle",$db); $strSep = 'nbsp;|nbsp;'; while ($myrow = mysql_fetch_array($result)) { echo $myrow['id'].$strSep; } Gives me the following error: Warning: Undefined index: id in C:\PHP\Test_Scripts\testdb2.php on line 16 1) It's not considered a good habit to use "select *" in scripts. When you later modify the table defs, your scripts will be blown. Even if you never add/drop/change a column, it's still messy since whenever you're working on the code you have to remember--accurately--all of the columns and exactly (case_sensitive_ what they are named. Yuck. Much cleaner to include the column names in your query now. "Select id from motor_vehicle"--then you know for sure you're working with a column of that name. 2) mysql_fetch_array doesn't fetch NULLs. If the value of column 'id' in a given row is NULL, then $myrow['id'] will be undefined for that row. See http://php.net/manual/en/function.mysql-fetch-array.php. -- CC -- 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] MySQL manager
what about kmysql and kmysqladmin ?? Greetinx, Mike -Original Message- From: Rubanowicz, Lisa [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 27, 2001 4:34 PM To: 'Rosen'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] MySQL manager www.mysqlfront.de I have used it and found it to be great. However I am a beginner and if there is a better product please let me know. All the best Lisa -Original Message- From: Rosen [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 27, 2001 3:26 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL manager Hi, can anybody tell me for some cool MySQL database manager ? Thanks, Rosen Marinov -- 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 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] Hold that insert!
I like your simplicity and straightforwardness. Thanks. ;p My code tends toward: switch($submit) { case: "Accept": .. insert record break; case: "Delete": .. delete record break; case "Cancel": .. cancel record changes and return to previous condition break; } If there is the possiblity of processing different functions, I do this: -- if( isset( $submit )) { errorChecking(); if( $noErrors ) { switch( $function ) { case "insert": doDBInsert(); $resultPage = "here"; break; case "modify": doDBModify(); $resultPage = "there"; break; case "delete": doDBDelete(); $resultPage = "over"; break; } header( "location: $resultPage" ); exit(); } // end if( $noErrors ) showErrors(); } // end if( isset( $submit )) displayForm(); -- Just as before, but doing different things depending on function. That way, the code is still only run when the form submits. And still, if there are any errors, the same code is run to (re)display the form. And since all the POST vars are passed through, the form elements poplulate them selves with the data that the user previously entered so the user loses nothing. I rarely display results on the same page. This allows me to keep it a little more modular and if I ever need to modify one, I don't have to worry about touching the other. Just out of principle, I like to keep as few ELSEs on a page as possible. Generally, if you look at the code, you can streamline things alot just by getting rid of some of the ELSE statements.
[PHP-DB] Reading OLE objects form MSAcces97
Hello, I would like to know if it's possible to read a videoclip from Access97 with PHP? I have inserted the clip as an OLE object but i don't know exactly how to retrieve the format to visualize, i've also check the type of the column an PHP says it's LONGBINARY. Does anyone knows how to handle this? Thanks in advance -- 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] error code = -504 Cursor unknow
Mauricio Junqueira wrote: Hello, this is my first attempt to query and print a result coming from a database, in this case interbase6. I got the following error: InterBase: Dynamic SQL Error SQL error code = -504 Cursor unknown in maingeral.htm on line 8 Here's the code: ? include("php/header.php"); ibase_pconnect(BANCO,DBUSER,DBPASSWD) or die ("script language='javaScript' alert('" . ibase_errmsg() . "'); /script"); $stmt = "select count(*) from soldcars"; $query= ibase_query($stmt) or die ("script language='javaScript'alert('" . ibase_errmsg() . "'); /script"); $result = ibase_fetch_row($query);// THIS IS LINE 8 $TOTSOLD = $result; ibase_free_result($query); $stmt="select Total from monthsold"; $query = ibase_query($stmt) or die ("script language='javaScript'alert('" . ibase_errmsg() . "'); /script"); $result = ibase_fetch_row($query); $TOTMONTH = $result[0]; ibase_free_result($query); $stmt= "select count(*) from deal where available = 1"; $query = ibase_query($stmt) or die ("script language='javaScript'alert('" . ibase_errmsg() . "'); /script"); $result = ibase_fetch_row($query); $TOTAVAIL= $result[0]; ibase_free_result($query); ibase_commit(); ibase_close(); ? I have 3 query blocks. the result shows the contents of 2nd and 3rd block variable:TOTMONH and TOTAVAIL but nothing from the first block, TOTSOLD. If I comment the first block entirely, I got the same error (ibase_fetch_row line) on the 2nd block and the only result that appear is from the 3rd block. What I am doing wrong? I've put this statement before the first block to see if $query was empty but the statement return true and the same error occured in the ibase_fetch_row line if (isset($query)) { $result = ibase_fetch_row($query); $TOTSOLD = $result; ibase_free_result($query); } else echo "query not set"; -- 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] error code = -504 Cursor unknow
If just comment the following lines, everything works Please help... I'm getting nut !! ? include("php/header.php"); ibase_pconnect(BANCO,DBUSER,DBPASSWD) or die ("script language='javaScript' alert('" . ibase_errmsg() . "'); /script"); $stmt = "select count(*) from soldcars"; $query= ibase_query($stmt) or die ("script language='javaScript'alert('" . ibase_errmsg() . "'); /script"); // $result = ibase_fetch_row($query); // $TOTSOLD = $result[0]; // ibase_free_result($query); $TOTSOLD ="COMMENTED"; $stmt="select Total from monthsold"; $query = ibase_query($stmt) or die ("script language='javaScript'alert('" . ibase_errmsg() . "'); /script"); $TOTMONTH = $result[0]; ibase_free_result($query); $stmt= "select count(*) from deal where available = 1"; $query = ibase_query($stmt) or die ("script language='javaScript'alert('" . ibase_errmsg() . "'); /script"); $result = ibase_fetch_row($query); $TOTAVAIL= $result[0]; ibase_free_result($query); ibase_close(); ? -- 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-DB] A question - ($file_exists)
I am setting up an episode guide for one of my favourite shows and with this I need to include three screenshots: episodeID_a.jpg episodeID_b.jpg episodeID_c.jpg In some cases though the files will not exist and therefore I need too check if they exist and if they don't then it will display a blank image... Whats wrong with this code? - ?php $img1 = "episodeID_a.jpg"; $img2 = "episodeID_b.jpg"; $img3 = "episodeID_c.jpg"; for ($x=1; $x = 3; $x++) { if (!$file_exists(.//$img$x)) { //Change the variable $img? and give it the value of a temporary, blank image $img$x="blank.jpg"; } print("$img$xbr"); } ? I would be grateful for any help with this, thanks in advance, Matt _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. -- 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] A question - ($file_exists)
Whats wrong with this code? $img1 = "episodeID_a.jpg"; $img2 = "episodeID_b.jpg"; $img3 = "episodeID_c.jpg"; $img$x="blank.jpg"; That doesn't what you expect. I think the syntax is the same as Perl: $var = "$img$x"; # $var hold the _name_ of the variable # you want to change $$var = "blank.jpg"; # The $$ syntax is used to references the # actual variable See the section of the manual dealing with variables (http://www.php.net/manual/en/language.variables.php) - Darryl -- Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED] Education Research Technology Services, http://gollum.usask.ca/ Department of Computing Services, University of Saskatchewan -- "Go not to the Elves for counsel, for they will say both no and yes" -- 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-DB] Interbase 6.01 (dialect 3), PHP4 and DATE
How can I manage DATE fieldtype in PHP4 with Interbase? The problem is that i manage DATEs in format DDMM (spain) but Interbase manage it in MMDD format; so queries expected data in that format while i need it in other format. % if(isset($action)) { ibase_timefmt("%d/%m/%Y",IBASE_DATE); $ibh=ibase_pconnect("localhost:/usr/interbase/databases/dbsite.gdb","SYSDBA" ,"masterkey"); if($action=="edit" isset($CONTEXT) isset($DATE)) { $sth=ibase_query($ibh,"SELECT newstext FROM news WHERE context='$CONTEXT' AND newsdate='$DATE';"); if(($row=ibase_fetch_row($sth))) { } } } % Would you send me examples (small smart) of that? -- 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] A question - ($file_exists)
Why isn't this working? ?php $img[] = "$episodeID_a.jpg"; $img[] = "$episodeID_b.jpg"; $img[] = "$episodeID_c.jpg"; for ($x=0; $xcount($img); $x++) { if(!file_exists($img[$x])) { print("td align=centerimg src=\"blank.gif\" width=160 height=120 border=\"1\"/td"); } else { print("td align=centerimg src=\"$img[$x]\" width=160 height=120 border=\"1\"/td"); }//end if }//end for loop ? _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. -- 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] Checking for empty string - long
In article 99qq47$jvn$[EMAIL PROTECTED], [EMAIL PROTECTED] (Martin Skjoldebrand) wrote: How do I check for an empty string in PHP/MySQL. http://www.php.net/empty/ http://www.php.net/is_null/ -- CC -- 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-DB] PrintF
Hello, I'm new to PHP and mySQL. I'm trying to find more info on printf. Specifically setting table properties, like height,width,background. Hoping someone can point me in the right direction. Thanks for the Help, Mike
Re: [PHP-DB] Refresh
I don't know Postgresql, but all databases I've dealt with increments auto-increment fields only on committing insert commands. I think you can catch the last id number (MySQL do it) and show the number + 1 on the user screen. HTH Jayme. -Mensagem Original- De: Julio Cuz, Jr. [EMAIL PROTECTED] Para: [EMAIL PROTECTED] Enviada em: tera-feira, 27 de maro de 2001 16:51 Assunto: [PHP-DB] Refresh Hi-- I don't know if this is something PHP can solve, or if my database engine (Postgresql 7.03) needs to do something. Every time a user adds a new request, a new ID is generated, but SOMETIMES, when the same user adds several requests, one after another, the browser does NOT refresh and it displays the previous ID. For example: User A submits a new request (#1001), then adds another one (#1002), it should display #1002, but instead it displays #1001. Any ideas? -- 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 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-DB] Help Export Excel to MySQL database
how to export the text files to Msql database ? My database now in Excel format. what type of file should I saved I will insert the file in MySQL -- 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-DB] simple sql question
Hello- I'm running MySQL and php and when I run the query below I don't get any return rows. As you can see I search for events that are happening between a certain date. The "startDate" field is type DATE in MySQL and the date in the database that should be returned in "2001-03-27" but I'm not getting any results. select * from events where startDate='2001-03-01' and startDate'2001-01-04' Any help on what I could be doing wrong would be great! Thanks, Jay Paulson Developer, Web Technologies Viatel, Inc. http://www.viatel.com -- 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] simple sql question
There is no date that was before Jan 4th and on or after March 1st simultaneously--not even March 27th. Today might be a special day to individuals for varying reasons (birthdays, anniversaries, new jobs, promotions, whatever) but it's not THAT special that it simultaneously exists in two mutually exclusive sets of dates. http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#DAT ETIME How about "...WHERE startDate = '2001-03-01' AND startDate '2001-04-01'" to pull out all of the March events? Doug At 06:49 PM 3/27/01 -0600, Paulson, Joseph V. \"Jay\" wrote: Hello- I'm running MySQL and php and when I run the query below I don't get any return rows. As you can see I search for events that are happening between a certain date. The "startDate" field is type DATE in MySQL and the date in the database that should be returned in "2001-03-27" but I'm not getting any results. select * from events where startDate='2001-03-01' and startDate'2001-01-04' Any help on what I could be doing wrong would be great! Thanks, Jay Paulson Developer, Web Technologies Viatel, Inc. http://www.viatel.com -- 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]
AW: [PHP-DB] MySQL manager
http://phpwizard.net/projects/phpMyAdmin/ Mit freundliche Gruessen / Regards Juergen Immel MultiServicesNetworks / Anwendungsentwicklung |N |O |C | --|--|--|--|- | GROVE Network Operation Center http://www.grove.de http://www.iag-net.de Kooperationspartner des Deutschen Provider Networks DPN + NOC99 - die Plattform fr den IT-Workflowhttp://www.grove.de NOC99 + -Ursprngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Gesendet: Dienstag, 27. Mrz 2001 16:34 An: [EMAIL PROTECTED]; [EMAIL PROTECTED] Betreff: RE: [PHP-DB] MySQL manager www.mysqlfront.de I have used it and found it to be great. However I am a beginner and if there is a better product please let me know. All the best Lisa -Original Message- From: Rosen [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 27, 2001 3:26 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL manager Hi, can anybody tell me for some cool MySQL database manager ? Thanks, Rosen Marinov -- 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 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-DB] checkbox data
I have a number of apartment features that are entered via checkboxes. In my revision script, I am not sure of the best way to revise these. With the system I am using now I set the field to "1" if the box is checked on the initial form, otherwise, it becomes zero indicating, "NO" [ "1" is "YES" ]. so how do I "check" the boxes when i pull the initially entered information? [ so that the user may, check or uncheck them and resubmit. I could go thru a massive series of IF statements i suppose, but I know there must be a simpler way. Does anyone else work with ceckbox data in their DB? thanks much, olinux
[PHP-DB] fetch array problems.
Hello all. Can someone tell me what I'm doing wrong here? $sql = "SELECT * FROM user_prefs WHERE u_id='$UserID'"; $result = mysql_db_query($sql); $color = mysql_fetch_array($result); echo ' table bgcolor="'.$color[color_1].'" class="nav" .. '; I can't get $color[color_1] to return a value. It's in the db and color_1 is a valid table containing a hex value. This is my first attempt at using assoc. arrays. Thanks, John -- 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]