Jump to content

marcconlon

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

marcconlon's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi there. From the code, it appears that there is a loop running to validate that any selected values begin with the letters CHAN. On line 3 - the code snippet - substr($key, 0, 4) is saying - "evaluate the first 4 characters beginning with charater 0 for the phrase CHAN". I guess you could add an "OR" statement to allow for ALL CHANNELS or alternatively, set the value for All CHannels to "Channels - ALL" (thereby satisfying the evaluation of the 1st 4 characters to = CHAN). To go for option 1 (above) - add the following code "|| substr($key, 0, 12) == "ALL CHANNELS" right after "Chan" on line 3. To go for option 2 - amend the earlier HTML code so that it reads "<input type=checkbox name="Channels All" id="All"><label for="All Channels">All Channels</label>"
  2. Hi dstaton Hopefully, I've understood correctly - here goes....... In the code you have supplied, there is a loop running. This starts at the "while" statement and is enclosed with { and }. So, by inserting yoru additional code "outside" this loop - you ensure it is only interated once. Also, assuming you only wish to "hard code" the final "All Channels" option - you can use HTML. So, after the } ?> code at the end (which ends the loop and moves from PHP back to HTML..... <input type=checkbox name="All" id="All"><label for="All Channels">All Channels</label> You can obviously modify the required values of checkbox name etc to suit the code execution when the form is submitted - but, hopefully this gets across the general idea.
  3. Hi there Relative PHP newbie here - really struggling with this one - so any help appreciated! I've always written mySQL queries within each PHP script I write - I'm now trying to get "intelligent" by re-using mySQL queries by referencing them as functions (and passing the Result row back) So, I have a simple mySQL query along the lines of "SELECT * FROM Transactions WHERE CustomerID = 'x''" (the 'x' is passed to the function as a variable - eg - get_customer_transactions(x). This all works fine, to a point. I now want to "return" the array (mysql_fetch_row or mysql_fetch_asscoc) back to the main script - this is the piece I am not getting right. I've seen (and tried) various suggestions such as return $MyArray and return array($MyArray) but they don't seem to be working for me. Could somebody provide a "code demo"? Thanks Marc
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.