RE: [PHP-DB] Passing string variable to HTML TITLE tag fails within Netscape but works well within IE.
Hi Darrian Have had similar problems. I got around it by wrapping all posted variables with rawurlencode(). This replace any spaces or special characters with an nasi equiv ie space with %20. IE will ignore it. GL Howard -Original Message- From: Darrian Walker [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 16 October 2002 1:10 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Passing string variable to HTML TITLE tag fails within Netscape but works well within IE. Passing string variable to HTML TITLE tag fails within Netscape but work well within IE. I have a single page consisting of inventory items to be sold. When an item is selected, it passes the product name to a DETAIL page as part of the TITLE tag for the DETAIL page. My problem is: Netscape does not like the SPACES between the text and refuses to display the DETAIL page. Initially, I thought there might be some way to parse the string and add the ascii code for SPACE, but I wasn't sure if I was on the right track. Does anyone have a proven solution to this problem? I thought the pseudo code might look something like this: ?php function parse_and_change(grab_string){ $string_holder=$grab_string; while stepping through the characters in this $string_holder { if character = (or some other representation) replace it with something that doesn't scare netscape or title tag } return $string_holder; } ? ?php if (isset($HTTP_GET_VARS[itemname])) { $title = (parse_and_change($HTTP_GET_VARS[itemname] )); }else{ $title=Generic Product Title; } ? html title?php echo $title ? /title /html
RE: [PHP-DB] oddity with insert multiple input fields to multipletables
Hmmm... OK this may a long way around but if when you are generating your graph, if the value returned is then get the next value minus it from the last good value and store it as a value. Get the last the last good, minus the calculated value and use that as the missing value. Put this all into an array then plot from that. ie get array of values 3,4,5,3,0,3,0,1 etc work through array checking values each side if a value is 0. Get the difference and replace 0 with the difference. Hope that's makes sense. I'm only a beginner is this area so someone else will probably have a better way. Howard On Sat, 2002-08-17 at 15:44, Howard Picken wrote: What about setting all fields have a default value, say 0, that way you won't have a null but still a zero value. Howard That would just make the graphs drop to zero for those dates, which would not look so great. Idealy, pressing submit on the web form would send only the field(s) with data, and not empty fields. -- Chip -Original Message- From: Chip Wiegand [mailto:[EMAIL PROTECTED]] Sent: Sunday, 18 August 2002 7:08 AM To: phpdb Subject: [PHP-DB] oddity with insert multiple input fields to multiple tables I have a web page interface to a mysql database. In this web page I have about a dozen form input fields. On submit these are submitted to multiple tables, a differant table for each input field. If I leave any fields blank, and insert only some of the fields, the database will insert an empty row to all the effected tables that didn't have any data from the input fields. I have another page that generates graphs from the tables, the empty rows show up as breaks in the graphs lines, if I manually delete all the empty rows the graphs work fine. What do I need to do to prevent these empty rows from being written to the tables? -- chip w www.wiegand.org [EMAIL PROTECTED] (my web server died and the hard drive crashed hard, and is running from an incomplete backup on another machine, what a drag) :-( -- 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] Grrr... Redirection not working
Hi folks Problem: I'm trying to protect a heap of email addresses on lots of pages from spammers. The pages are static pages on another site, (reason, they have to be), but as some of them are generated on my site using PHP/MYSQL I thought that the best way would be to redirect mail links to a popup form on my site that could grab the name and email address from the DB etc. This I have working fine. But what I'd like to do is have the mailform coming up with no toolbar, locationbar etc. After much browsing it looks like I can't change the window attribs once it's opened. I don't want to have to change 100's of pages to include a js on top to set these properties My Solution: So I thought that although it may be a long way round (although quicker than changing heaps of pages) was to create a redirector popup page that calls the Mailform with everything turned off then automatically shuts itself. I know that maybe this is not strictly PHP/MYSQL related but I figured that someone might have other ideas or might even have done this themselves. My some-what clumbsy code is below. HTML ?php if (!isset($senditto)) { $MailTo = [EMAIL PROTECTED]; }else { $whoto = $senditto; } if (!isset($fwdsite)) { $sitename = unlisted; } else { $sitename = stripslashes($fwdsite); } if (!isset($cat)) { $lookupdb = nocat; } else { $lookupdb = stripslashes($cat); } if (!isset($nabout)) { $about = nosubject; } else { $about = stripslashes($nabout); } if (!isset($ctype)) { $ctype = c1; } $whereto = http://www.somewhere.com/mailform.php?senditto=.$whoto.fwdsite=.$sitena me.cat=.$lookupdb.nabout=.$about.ctype=.$ctype ? HEAD SCRIPT language=JavaScript !-- function openWindow(url) { popupWin = window.open(url,'MailRedirector', 'top=20,left=20,resizable=no,width=640,height= 480,scrollbars=no,menubar=no,toolbar=no') } var StayAlive = 15; // Number of seconds to keep window open function KillMe(){ setTimeout(self.close(),StayAlive * 1000); } --! /SCRIPT NOSCRIPT META http-equiv=Refresh content=0; URL=?php echo $whereto; ? /NOSCRIPT titleMailform redirector/title /HEAD BODY onload=openWindow(?php echo $whereto; ?);KillMe();self.focus() font size=3 div align=centerMail Form Redirection Page/div /font /BODY /HTML Any ideas anyone? TIA Howard -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] auto increment
If you run an optimize or a repair on your datafile it'll set the autoincrememtn back to next number Howard -Original Message- From: Daniele Baroncelli [mailto:[EMAIL PROTECTED]] Sent: Friday, 14 June 2002 11:27 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] auto increment Hi guys, The auto_increment field of my MySQL table gives me 258, although the higher value at the moment is 241. I deleted the latest records, thinking that also the auto_increment would decrease, but this is not. I would like to know if there is a way to bring the auto_increment back to the higher value + 1. Cheers Daniele -- 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
RE: [PHP-DB] Open file dialog box to save static file
No that wouldn't work because the formatted page looks quite different from the page she uses for admin. I've been looking for some samples for fopen() coding, cause I'm relatively new to this PHP game, I think I've found an example that might be useful though so I'll play around a bit and see what I can learn. Thanks Peter --- Hi Just occurred to me - can you just use the browser to 'Save page as' and change the file name to page.htm instead of page.php? Peter --- Excellence in internet and open source software --- Sunmaia www.sunmaia.net [EMAIL PROTECTED] tel. 0121-242-1473 --- -Original Message- From: Howard Picken [mailto:[EMAIL PROTECTED]] Sent: 12 May 2002 10:05 To: [EMAIL PROTECTED] Subject: [PHP-DB] Open file dialog box to save static file I'm looking for a way to do the following I've created a php/mysql site for my wife for various database lists she has. She uses PHP locally on our on web server to add/manage entries but a lot of the pages need to be static and uploaded to a specific site (no PHP/MySQL). So I've give her a link that calls another php page to generate and view the static page in the format she requires. She then has to view the source of that page hilight and copy it over the top of the old page on her PC, then upload it to the site. Now... what I would to be able to do is instead of her having to view source etc. I would like to be able to call up a Windows file save dialog box (maybe even going staright to the correct folder) so that the file can just be saved. I can't find anything in the PHP manual about this. Anyone done it or have any ideas? Howard -- 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
RE: [PHP-DB] Please help me! :(
Can I ask why you're not using autoincrement for your id field? If you used this you would never have the problem your having. Everytime a record is added it will increment the id field by one, so you don't have to use all the code your using. Howard -Original Message- From: Leif K-Brooks [mailto:[EMAIL PROTECTED]] Sent: Sunday, 24 March 2002 3:42 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Please help me! :( I have a site where things in the database have ids. When something new is added, it gets an id one higher than the highest existing id. I use code something like this: $gethighestid = mysql_fetch_array(mysql_query(select id from table order by id desc limit 1)); $tobeid = $gethighestid[id]+1; mysql_query(insert into table(id,othercolumn,othercolumn2) values('$tobeid','something','something')); The thing is, I just got two rows with duplicate ids. Aparantley, two people must of added two things at just the right times to make the same id. Is there any way that will reduce, or eliminate, the time gap between getting id and inserting? -- 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
RE: [PHP-DB] finding ID's
Hi Jon Try using something like $getlist = mysql_query(SELECT id FROM yourdb,$dbconnectetc); $numrows = mysql_num_rows($getlist); echo $numrows\n; This will give you the number of records in your db. If you use autoincrement for the id field your will not have to worry about your ++. If you delete any records numrows will always be correct. HTH Howard First off, sorry for the newbie question... :(. I want to be able to query the database and find the record with the highest ID value. Example... each row ideally has an incremented integer ID (1, 2, 3, 4...) but I am running into problems when I try and delete a row (let's say row 2). My PHP currently selects all of the rows and formulates the ID off of that... This I found out is bad because when I delete row 2 the query says there are 3 rows so my PHP will try to make the ID = 4. I just need the code to find the highest ID so I can ++ it. Sorry again for the easy question! -Jon Gales http://www.macmerc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Save generated page locally
Hi guys I have a local server being used to generate page which are then uploaded as static pages to another server. I would like have the script call up the Windows save as dialog when a new page has generated so a folder on the local unit can be selected etc. I've been looking for an example or a function to do this but haven't seen one. Any Ideas? TIA regards Howard Picken [EMAIL PROTECTED] Launceston, Tasmania, Australia -- 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 administration on Linux through NT
If you're running a web server on your Linux box then simply download, install and use phpMyAdmin. All your management is then down through web pages. I use it all the time. HP -Original Message- From: Jerry [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 16 January 2002 10:48 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] mySQL administration on Linux through NT Hi, I have mySQL on LINUX Does anybody knows a windows software to manage mySQL through win2k (TCP/IP - Intranet) ? With mySQL on win2k, you can manage it using a windows interface. I'm looking for the same kind of interface to manage mySQL on a Linux platform from win2k. Thanks. Jerry -- 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] Accessing fields with the same name in MySQL
You could try returning the whole info with an alias i.e. select tbl_job.id AS jobno, tbl_job.name.id, tbl_job.job, tbl_name.* from tbl_name, tbl_job where tbl_name.id = tbl_job.name_id; You should then be able to refer to the tbl_job.id as jobno in any $row function i.e. $jobnum=$row['jobno']; Haven't tried it, but I think it would work. good luck Howard -Original Message- From: Trevor Lanyon [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 28 August 2001 4:13 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Accessing fields with the same name in MySQL tbl_job --- id name_id job tbl_name id first last SQL --- select * from tbl_name, tbl_job where tbl_name.id = tbl_job.name_id; I use mysql_fetch_object to retrieve a row from the above result set. I have two objects, objName and objJob. The constructor for both objects accept a result object. How do I reference what table the id column came from. These objects are generic so aliasing is not an option. So how to I differentiate what table each column comes from? Trevor Lanyon ClearOption Technologies 204.889.1906 - Office 204.831.7243 - Fax 204.229.2625 - Cellular http://www.clearoption.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] -- 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] using A NAME ref
Thanks Walter Sorry. I should have thought about more details. I'm using echo a href=\/members/members.php?$memltr#$member\$member/a; (within php4 code) When I try this it just goes to the first letter (A) page because I've used an Isset on $memltr in members.php setting it to A if empty. It seems to be having trouble parsing out the parameters so something is not right. (The members field on the generated page does have the a name tag around it) Howard -- 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 newbie: inserting new entry to table?
I'm a learner too. But as I understand it, You make a connection to the database (or open it?). Once it's open or connected to, you can access the different tables within it. I think the difference between mysql_db_query mysql_query is that later assumes that you all ready connected to the database where the first connects at the same time. Anyway glad you fixed your problem. It wasn't a holiday in Australia (just a Sunday night :-)) Cheers Howard -Original Message- From: sg [mailto:[EMAIL PROTECTED]] Sent: Sunday, 29 July 2001 9:40 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] MySQL newbie: inserting new entry to table? Thank You Howard! You sure are quick! I found a way to make it work. I used to have both scripts (the one that displays and the one that inserts new entries) on the same page... Once I separated them I had a link on a third page. I first clicked on the insert entry link then back to the display page... My new entry was there... Now for the solution you gave me. I haven't tried it yet but I'd like to know the difference. I see you don't provide the database name in the mysql_query call. How does MySQL know what base to work with? I've seen both 'mysql_query' and 'mysql_db_query' in several tutorials but haven't yet figured the difference between them (told you a was a newbie...) Thanks again for your interest, I thought everybody would be on holidays... Sébastien -- 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] MySQL newbie: inserting new entry to table?
Have a look at how I would insert data in your case. Howard -Original Message- From: sg [mailto:[EMAIL PROTECTED]] Sent: Sunday, 29 July 2001 8:57 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL newbie: inserting new entry to table? Hi folks! I'm new to PHP/mysql. I created a db with one table (using PhpMyAdmin). The table is called 'addressbook' and the base 'mabase'. I can very well read the table and display it very neatly using the below code, but I CAN'T write new entries using the code in the second page (end of mail) ~~ PAGE THAT WORKS html head titleCarnet d'adresses/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 style type=text/css !-- body { font-family: Arial, Helvetica, sans-serif; font-size: 10pt; color: #00; letter-spacing: 0.1em; background:#efefef} .NomPrenom { font-family: Arial, Helvetica, sans-serif; font-size: 10pt; color: #00; font-weight:bold; letter-spacing: 0.1em; } hr {height:1px; color:#BB} -- /style /head body bgcolor=#FF text=#00 ? $host = localhost; $user = ; $password = ; $database = mabase; //== = // Display addressbook table content //== = mysql_connect($host,$user,$password) or die(Impossible de se connecter à la base de données .$database); $result = mysql_db_query($database,select * from addressbook); while ($row = mysql_fetch_object($result)) { if($row-prenom != ) { echo span class=\NomPrenom\.$row-prenom./span; } if($row-nom != ) { echo span class=\NomPrenom\nbsp;; echo $row-nom./span; } if($row-teldomicile != ) { echo br\n; echo img src=\/interface/icons/domicile_phone.gif\ align=\absbottom\nbsp;\n; echo $row-teldomicile; } if($row-telmobile != ) { echo br\n; echo img src=\/interface/icons/mobile.gif\ align=\absbottom\nbsp;\n; echo $row-telmobile; } if($row-telbureau != ) { echo br\n; echo img src=\/interface/icons/bureau.gif\ align=\absbottom\nbsp;\n; echo $row-telbureau; } if($row-email != ) { echo br\n; echo img src=\/interface/icons/email.gif\ align=\absbottom\nbsp;\n; echo a href=\mailto:.$row-email.\.$row-email./a; } if(($row-rue != ) || ($row-codepostal != ) || ($row-ville != ) || ($row-pays != )) { echo br\n; echo img src=\/interface/icons/adresse.gif\ align=\absbottom\nbsp;\n; } if($row-rue != ) { echo $row-rue; echo nbsp;-nbsp;; } if($row-codepostal != ) { echo $row-codepostal; echo nbsp;; } if($row-codepostal != ) { echo $row-ville; echo ,nbsp;\n; } if($row-pays != ) { echo $row-pays; } echo brbrbrhrbrbrbr\n; } mysql_free_result($result); mysql_close(); // END Display addressbook table content ? /body /html ~~ PAGE THAT WORKS - END - ~~ PAGE THAT DOESN'T WORK html head titleUntitled Document/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body bgcolor=#FF text=#00 ? $host = localhost; $user = ; $password = ; $database = mabase; mysql_connect($host,$user,$password); $nom = Dupont; $prenom = Jean; $ok = mysql_db_query($database, insert into addressbook (nom,prenom) values ('$nom','$prenom')); $ok = mysql_query(insert into addressbook (nom,prenom) values ('$nom','$prenom')); ? /body /html ~~ PAGE THAT DOESN'T WORK - END - After that when I look at my page where I display the addressbook table, I see nothing new, neither does it appear anywhere in PhpMyAdmin. I don't get it! But, again, I'm a newbie. Is there a problem with the fact that I provide an empty user/password? I don't recall having given any user name and password durng MySQL installation. If there is one, where can I find it? Or do I have to re-install??? Hope it's just a newbie syntax mistake though... Thanks for reading anyway! Cheers, Sébastien -- 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] Excluding values of one array from another (sort of)
I have the following code ?php $alphalist = array (A=A, B=B, C=C, D=D, E=E, F=F, G=G, H=H, I=I, J=J, K=K, L=L, M=M, N=N, O=O, P=P, Q=Q, R=R, S=S, T=T, U=U, V=V, W=W, X=X, Y=Y, Z=Z); $exemptlist = array (Q=Q, V=V, X=X, Z=Z); reset ($alphalist); reset ($exemptlist); while (list ($val) = each ($alphalist)) { if ($currltr $val) { $smlval = strtolower($val); echo a href=\http://www.some.com/page_$smlval.htm\;$val/anbsp;nbsp;\n; } Else { echo $valnbsp;nbsp;\n; } } ? This a header and footer for a bunch of pages. A quick explanation is... For the page that is displayed don't show the letter as a link. Now what I want to do is show the letters in the $exemptlist as non links as well (because there a no pages for these letters, and yes I still want them displayed) Eventually I will pass the exempt values from the main page so the exempt values will change depending on what I'm doing with the pages. PS I'm new to this so please be gentle 8-) Any one have any ideas? Thanks in advance Howard Picken [EMAIL PROTECTED] - STRUGGLIN' ON - -- 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] Inserting correct value from database into form option field
Hi guys Created a database and now I've done the pages for editing it. This is what I have... trtdWhich Voyage:/tdtdselect name=voyage COLS=100 ROWS=1 value=?php echo $row[voyage] ? option value=One voyage onlyOne voyage only/option option value=First voyageFirst voyage/option option value=Second voyageSecond voyage/option option value=Third voyageThird voyage/option option value=Fourth voyageFourth voyage/option option value=Fifth voyageFifth voyage/option option value=Sixth voyageSixth voyage/option option value=Various voyagesVarious voyages/option /select/td/tr When I get the record and open it for editing it automatically selects the first option from the list. I would like it to show the original value from the stored record. Any ideas?? Howard Picken [EMAIL PROTECTED] Launceston, Tasmania, Australia -- 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 bit of help with a query needed.
Thanks for that. I've cleaned up things a bit for the time being. I'm still getting an error though. Parse error: parse error in c:\usr\local\www\pages/ships.php on line 30 Line 30 turns out to be $convict = $row["convict"]; so I'm assuming that it's having trouble with the array. I've tried changing $row to $row2 to no avail. That also why I had the rest of the convicts fields in the first place (but didn't display then). When I originally played with this I used a Left Join between the two tables and it all worked accept only one convict was returned for each ship and ship's were listed more than once if there were more than one convict on the ship (of course). Anyway here is the cleaned up code. ?php $db = mysql_connect("localhost", "root"); mysql_select_db("convicts",$db); $result = mysql_query("SELECT * FROM ships ORDER BY ship",$db) or die(mysql_error()); If ($result) { while ($row = mysql_fetch_array($result)) { $id = $row["id"]; $ship = $row["ship"]; $voyage = $row["voyage"]; $sex = $row["sex"]; $year = $row["year"]; echo "font size=\"3\"b$ship/b/fontbr font size=\"2\"$voyage/fontbr font size=\"2\"$sex/fontbr font size=\"2\"$year/fontp\n"; $result2 = mysql_query("SELECT * FROM convicts WHERE ship = '$id' ORDER BY convict",$db); $row = mysql_fetch_array($result2) $convict = $row["convict"]; echo "font size=\"3\"$convict/fontbr\n"; } } Else { echo "font color=\"#FF\"bSorry no records for that letter/b/font\n"; } } ? -- 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]