[PHP] Tracking what has been changed
Here's the scenario... I am building a site in which users will be able to create and then later edit personal information. When they edit their information, I need to keep track of what was changed so that I can inform via email a person to approve the changes. Here's the flow I'm considering... When an UPDATE page is loaded, I build an array like... $fields = array("table.field1" => value, "table.field2" => value, "table.field3" => value) I then plan to save this array to a SESSION variable. Then, when the form is posted I save the new form contents to another SESSION variable. Then I compare the two arrays and save the names of the fields changed to an array saved in a third SESSION variable. Finally, when I build the email, I can parse the changed fields array to inform the person who must approve the changes. First, does anyone have a suggestion of a better way to do this? Second, I can't seem to save an array to a SESSION variable. I build the array in a local variable and then set the SESSION variable equal to it. When I recall the SESSION varialbe, it's contents is "Array". Then, when I print_r() the SESSION variable, I still get "Array" as the contents. What's up? Thanx in advance for any help. -- Robb Kerr Digital IGUANA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Multiple Select Field
Please excuse the length and complexity of this post. I am facing a complicated problem and need to find a solution. Also, I have posted this on both PHP and MySQL boards so please overlook the possibly slightly off-topic subject. I have got one table that contains personal information about users. Another table consists of a list of many interests. This table is composed of simply 2 fields – an ID and the interest. (see below) I can build an HTML form which includes a multiple select list out of which the user can select their interests. I have the list configured so that it displays the “interest” while the value stored is the “ID”. PHP stores this entry as an Array which I can easily turn into a comma delimited list before storing in the database. Here’s my problem. If I store a comma-delimited list in a text field in the Users table, how do I query to determine anyone that has selected specific interests? If I use a full-text search and someone selects “1” for their search criteria, the query will return anyone who selects 1, 10, 11, 12, 13, 14, etc. as their interest. This problem has surely occurred for others. It would affect how you store newsletters for which one might subscribe, keywords in a clipart system, interests the user has, anything from which you want your users to select multiple entries from a long list of choices. Table = Interests Fields = ID, int, auto-increment Interests, text Table = Users Fields = ID, int, auto-increment Name, text Address, text Interests, text Thanx in advance for any help you might provide. If anyone knows of anything written on configuring this type of system, please include a link. Robb Digital IGUANA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Test post from a new client
This is a test post from a new client. I'm trying to decide whether or not to keep it. Please post a reply so that I can see how it shows up. Thanx, Robb
Re: [PHP] Advanced Query Wizard
On Fri, 10 Sep 2004 14:57:29 -0500, Greg Donald wrote: > On Fri, 10 Sep 2004 14:00:47 -0500, Robb Kerr > <[EMAIL PROTECTED]> wrote: >> This is not a sales post. > > It sure sounds like one, not that I care or anything. > > Curious.. did they have a non-windows version? Something for the vim > crowd perhaps? What about for Postgres? I'm using MySQL less and > less all the time. Sorry. Just found a really cool tool that makes my life much easier. And, with all of the recent posts discussing sophisticated queries and dealing with the results, I thought I'd pass on the info. No. There is not a non-windows version. Don't know aobout Postgres. VIM crowd? -- Robb Kerr Digital IGUANA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Advanced Query Wizard
This is not a sales post. I also posted this on the MySQL board. I have been struggling with JOINed SELECT statements in MySQL for a while now. The syntax just seems to elude me. However, I just found a Win Dreamweaver extension that rocks. The Advanced Query Wizard allows me to very quickly and easily write sophisticated, joined queries with conditionals and sorting from many tables at once. It has made my life considerably easier so I wanted to pass on the information. https://www.advancedextensions.com/products.htm Thanx -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's faster? MySQL Queries or PHP Loops?
On Wed, 8 Sep 2004 10:30:59 -0500, Jim Grill wrote: >> Here's the question... >> >> I can either A) in the header or my page, generate a recordset of all of >> the records in the related table and then loop through the recordset >> creating an array of the fields I need and then later pull from it in the >> repeat region... or B) take the six lines of code Dreamweaver generates to >> create a recordset and move them into the repeat region itself. In other >> words, I can create a recordset of all of the records in the related > table, >> loop through it generating a PHP array and pull from this array later OR I >> can query the database every time through the loop while creating the >> repeat region. >> >> Robb Kerr >> Digital IGUANA >> Helping Digital Artists Achieve their Dreams >> >> http://www.digitaliguana.com >> http://www.cancerreallysucks.org >> > Robb, > > How about choice "C"? :-) > > Query once if you can. Running multiple queries in a loop is always going to > be slower. Now, I'm not totally sure I understand the problem. It sounds > like you have one table to query and then you query a second table??? If > that's true then what about a join to get everything you need from both > tables at once? The idea here is that you get one result from MySQL and then > loop through your result and display your content. > > Hope I'm not too far off. > > Jim Grill That brings up another question which I know actually belongs over on the MySQL board, but since the question arose here I thought I'd post here. I understood that MyISAM tables could not be relational. Do you mean that I can create JOINs between MyISAM tables? Maybe I need to do some more research into table types? -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What's faster? MySQL Queries or PHP Loops?
Here's the scenario... First, my HTTP Server (Apache), PHP Server and MySQL Server are on the same machine - an Apple Xserve. Second, I've got a page with a long repeat region reflecting a recordset queried out of a MySQL table. The region also displays information obtained from fields in a related table. Third, I use Dreamweaver to generate my MySQL recordsets and repeat regions. Here's the question... I can either A) in the header or my page, generate a recordset of all of the records in the related table and then loop through the recordset creating an array of the fields I need and then later pull from it in the repeat region... or B) take the six lines of code Dreamweaver generates to create a recordset and move them into the repeat region itself. In other words, I can create a recordset of all of the records in the related table, loop through it generating a PHP array and pull from this array later OR I can query the database every time through the loop while creating the repeat region. Since I haven't freed the table until the bottom of the page and because my MySQL Sever and PHP Server reside on the same machine, will I really notice a measurable difference in speed? If my MySQL Server were a different machine, I'm sure that there would be a noticable difference because all of the queries would be across a network (possibly the internet) and traffic would become a factor. Just wondering what other people have noticed. -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Keep from using cache
Here's the scenario... I am building a courseware builder. The page on which someone builds the test displays the questions which have already been entered followed by an insert form to create a new one. When a new question is created and the page is reloaded, the new question is displayed. But, along with each question is a link to delete the question. When this link is followed, another page opens with the question data and a "delete record" form. When the question is deleted, the user is redirected back to the question list with the insert form. Here's the problem... After a deletion, when the question list page is reloaded, the browser uses the cached version of the page and the question which was just deleted is still displayed. If you refresh the page, the question disappears. So, I know that the deletion is working. I just need to know how to force the browser to NOT use the cached version of the page. Thanx, -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: HTML Table display based upon field contents
On Sat, 24 Jul 2004 23:23:49 +0200, Tularis wrote: > Robb Kerr wrote: > >> I have a complicated table that needs to be altered depending upon the >> contents of a field in one of my recordsets. I've tried several approaches >> and need to know what you recommend. >> >> I've created three totally different tables and put the HTML code for each >> into a database. Then I used PHP to insert the relevant code into the page >> depending upon the contents of a field in a different database. Result - >> the appropriate code is inserted properly into the HTML. Problem - the HTML >> table I'm trying to insert contains PHP code which is not executed after >> being inserted. >> >> Because sometimes the HTML table needs 4 rows and other times only 2, I >> tried enclosing the appropriate s in a PHP IF statement (see below). >> Problem - PHP IF wasn't executed, both s embedded appeared on page >> anyway. And, sometimes, the relevant s will include PHP code so this >> embedding technique won't work. >> >> > if ($row_RS_PageContent['PageType'] != "2") { >> ?> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > } >> ?> >> >> Should I simply describe the entire relevant s on one line, >> appropriately escape them, assign the to a variable and then use an ECHO to >> put them on the page? Or does someone have a simpler more elegant solution? >> >> Thanx > just use eval() on that string, it's not elegant, nor is it really > secure, but it'll work fine. This sounds like exactly what I need. But, can you help me with the synatx? I've read the entry in the PHP documentation and I don't completely understand. Let's assume all of the code to define the HTML table (including appropriate PHP) is stored in a database table called FooterTable. The field containing the code is called FooterField. Do I first need to assign the field to a variable via the eval()... $vFooterText = eval(FooterTable['FooterField']); echo $vFooterText; or does the eval statement automatically include the ECHO... eval(FooterTable['FooterField']); or do I have to read the contents into a variable first, then eval(), then echo... $vFooterText = FooterTable['FooterField']; eval($vFooterText); echo $vFooterText; -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML Table display based upon field contents
On Sat, 24 Jul 2004 17:47:48 -0400, Kevin wrote: > Hi Robb, > > I am a newbie so I wanted to ask a stupid question. In your code below if > the first if statement is true it ends the php processing and then you > reopen with a new out the ?> before the first tag and the work? > > Sorry if this is just dumb. Trying to learn. :) > > Kevin > > -----Original Message- > From: Robb Kerr [mailto:[EMAIL PROTECTED] > Sent: Saturday, July 24, 2004 4:47 PM > To: [EMAIL PROTECTED] > Subject: [PHP] HTML Table display based upon field contents > > I have a complicated table that needs to be altered depending upon the > contents of a field in one of my recordsets. I've tried several approaches > and need to know what you recommend. > > I've created three totally different tables and put the HTML code for each > into a database. Then I used PHP to insert the relevant code into the page > depending upon the contents of a field in a different database. Result - > the appropriate code is inserted properly into the HTML. Problem - the HTML > table I'm trying to insert contains PHP code which is not executed after > being inserted. > > Because sometimes the HTML table needs 4 rows and other times only 2, I > tried enclosing the appropriate s in a PHP IF statement (see below). > Problem - PHP IF wasn't executed, both s embedded appeared on page > anyway. And, sometimes, the relevant s will include PHP code so this > embedding technique won't work. > >if ($row_RS_PageContent['PageType'] != "2") { > ?> > > > > > > > > > > > > > > > > > } > ?> > > Should I simply describe the entire relevant s on one line, > appropriately escape them, assign the to a variable and then use an ECHO to > put them on the page? Or does someone have a simpler more elegant solution? > > Thanx > -- > Robb Kerr > Digital IGUANA > Helping Digital Artists Achieve their Dreams > > http://www.digitaliguana.com > http://www.cancerreallysucks.org To do what you're suggesting, you'd have to put each line of HTML in separate ECHO statements (see below). The problem with this approach is that the table will eventually contain very complex code in each cell. I'd have to do extensive escaping to make sure the code is correctly interpreted. I used a shortcut syntax that allows you to embed several lines of HTML in an IF statement without having to escape everything. The short PHP statement after the embedded lines tells PHP that the embedded code is embedded as if it was ECHOed line by line. This works most of the time. Just not in this instance. To use your suggestion, the code would have to look like this... '; echo ' '; echo ' '; echo ' '; etc. } ?> Note all of the escaping required to simply define the table. You'd have tons more to do when images, links, JavaScript calls, etc. are placed in the table. -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTML Table display based upon field contents
I have a complicated table that needs to be altered depending upon the contents of a field in one of my recordsets. I've tried several approaches and need to know what you recommend. I've created three totally different tables and put the HTML code for each into a database. Then I used PHP to insert the relevant code into the page depending upon the contents of a field in a different database. Result - the appropriate code is inserted properly into the HTML. Problem - the HTML table I'm trying to insert contains PHP code which is not executed after being inserted. Because sometimes the HTML table needs 4 rows and other times only 2, I tried enclosing the appropriate s in a PHP IF statement (see below). Problem - PHP IF wasn't executed, both s embedded appeared on page anyway. And, sometimes, the relevant s will include PHP code so this embedding technique won't work. Should I simply describe the entire relevant s on one line, appropriately escape them, assign the to a variable and then use an ECHO to put them on the page? Or does someone have a simpler more elegant solution? Thanx -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nested If...Else...
On Sat, 24 Jul 2004 12:09:41 -0400, Scot L. Harris wrote: > On Sat, 2004-07-24 at 12:05, Robb Kerr wrote: >> What's wrong with this syntax. I just can't see my mistake. >> >> if ($vBkgrndImage == "AnswerPage") { >> if ($vAnswerID_RS_PageContent != $row_RS_PageContent['CorrectAnswer']) { >> $vBkgrndImage = "Bkgrnd-Body-Incorrect.jpg"; >> } else { >> $vBkgrndImage = "Bkgrnd-Body-Correct.jpg"; >> } >> } >> >> Thanx > > Single quotes around CorrectAnswer? > > What is the error you are getting? > > Guessing that if it passes the syntax checks I expect your problem is it > is always evaluating to one of the options and not the other. Sorry everyone. Found the problem. Thanx for all your trying. The problem was a stupid error on my part - which they usually are. The syntax of the IF statement was correct. I had the $_GET statement which defined $vAnswer_ID_RS_PageContent below the IF in the script. Both of these elements are in the so the display of the variables are below this in the . So, I was seeing variables containing the correct values, but when the IF was executed, $vAnswer_ID_RS_PageContent had not yet been defined. Thanx again for your help. -- Robb Kerr Digital IGUANA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nested If...Else...
On Sat, 24 Jul 2004 09:47:52 -0700 (PDT), Matthew Sims wrote: >> What's wrong with this syntax. I just can't see my mistake. >> >> if ($vBkgrndImage == "AnswerPage") { >> if ($vAnswerID_RS_PageContent != $row_RS_PageContent['CorrectAnswer']) { >> $vBkgrndImage = "Bkgrnd-Body-Incorrect.jpg"; >> } else { >> $vBkgrndImage = "Bkgrnd-Body-Correct.jpg"; >> } >> } >> >> Thanx >> -- >> Robb Kerr > > I can't see anything wrong. What's the error you're receiving? $vBkgrndImage = "Bkgrnd-Body-Incorrect" whether $vAnswerID_RS_PageContent equals $row_RS_PageContent['CorrectAnswer'] or not. I've added printouts of my variables to the bottom of the page so that I can check their content. And even when both associated variables match, "Bkgrnd-Body-Incorrect" is returned. -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nested If...Else...
On Sat, 24 Jul 2004 12:09:41 -0400, Scot L. Harris wrote: > On Sat, 2004-07-24 at 12:05, Robb Kerr wrote: >> What's wrong with this syntax. I just can't see my mistake. >> >> if ($vBkgrndImage == "AnswerPage") { >> if ($vAnswerID_RS_PageContent != $row_RS_PageContent['CorrectAnswer']) { >> $vBkgrndImage = "Bkgrnd-Body-Incorrect.jpg"; >> } else { >> $vBkgrndImage = "Bkgrnd-Body-Correct.jpg"; >> } >> } >> >> Thanx > > Single quotes around CorrectAnswer? > > What is the error you are getting? > > Guessing that if it passes the syntax checks I expect your problem is it > is always evaluating to one of the options and not the other. To eliminate the single quotes in the IF statement I altered the code like this... $vPageContentCorrectAnswer = $row_RS_PageContent['CorrectAnswer']; if ($vBkgrndImage == "AnswerPage") { if ($vPageContentCorrectAnswer != $vAnswerID_RS_PageContent) { $vBkgrndImage = "Bkgrnd-Body-Incorrect.jpg"; } else { $vBkgrndImage = "Bkgrnd-Body-Correct.jpg"; } } It still works the same. What's the deal? -- Robb Kerr Digital IGUANA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nested If...Else...
On Sat, 24 Jul 2004 18:18:23 +0200, Marek Kilimajer wrote: > Robb Kerr wrote: >> On Sat, 24 Jul 2004 12:09:41 -0400, Scot L. Harris wrote: >> >> >>>On Sat, 2004-07-24 at 12:05, Robb Kerr wrote: >>> >>>>What's wrong with this syntax. I just can't see my mistake. >>>> >>>>if ($vBkgrndImage == "AnswerPage") { >>>> if ($vAnswerID_RS_PageContent != $row_RS_PageContent['CorrectAnswer']) { >>>>$vBkgrndImage = "Bkgrnd-Body-Incorrect.jpg"; >>>> } else { >>>>$vBkgrndImage = "Bkgrnd-Body-Correct.jpg"; >>>> } >>>>} >>>> >>>>Thanx >>> >>>Single quotes around CorrectAnswer? >>> >>>What is the error you are getting? >>> >>>Guessing that if it passes the syntax checks I expect your problem is it >>>is always evaluating to one of the options and not the other. >> >> >> You've got it. Syntax passes checking - always returns.. >> $vBkgrndImage = "Bkgrnd-Body-Correct.jpg" >> >> Single quotes around 'CorectAnswer' is because that entry is in the style >> of table_recordset['field']. How else should this be coded? >> >> Thanx > > I think all column names are returned lowercased, so use > $row_RS_PageContent['correctanswer'] Nope. That just changed the return to always be the other option. -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nested If...Else...
On Sat, 24 Jul 2004 12:09:41 -0400, Scot L. Harris wrote: > On Sat, 2004-07-24 at 12:05, Robb Kerr wrote: >> What's wrong with this syntax. I just can't see my mistake. >> >> if ($vBkgrndImage == "AnswerPage") { >> if ($vAnswerID_RS_PageContent != $row_RS_PageContent['CorrectAnswer']) { >> $vBkgrndImage = "Bkgrnd-Body-Incorrect.jpg"; >> } else { >> $vBkgrndImage = "Bkgrnd-Body-Correct.jpg"; >> } >> } >> >> Thanx > > Single quotes around CorrectAnswer? > > What is the error you are getting? > > Guessing that if it passes the syntax checks I expect your problem is it > is always evaluating to one of the options and not the other. You've got it. Syntax passes checking - always returns.. $vBkgrndImage = "Bkgrnd-Body-Correct.jpg" Single quotes around 'CorectAnswer' is because that entry is in the style of table_recordset['field']. How else should this be coded? Thanx -- Robb Kerr Digital IGUANA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Nested If...Else...
What's wrong with this syntax. I just can't see my mistake. if ($vBkgrndImage == "AnswerPage") { if ($vAnswerID_RS_PageContent != $row_RS_PageContent['CorrectAnswer']) { $vBkgrndImage = "Bkgrnd-Body-Incorrect.jpg"; } else { $vBkgrndImage = "Bkgrnd-Body-Correct.jpg"; } } Thanx -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] If...Or...Else
>From time to time I need an If statement that includes an Or condition... What's the correct syntax for the If line? Thanx -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Code elegance and cleanliness
Just a quick question. Does it really matter how long your code is or how many variables you use? For instance you can enter the following... $imgBkgrnd = array("1"=> "bkgrnd-default.gif", "2" => "bkgrnd-positive.gif", "3" => "bkgrnd-negative.gif"); $imgNeeded = table['field']; $imgName = $imgBkgrnd[$imgNeeded]; or, you can code the same thing as... $imgBkgrnd = array("1"=> "bkgrnd-default.gif", "2" => "bkgrnd-positive.gif", "3" => "bkgrnd-negative.gif"); $imgName = $imgBkgrnd[$table['field']]; The first example uses one more variable and a longer code block but is easier to read and debug. The second example uses one less variable and a shorter code block but is harder to debug later. Should I be striving for the shortest most compact code utilizing the fewest possible variables. Or, can I code in a style which is easier to read and debug? -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array help
On Fri, 23 Jul 2004 14:21:42 -0700 (PDT), Matthew Sims wrote: > imgBkgrnd = array("1"=> "bkgrnd-default.gif", "2" => > "bkgrnd-positive.gif", "3" => "bkgrnd-negative.gif"); You got it... imgBkgrnd = array("1"=> "bkgrnd-default.gif", "2" => "bkgrnd-positive.gif", "3" => "bkgrnd-negative.gif"); imgNeeded = table['field']; imgName = ??? Now, how do I get the image name associated with the key number obtained from my table out of the array and into the variable so that I can use it later in the HTML? Thanx, Robb -- Robb Kerr Digital IGUANA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] JavaScript in PHP or PHP in JavaScript
Let me preface this by saying that I don't know JavaScript. I've got a page that is built by a long complicated JavaScript that I was able to hack just enough to function the way I wanted. There are some lines of code -- those that define div positioning -- that need to be different depending upon what it obtained from my database. I could build a simple PHP if/then statement and embed the entire JavaScript with the lines changed. Or, I could build a simple PHP if/then statement with only the lines of JavaScript that need to be changed and embed it within the JavaScript. which would be better? JavaScript in PHP several lines of JavaScript PHP in JavaScript several lines of JavaScript <?php if (conditional) { echo 'lines of JavaScript'; } else { echo 'other lines of JavaScript'; } ?> several lines of JavaScript Thanx, Robb -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Array help
I've got a field in my database that contains a single numerical character ("1" or "2" or "3", etc.). I need to load a different background image in one cell of a table depending upon what the number the field contains. What's the easy syntax for associating entries in the field ("1" or "2" or "3", etc.) with image filenames ("bkgrnd-default.gif" or "bkgrnd-positive.gif" or "bkgrnd-negative.gif", etc.) Thanx, Robb -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML Escaping
On Fri, 23 Jul 2004 14:23:27 -0400, Brent Baisley wrote: > Took me a little while to figure out what you were asking. You can do > something like this for easy readability. > if ($recordset['field'] != "1") { > ?> > > onMouseOver="MM_swapImage('PreviousPage','','/URL/ > ButtonName.gif',1)"> src="/URL/ButtonName.gif" alt="Previous Page" name="Previous Page" > width="150" height="20" border="0"> > > } > other php code > ?> > > You can close out your php declaration at any time and just put in > regular text. It's a lot easier doing it this way than echo'ing many > lines and you don't have to worry about escaping quotes. > > On Jul 23, 2004, at 2:07 PM, Robb Kerr wrote: > >> I've got a conditional button that needs to appear/hide on my page >> depending upon the contents of a field in my database. The button is an >> image and has a long URL and JavaScript for image rotation attached to >> it. >> Needless to say, the href is quite long and includes several "'" >> characters. My conditional works great but I want to know if there is >> an >> easy way to escape the whole href so that the "'" characters will not >> be >> seen as PHP quote marks. See below... >> >> > if ($recordset['field'] != "1") { >> echo '> onMouseOver="MM_swapImage('PreviousPage','','/URL/ >> ButtonName.gif',1)">> src="/URL/ButtonName.gif" alt="Previous Page" name="Previous Page" >> width="150" height="20" border="0">; >> ?> >> >> Thanx in advance, >> Robb >> -- >> Robb Kerr >> Digital IGUANA >> Helping Digital Artists Achieve their Dreams >> >> http://www.digitaliguana.com >> http://www.cancerreallysucks.org >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> Thanx. That works great. And, it's easy to read and update without having to remember to escape everything. -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML Escaping
On Fri, 23 Jul 2004 14:43:29 -0400, John W. Holmes wrote: > Robb Kerr wrote: >> I've got a conditional button that needs to appear/hide on my page >> depending upon the contents of a field in my database. The button is an >> image and has a long URL and JavaScript for image rotation attached to it. >> Needless to say, the href is quite long and includes several "'" >> characters. My conditional works great but I want to know if there is an >> easy way to escape the whole href so that the "'" characters will not be >> seen as PHP quote marks. See below... >> >> > if ($recordset['field'] != "1") { >> echo '> onMouseOver="MM_swapImage('PreviousPage','','/URL/ButtonName.gif',1)">> src="/URL/ButtonName.gif" alt="Previous Page" name="Previous Page" >> width="150" height="20" border="0">; >> ?> > > It looks like you're trying to echo a string that's delimited by single > quote marks, but I don't see a single quote at the end of the string. > Assuming this is what you want, though, to escape single quotes within > the string you're trying to echo, put a backslash \ character before them. > > if ($recordset['field'] != "1") { > echo ' onMouseOver="MM_swapImage(\'PreviousPage\',\'\',\'/URL/ButtonName.gif\',1)"> src="/URL/ButtonName.gif" alt="Previous Page" name="Previous Page" > width="150" height="20" border="0">'; > ?> > > Alternatively, you can just use double quotes in your JavaScript > MM_swapImage() function... Thanx. That's the escape character I needed. But, I've choosen to use the style Brent suggested above. It'll be easier than remembering to escape every single quote character. -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTML Escaping
I've got a conditional button that needs to appear/hide on my page depending upon the contents of a field in my database. The button is an image and has a long URL and JavaScript for image rotation attached to it. Needless to say, the href is quite long and includes several "'" characters. My conditional works great but I want to know if there is an easy way to escape the whole href so that the "'" characters will not be seen as PHP quote marks. See below... ; ?> Thanx in advance, Robb -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] htmlArea look-a-like
I am developing an app in which my visitors must be able to enter text and do some minimal HTML formatting including making some of the text hyperlinks. I like the looks of htmlArea, but can't get either available version to work in any Mac browsers. I've also found EditLive! and am intrigued by it. Does anyone know of anthing else like these availlable on the market? htmlArea = http://www.interactivetools.com/products/htmlarea/ EditLive! = http://www.ephox.com/product/editliveforjava/default.asp Thanx, Robb -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OT but need guidance in timing page views
On Mon, 19 Jul 2004 15:54:14 +0200, Miroslav Hudak wrote: > I would do it this way: > > - open the page and create hidden iframe (or frame with 0% width/height) > which will be refreshing itself every ... let's say ... 2 minutes... > then you'll get up to 2 minutes accurate numbers... the refreshed page > would write timestamp to database every refresh... when the user crashes > or leaves the page without logging off, you know, that his next refresh > (and last one) would be LASTREFRESH + 2mins ... that gives you quite > accurate numbers when implemented correctly. > > On the other hand, it will be a bit load producing, while that > subsequent writes to database... > > Hope it helped a bit, > regards, > m. > > Robb Kerr wrote: > >> I know that this is somewhat off topic, but I just need a starting place to >> do the research and thought someone here might be able to help. I am >> developing an application in which I need to time how long a visitor >> remains within a module and how long they view each page. I can create the >> appropriate fields in MySQL and can use PHP to do the appropriate >> calcualtions. What I don't know is how I communicate this information to >> the server. I can use POST or GET statements to pass info with page turns >> but what do I do if the visitor leaves the site without logging out or >> experiences a machine crash? >> >> Also, if anyone knows of a good javascript newsgroup, please pass along the >> info. >> >> Thanx, >> Robb Thanx for the suggestion. Now to ask for more help... I know how to create the layer which you mentioned. But, how do I make it auto update every few minutes and send data to the database? Thanx again, Robb -- Robb Kerr Digital IGUANA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OT but need guidance in timing page views
On Mon, 19 Jul 2004 08:58:22 -0500, Jay Blanchard wrote: > [snip] > I know that this is somewhat off topic, but I just need a starting place > to do the research and thought someone here might be able to help. I am > developing an application in which I need to time how long a visitor > remains within a module and how long they view each page. I can create > the appropriate fields in MySQL and can use PHP to do the appropriate > calcualtions. What I don't know is how I communicate this information to > the server. I can use POST or GET statements to pass info with page > turns but what do I do if the visitor leaves the site without logging > out or experiences a machine crash? > [/snip] > > The stats would be nearly bogus because of the habits of users. Let us > say that I log in to the app. I have a look at the items on the page, I > get up, go to the bathroom, talk to Bobbi in the hallway, wander back > into my office, grab my coffee cup, go to the coffee machine, visit with > Bob while I am there, realize that it is time for my first meeting, go > back to my office, grab my notebook, head for meeting, arguements and > disagreements abound, meeting takes way longer than expected, return to > office, listen to messages, return calls, people wander in and ask > questions about things, I check e-mails, return a couple. Before you > know it 3 hours have passed before I go back to the browser window with > the app clock running. Not to mention the two things you said above. > > Why is this important? Just curious. You are completely correct and I've already considered this issue and discussed it with my client. But, they aren't bothered by the issue. The app is an online education system that provides accredidation and all I really have to verify is that the visitor (student) remained within the module for a minimum amount of time. I know that the student can get around this issue by simply leaving the browser open with one of my pages loaded, but they'll still have to pass an exam at the end of the course. So, if they just leave the page open and don't read the contents, they probably won't be able to pass the test. At least I can report to the accredidation agency that the student had the course open for the required amount of time. Robb -- Robb Kerr Digital IGUANA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OT but need guidance in timing page views
I know that this is somewhat off topic, but I just need a starting place to do the research and thought someone here might be able to help. I am developing an application in which I need to time how long a visitor remains within a module and how long they view each page. I can create the appropriate fields in MySQL and can use PHP to do the appropriate calcualtions. What I don't know is how I communicate this information to the server. I can use POST or GET statements to pass info with page turns but what do I do if the visitor leaves the site without logging out or experiences a machine crash? Also, if anyone knows of a good javascript newsgroup, please pass along the info. Thanx, Robb -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with array / list looping syntax
On Wed, 30 Jun 2004 00:58:32 + (GMT), Philip Olson wrote: >>> I need some help with a looping syntax. In english, "a" is used before >>> words that begin with consonants - "an" is used before words that start >>> with vowels. I'm trying to create a loop that checks this state and inserts >>> the correct word in the echo line. Below is the sloppy version of what I'm >>> trying to do... >>> >>> >> if (substr($table['field'], 0, 1)=="a") OR (substr($table['field'], 0, >>> 1)=="e") OR (substr($table['field'], 0, 1)=="i") OR >>> (substr($table['field'], 0, 1)=="u") OR (substr($table['field'], 0, >>> 1)=="y") } >>> echo 'Member has an ' . $table['field'] . ' who is...'; >>> } else { >>> echo 'Member has a ' . $table['field'] . 'who is...'; >>> } >>> ?> >>> >>> There's got to a cleaner way to do this. Perhaps using a list or array >>> containing the vowels and steping through it checking the first letter of >>> the field contents against each member of the list. But, I don't know how >>> to code this system. Please help. >>> >> >> How about this? >> >> $vowels = array('a', 'e', 'i', 'o', 'u'); >> echo 'Member has a'.(in_array($table['field'][0], $vowels) ? 'n' : >> '').' '.$table['field'].' who is...'; > > Yet another solution (just for fun): > > $vowels = 'aeiou'; > if (false !== strpos($vowels,strtolower($table['field']{0}))) echo 'n'; > > Regards, > Philip Thank you for your suggestions. I know it's not as elegant as your suggestions, but I settled on the following because it's easy for me to read and understand when I view the code later. I also listed both upper and lower case vowels in the array because according to the PHP Manual, in_array() is case sensitive. Thanx again, Robb -- Robb Kerr Digital IGUANA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with array / list looping syntax
I need some help with a looping syntax. In english, "a" is used before words that begin with consonants - "an" is used before words that start with vowels. I'm trying to create a loop that checks this state and inserts the correct word in the echo line. Below is the sloppy version of what I'm trying to do... There's got to a cleaner way to do this. Perhaps using a list or array containing the vowels and steping through it checking the first letter of the field contents against each member of the list. But, I don't know how to code this system. Please help. Thanx, Robb -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Random Record Retrieval
How's that for alliteration in a subject line? Got a simple MySQL table that contains records which are made up of only three fields - ID, quote and author. These are "inspirational" quotes that I want to appear at the bottom of the pages of my website. I want them to come up randomly with every page load. I've posted this on a MySQL board to see if there's a MySQL command to make things simple. But, I thought about building a random number generator in PHP that selects a random number out of the total number of records in the table, saves it into a variable and then have MySQL retrieve that ID. Is this the way to go or is there something simpler. And, if this is the best way to go, unfortunately I don't know how to write a random number generator in PHP so would appreciate any help. Thanx in advance, Robb -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Use PHP to copy MySQL tables
Is there an easy way to create an HTML page that uses PHP to copy selected MySQL tables to backup copies on the same MySQL server? I want to create an administration page for my client to be able to "backup" their database whenever they see fit. But, I can't give them direct access to the MySQL server and don't want them backing up to their hard drive. I prefer to simply copy the tables to "backup" versions on the server so that if problems arise, I can log into the server and simply copy the "backups" to the originals. Thanx in advance. -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Keyword Search
On Tue, 6 Apr 2004 11:25:09 -0500, Jay Blanchard wrote: > [snip] > I've inherited a database so must live with a less than elegant > structure. > The table contains one "keyword" field into which the author has entered > things like... > > Record 1 = Apples > Record 2 = Apples, Bananas > Record 3 = Apples, Figs > Record 4 = Bananas, Figs, Dates > > I need to do a search on this field to return all of the records > containing > "Figs". What's the search syntax? > > I've tried... > SELECT * from dbname.tablename MATCH (dbname.fieldname) AGAINST 'Figs' > [/snip] > > A. Belongs on a SQL list (and there are plenty) > 2. SELECT * FROM dbname.tablename WHERE (dbname.fieldname) LIKE '%Figs%' Thanx for the advice. I'll give it a try. BTW, I know that some of my questions belong on a SQL list. Can you recommend any? I haven't found any as active or helpful as this PHP one. -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Keyword Search
I've inherited a database so must live with a less than elegant structure. The table contains one "keyword" field into which the author has entered things like... Record 1 = Apples Record 2 = Apples, Bananas Record 3 = Apples, Figs Record 4 = Bananas, Figs, Dates I need to do a search on this field to return all of the records containing "Figs". What's the search syntax? I've tried... SELECT * from dbname.tablename MATCH (dbname.fieldname) AGAINST 'Figs' It doesnt' work. Thanx in advance -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Connecting to Databases
On Tue, 6 Apr 2004 10:24:29 -0500, Robb Kerr wrote: > On Tue, 6 Apr 2004 11:18:11 -0400, John W. Holmes wrote: > >> From: "Robb Kerr" <[EMAIL PROTECTED]> >> >>> I have found that it is not uncommon when trying to connect to a database >>> on an Apache server to get a return similar to "Access denied for user: >>> [EMAIL PROTECTED]". I just ran into this problem because I wanted to use >>> SQLyog to manipulate a table that already exists on one of my servers. I >>> went to the "Connections" document that Dreamweaver creates and copied all >>> of the connection info (host, db, user, password) exactly into the >>> connection dialogue of SQLyog. The error message above was returned when I >>> tried to connect although I can connect Dreamweaver to the database >> without >>> problem even though the IPAdress is not listed as part of the username. >> >> With MySQL, a user is given permission to connect with a specific username >> and password _and_ from a specific host. When you run the script from >> Dreamweaver, is it on the same machine as SQLYog? You probably just need to >> modify your MySQL user to have permission to connect from "IPAddress". >> >> ---John Holmes... > > Unfortunately, SQLyog and Dreamweaver reside on the same machine. Should I > create a new user for the database which is "[EMAIL PROTECTED]"? Why would > SQLyog require this while Dreamweaver does not? And, why doesn't identical > connection information work on both applications? I solved the problem by adding my IP address to the Access Hosts list for the database. Fortunately I use a cable modem with a static IP address, but if I were using a dialup with a dynamic IP, would I have to add that IP as an Access Host every time I dialed up? This seems wrong. -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Connecting to Databases
On Tue, 6 Apr 2004 11:18:11 -0400, John W. Holmes wrote: > From: "Robb Kerr" <[EMAIL PROTECTED]> > >> I have found that it is not uncommon when trying to connect to a database >> on an Apache server to get a return similar to "Access denied for user: >> [EMAIL PROTECTED]". I just ran into this problem because I wanted to use >> SQLyog to manipulate a table that already exists on one of my servers. I >> went to the "Connections" document that Dreamweaver creates and copied all >> of the connection info (host, db, user, password) exactly into the >> connection dialogue of SQLyog. The error message above was returned when I >> tried to connect although I can connect Dreamweaver to the database > without >> problem even though the IPAdress is not listed as part of the username. > > With MySQL, a user is given permission to connect with a specific username > and password _and_ from a specific host. When you run the script from > Dreamweaver, is it on the same machine as SQLYog? You probably just need to > modify your MySQL user to have permission to connect from "IPAddress". > > ---John Holmes... Unfortunately, SQLyog and Dreamweaver reside on the same machine. Should I create a new user for the database which is "[EMAIL PROTECTED]"? Why would SQLyog require this while Dreamweaver does not? And, why doesn't identical connection information work on both applications? -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Connecting to Databases
I know that this message is more related to MySQL than PHP but I don't know of a good MySQL board. This board is VERY active and useful. As most of us, I use a variety of programs to produce my HTML/PHP/MySQL. I have run into this problem several times on a variety of programs so thought I'd post and see if anyone had the answer. I have found that it is not uncommon when trying to connect to a database on an Apache server to get a return similar to "Access denied for user: [EMAIL PROTECTED]". I just ran into this problem because I wanted to use SQLyog to manipulate a table that already exists on one of my servers. I went to the "Connections" document that Dreamweaver creates and copied all of the connection info (host, db, user, password) exactly into the connection dialogue of SQLyog. The error message above was returned when I tried to connect although I can connect Dreamweaver to the database without problem even though the IPAdress is not listed as part of the username. What's up? -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySQL Connection Help
Ok, I feel like a complete bonehead because I can't seem to figure this thing out. But, I readily welcome someone making me feel worse by pointing out my simple mistake. I can't get DW to connect to a MySQL database on a new server with which I'm working. I've worked with other servers and haven't had a problem. I'm providing all of the connection and password information so that you can help me - don't worry, I'll change all these once I've solved the problem. BTW, I've also posted this in the Dreamweaver newsgroups but they're not as helpful as this one, so please excuse the fact that this is a ways off-topic. Site URL = http://quinnserver.com FTP URL = ftp.quinnserver.com FTP Username = [EMAIL PROTECTED] FTP Password = password MySQL database = quinn_tempdb MySQL table = addresses MySQL Username = quinn_tempdbuser MySQL Password = password myPhpAdmin provides the following connection script which works... I have built a page which works fine when uploaded to the server... http://quinnserver.com/dbcheck.php Here's my question... What do I enter in DW's Testing Server and MySQL Connection dialogues to be able to use the database and table during the development phase without having to upload the pages to the server? Please confirm the following settings and tell me where I'm wrong or fill in what I've left out. In the Testing Server area of DW's Site Definition dialogue... Server Model = PHP MySQL Access = FTP FTP Host = ftp.quinnserver.com Host Directory = Login = [EMAIL PROTECTED] Password = password In the MySQL Connection dialogue... Connection Name = QuinnServer MySQL Server = User Name = quinn_tempdbuser Password = password Database = quinn_tempdb I apologize for the "newbieness" of this question but it's been driving me crazy and I'm sure I'm just missing something simple. Thanx in advance for any help provided. -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] DW Php update record form with menu from another table
I'm using Dreamweaver's "Update Record" form wizard to create a record update page. Most of the fields are "text", one is "file" and I want one of them to be a "menu". The "menu" field should be populated with the fields of another table. Here's the problem... If I leave all of the fields as text input fields, the form works fine. But, as soon as I change the "manufacturers" field to a drop-down menu populated with entries from another table, I get the following error when accessing the page... Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/s/k/user992816/html/RobesonWeb/admin/adminEditSpecials.php on line 106 line 106 reads... > Needless to say, this line is embedded in this Php code to create the drop-down menu... > What's up? These "drop-downs from another table" work fine in "Add" forms. They just seem to crap out in "Update" forms. It was suggested that I needed to create recordsets for both the menu and the rest of the form. I did that and the form still doesn't work. Attached is the entire page for consulting. I've also posted this message on Dreamweaver's newsgroup but haven't been getting any responses so thought I'd see if this group had any suggestions. Thanx, -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org adminEditSpecials.zip Description: Attached file: adminEditSpecials.zip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: DW Php update form where one field is menu from another table
Thanx. I placed there as well, but wasn't getting any responses so thought I'd try this group as it has been invaluable in the past. Finally got a response on the Macromedia group so I'll try that suggestion. -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] DW Php update form where one field is menu from another table
I'm using Dreamweaver's "Update Record" form wizard to create a record update page. Most of the fields are "text", one is "file" and I want one of them to be a "menu". The "menu" field should be populated with the fields of another table. Here's the problem... If I leave all of the fields as text input fields, the form works fine. But, as soon as I change the "manufacturers" field to a drop-down menu populated with entries from another table, I get the following error when accessing the page... Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/s/k/user992816/html/RobesonWeb/admin/adminEditSpecials.php on line 106 line 106 reads... > Needless to say, this line is embedded in this Php code to create the drop-down menu... > What's up? These "drop-downs from another table" work fine in "Add" forms. They just seem to crap out in "Update" forms. Attached is the entire page for consulting. Thanx, -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] JavaScript Newsgroup
What's your favorite JavaScript newsgroup? This group has been invaluable in helping me learn PHP and need the same for JS. Thanx, -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] more proplems with passing arrays
On Sun, 02 Nov 2003 16:33:03 -0500, Lowell Allen wrote: >> I'm trying to pass an array variable from a search page to the results page >> via GET. The $NAMES variable contains an array which is obtained from the >> URL. Per a previous suggestion I've been trying SERIALIZE/UNSERIALIZE but >> can't get the variable to pass correctly. To take a look at my test files >> follow this URL... > > I have success using base64_encode before serializing an array to be passed. > Like so: > > $serial_array = base64_encode(serialize($original_array)); > > Then in the code that gets the serialized array: > > $original_array = unserialize(base64_decode($_GET["whatever"])); > > HTH Lowell, Thank you VERY MUCH for your response. I've been messing with this problem all day and your response was the first one that actually worked. Thanx again, -- Robb Kerr Digital IGUANA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] more proplems with passing arrays
I'm trying to pass an array variable from a search page to the results page via GET. The $NAMES variable contains an array which is obtained from the URL. Per a previous suggestion I've been trying SERIALIZE/UNSERIALIZE but can't get the variable to pass correctly. To take a look at my test files follow this URL... http://www.cancerreallysucks.org/SerializeTest/Search01.htm Attached are the HTM & PHP files. Please take a look and tell me what's wrong. I appreciate any help. I just can't seem to get the seemingly simple thing to work. Thanx, -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org WebDocs.zip Description: Attached file: WebDocs.zip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] passing an array via GET and a hidden form element
I'm trying to pass a variable from a search page to the results page via GET. The $MANUFACTURERS variable contains an array and is obtained from the URL. I've tried the following to no avail... > > Except for the last two entries, in the URL, the others all passed "...&manufacturer%5B%5D=Array..." When analyzing the variable on the results page, I wind up with $manufacturer equaling an array with one element equaling "Array"... Array ( [0] => Array ) Any suggestions? Thanx, -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: passing variables to subsequent pages
Both suggestions were very helpful. But, I've still got a problem. The $MANUFACTURERS variable contains an array. I'm trying to pass this array with either the GET or POST method. I've tried the following to no avail... > > '> //as per Justin's suggestion Except for the last two entries, the others all passed "...&manufacturer%5B%5D=Array..." Any more suggestions? Thanx, -- Robb Kerr Digital IGUANA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] passing variables to subsequent pages
I have a two page search. The first page queries a database and creates a list of MANUFACTURERS from which the visitor can select all, one or multiple entries. The page is submitted via GET to the second page of the search. The second page uses the array of selected MANUFACTURERS to create a selectable list of MODELS from which the visitor can select all, one or multiple entries. This page is then submitted to the results page via GET. The problem is that to correctly query the database for results, I need to get the array of selected MANUFACTURERS to the results page. I'm using a SUBMIT button and don't know how to include this information in the URL being passed. Any suggestions? Thanx, -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] eliminating dupes from MySQL query results
It's not exactly a Php problem, but MySQL and Php seem to be so intertwined and this newsgroup has been so unbelievably helpful that I thought I'd post the question here. I've got a query which returns a group of records. the field which I want to display in a list contains many duplicates. I need to remove all duplicates so that each entry is only displayed once. Another query based upon a selection from this list will display all of the appropriate records. Can anybody help with the syntax? Do I need a loop or is there a MySQL command/function which I am overlooking? Thanx, -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] deleting characters from strings
I feel really stupid posting this but I can't seem to find the correct syntax in the language guide. I have a string which has been progressively built during a FOREACH loop through an array (a SELECT statement in which the WHERE part is built with ORs from the array of entries). The final query winds up with an extra "OR" at the end. I need to simply delete characters (STRLEN($string) - 3) through STRLEN($string). What's the proper syntax? Thanx, -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Php processor and return window
I am just learning PhP. When I was teaching myself Lingo (Macromedia Director's programming language) I found an object called the MESSAGE window quite helpful. This window allowed you to execute little snippets of code and get the results without having to execute your entire script. For instance, you could create a variable and give it a value then run an if/then statement or loop on it and quickly see the results. This is quite convenient when you're learning the language because you can test your syntax line-by-line instead of having the whole script fail and not knowing exactly where the error occurred. Does anyone know about anything like this for PhP? Thanx, -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] multiple entries for a variable passed with GET
I've got a form with a text entry list allowing the visitor to select more than one entry. The multiple entries are passed in the URL properly (see below) but the QUERY is only using the last one listed. What's up? URL being passed... http://www.cancerreallysucks.org/RobesonWeb/robeson1searchB.php?manufacturer=JUKI&manufacturer=REECE&manufacturer=WELDTRON&Submit=Submit Thanx, -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] conditional within SELECT
Here's another newbie question. The SELECT statement below gets its values from the URL of the page. When something is entered for "vKeywords" the SELECT works fine and returns the correct records. However, if nothing is entered for "vKeywords" (which should return all records matching the other criteria), the results are NO records. How do I make the "MATCH (robeson_inv.specs) AGAINST ('vKeywords')" part of the SELECT statement conditional? SELECT robeson_inv.manufacturer, robeson_inv.model, robeson_inv.specs, robeson_inv.qty, robeson_inv.ID FROM robeson_inv WHERE MATCH (robeson_inv.specs) AGAINST ('vKeywords') AND robeson_inv.manufacturer = 'vManufacturer' ORDER BY robeson_inv.model Thanx, -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Favorite Online Language Guide
What's your favorite online Php language guide? I'm a newbie and most interested in a syntax guide. Thanx, -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Query explanation
On Wed, 29 Oct 2003 17:31:26 +0100, Alexander Mueller wrote: > > Exactly. "a" and "s" are referring to the two tables and are assigned in > the FROM clause. You could write the query also without the > abbreviations. > > SELECT state.ID, state.Name, areacode.Code FROM areacode, state > WHERE areacode.State = state.ID > ORDER BY state.Name, areacode.Code > > Alexander Thanx. It looks like I'm actually learning this stuff. hehe -- Robb Kerr Digital IGUANA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Query explanation
I am attempting to hack a tutorial from the Zend site. I have found the tutorial/project to be excellent, but I don't completely understand what's being done in the following Query statement. //query database, assemble data for selectors $Query = "SELECT s.ID, s.Name, a.Code " . "FROM areacode a, state s " . "WHERE a.State = s.ID " . "ORDER BY s.Name, a.Code"; if(!($DatabaseResult = mysql_query($Query, $DatabaseLink))) { print("The query failed!\n"); exit(); } Please explain what's going on in this SELECT statement. I'm assuming that the "s" in "s.ID", the "s" in "s.Name" and the "a" in "a.Code" are variables referring to the table name. "ID", "Name" and "Code" are field names in two different tables. But, I can't find a place where these variables are initiated in the preceding code. I also don't understand what's going on in the FROM statement. "Areacode" and "state" are table names. That I understand. What's with the "a" and "s" following the table names? Is this where the variables are initiated? Thanx for all your help. This newsgroup has been invaluable to my learning process. -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Menu populated based on previous menu
On Tue, 28 Oct 2003 09:52:02 -0800, Pablo Gosse wrote: > Hi Robb. This is exactly what you'll need to do. > > Something like the following, assuming you're populating an array with > user information: > > > <!-- > var users = new Array(); > <?php > $count = 0; > while (!$users->EOF)) > { > echo 'users['.$count.'] = '.$users->fields['username'].chr(10); > $count++; > $users->MoveNext(); > } > ?> > //--> > > > The users array will now be populated with the usernames returned from > your query. > > Cheers, > Pablo > Thanx Pablo. I'll give that a try. -- Robb Kerr Digital IGUANA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Menu populated based on previous menu
I've found some JavaScripts that will do what I require. Here's the question before I get to deeply into hacking the scripts... Can you embed PhP in JavaScript. In other words, the Java requires that arrays be filled. The entries into these arrays need to come from my database which is accessed via PhP. In Java line... new Array() can I embed the PhP... > Thanx, -- Robb Kerr Digital IGUANA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Menu populated based on previous menu
Thanx for the tips. I'll search the JavaScript sites and see what I can come up with. -- Robb Kerr Digital IGUANA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Menu populated based on previous menu
Searched all the sites I could find for this problem to no avail. I have two dropdown menus in a form. The first menu contains a list of MANUFACTURERS obtained from a database. The second contains a list of MODELS also obtained from the database. I want the second menu to be populated based upon the selection in the first. In other words, once a visitor has selected a MANUFACTURER they'll be presented with a list of MODELS that are available from the selected MANUFACTURER. I know how to do the queries, but don't know how to initiate the query and rebuild the second menu when the first selection is made without adding a SUBMIT button and loading a second page. Anyone know how to accomplish this? Thanx in advance. -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] keyword search syntax
On Tue, 28 Oct 2003 19:37:10 +0600, Raditha Dissanayake wrote: > If you put up a full text index on it you can do searches that smell > like a primitive search engine. > > best regards Thanx. The LIKE operator wouldn't work. But, your tip on creating a FULLTEXT index and executing a MATCH... AGAINST command worked like a dream. -- Robb Kerr Digital IGUANA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] keyword search syntax
On Tue, 28 Oct 2003 02:09:06 +, David Otton wrote: > > Personally, I'd normalize that into a keyword table, a record table and a > joining table. > > However, the SQL keyword you're looking for is LIKE > > WHERE field LIKE '%$variable%' I agree. I'd structure the data quite differently. But, I've got the data from a client and at this point I don't have the authority to restructure the database. Thanx for the tip on the LIKE command. Robb -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] keyword search syntax
I've got a field in my database that contains keywords about the particular record. I've got a form with a text entry field for visitors to enter keywords for which they would like to find records whose keyword field contains the words they entered. The submission form assigns the keywords entered to a variable which is passed via GET to the results page. What is the syntax for generating this query. I tried the following but it doesn't work... WHERE field CONTAINS $variableContainingKeywordEntry Can anyone help? Thanx in advance, Robb Kerr - Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PhP/MySQL Search Results code
That was it! Thanx for the help. This board has proven invaluable to me. Robb -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PhP/MySQL Search Results code
Newbie question - please excuse. I'm using Dreamweaver to generate most of my PhP. I have created a search page and am trying to generate the results page. The search form is using the GET function and the form field name is "manufacturer". The following code is generated by DW in the results page... I'm always getting an error when testing the page. The error is... Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /home/s/k/user992816/html/RobesonWeb/TMP4np9nf7zp.php on line 4 The line to which it refers is the line stating, "$vManufacturer_rs_RobesonResultsList = (get_magic_quotes_gpc()) ? manufacturer : addslashes(manufacturer);" Anyone know what the problem may be? Thanx in advance for any help provided, Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Avoiding blank lines in HTML when field is empty
On Thu, 23 Oct 2003 12:46:29 -0500, Robb Kerr wrote: Thanx for all the help. Your suggestions worked beautifully. Robb > I'm a PhP /MySQL newbie so please excuse the simple question. I'm returning > results from a MySQL query on a webpage. My code includes... > > > $row_rsVandyDivAddresses['Last_Name'];?>, $row_rsVandyDivAddresses['Degree']; ?> > > > > , $row_rsVandyDivAddresses['State']; ?> $row_rsVandyDivAddresses['Zip']; ?> > > Phone: > > Email: > > > Here's the problem. Some of the fields are empty (for instance 'Address') > and the way my code is configured a blank line appears in the returned data > when the field is empty. How do I change this code to add a conditional that > only echos the field contents AND the when the field is NOT empty? > > I've tried... > >$row_rsVandyDivAddresses['Address']); ?> > > but don't know how to include the line break in the if statement. > > Any help is greatly appreciated, > Robb -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Avoiding blank lines in HTML when field is empty
I'm a PhP /MySQL newbie so please excuse the simple question. I'm returning results from a MySQL query on a webpage. My code includes... , , Phone: Email: Here's the problem. Some of the fields are empty (for instance 'Address') and the way my code is configured a blank line appears in the returned data when the field is empty. How do I change this code to add a conditional that only echos the field contents AND the when the field is NOT empty? I've tried... but don't know how to include the line break in the if statement. Any help is greatly appreciated, Robb -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php