Jump to content

megaresp

Members
  • Posts

    23
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://seomarketinglondon.co.uk

Profile Information

  • Gender
    Not Telling

megaresp's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Perhaps the browser is set to only accept session cookies? These are cookies that expire when the session (e.g. tab or browser) is closed. And an expire time of zero is how a session cookie is set. Security software (e.g. Zone Alarm) can also be set to munch cookies. If you're using security software, make sure that's not configured to munch cookies. I once had a problem with Internet Explorer 6, where it was fine if I was setting one cookie but couldn't deal with two differently named cookies set by the same page. I doubt any modern browser is as hopeless as IE6 was, but perhaps its worth testing if you get desperate.
  2. PHP's empty function just tells you if a variable is empty, rather than whether or not a string contains all zeros. A zero in a string is character rather than a number, and therefore actually exists (i.e. it's the character zero). What you've literally said is you want to check whether or not an entire column in a database contains any 1s. Put another way, does the following column contain any values > zero? 1. 0 2. 1 3. 0 4. 0 5. 1 6. 0 7. 0 etc... That's something best done via a MySQL query. Let's assume the field in question is named rsArtsCoursesWithOptionsB, and the table is called courses. Run the following query... Select count(*) as postgrad from Courses where rsArtsCoursesWithOptionsB > 0 The value in postgrad will either be null (i.e. no instances of rsArtsCoursesWithOptionsB contain a value > 0), or a number greater than zero. It may be a little more complex than this if you only want to test records for a specific subsection of courses. For example... Select count(*) as postgrad from Courses where rsArtsCoursesWithOptionsB > 0 and courseType = 'English' I made up the field courseType. Your database table will need a similar field that you can use to identify one subset of courses from another.
  3. Have you tried the round() function? Details here... http://php.net/manual/en/function.round.php You can specify precision (# of decimal places - 0 in your case), and whether you want it to round up. down or whatever. I think this will do the job for you.
  4. I'm not entirely clear what you're asking to do here. Have you written a PHP script that updates a database table with data supplied by a form? If so, surely when you return in 2-3 weeks the web page is fetching data from the database and creating the table on the fly? If not, then this is what you need to do. Or perhaps I've misunderstood entirely. It might be useful to see the page you're talking about.
  5. Do you need to embed in this way? After much hair pulling, swearing, cursing and muttering, I decided to start using an open source 3rd party product. I use Flowplayer. See this webpage for an example in the wild. Flowplayer solved the following problems for me across a variety of sites... Users missing the required codec for a particular format Some mac users unable to view windows media player files Some PC users unable to view embedded Quicktime A variety of different formats on one site, requiring extra code able to write the correct embedding code for the file type
  6. I think you'll find this PHP class useful. It provides the code you need to work with an existing email account using pop3. However, you will need more than PHP to replicate something like gmail. You're also going to need to know javascript, CSS, HTML, Ajax and a scripting language for your server's operating system.
  7. Take a look at the html_entities page in the online PHP Manual. Scroll down the page to see many examples. Also, note the handy 'See Also' box. This gives you links to related functions, making it easy to find something that might do a better job for a specific situation. I find the best way of getting access to the info in the online PHP Manual is actually via Google. For example, entering: php html_entities ...brought up the correct page immediately. This makes it easy to find PHP info right from my browser. Very handy.
  8. I think you want a query that counts all the children of a specific category. If so, your query is... select count(*) as tot_cats from category where parent='category.id'; In the above query, replace category.id with the actual id. For example, to count the number of sub-categories (children) of Test2, your query is... select count(*) as tot_cats from category where parent='4'; If you want a count for every category with children, your query is... select catname, count(*) as tot_cats from category where parent > '0' group by catname;
  9. Do you mean an HTML table displayed in a web page? Or a 2D array? If you mean an HTML table displayed in a web page, you can inspect table cells using javascript. If you then want that information passed to a PHP script, you'll either need to submit the data via a form, capture it as its generated and save it to an array or database table, or use Ajax to dynamically save it to a database. If the HTML table is being generated by PHP on the fly, and doesn't change (i.e. no dynamic changing of content going on after the page has been created), you should have PHP capture each cell as it generates it, and save the information in an array. If that information has to survive a page refresh, you'll need to insert in into a back-end database (best) or save it to a text file (worst). Then you can retrieve it from any other page. It would be useful if you could be more specific about what type of table you're referring to, how it's created, and whether or not you're retaining this formation. And perhaps links to a specific example, or post some code.
  10. Cags is right. You're creating multiple forms, but only adding the hidden field to the last of them. It's all to do with your for loop. You need to move the final 2 fields and the closing form tag inside the for loop. That way, you're creating properly constructed forms with an opening and closing form tag. And your hidden fields will be inside each of the forms.
  11. Just to clarify, in this line... > $email_message.= " $lines_array"; ...you are attempting to append the array $lines_array onto the string $email_message. I suggest you use the implode command to create a string from your array, and append that to your string.
  12. Have you tried running the query to see if it works? As for referencing the resulting data, the appropriate manual page is: http://us3.php.net/manual/en/function.mysql-fetch-array.php The comments on this manual page are also very useful.
  13. Hi Cardale Try adding quotes around the variable $ip in the query, as follows... $sql_2 = "DELETE FROM sessions WHERE ip='$ip'"; NOTE: I haven't tested this. My reasoning is the IP address is a string (to MySQL), so must appear in quotes within the query. For example, MySQL would fail name=Bob but pass name='Bob'
  14. I've included a shorter version of the query because it's useful shorthand, especially when you have more then two OR alternatives: SELECT email FROM contacts WHERE sex in ('boy','girl') AND notify = 1 You might also consider making sex a char(1) field and limit it to M or F
  15. I may have misunderstood what you're asking here, but I think what you want is something like this... $day=$_POST['day']; $query="select [whatever columns] from [table name] where avail_mon='$day' or avail_tue='$day' or [and so on]"; I suspect you may be looking for a less verbose way of querying your table. If it were me, I'd find a better way to store available days. In particular, I'd want this to be a single field. For example, I sometimes create text fields and use [] as separators for the individual data. For example: [mon][tue][wed][thu][fri][sat][sun] I might then use the following to show when the user was and wasn't available: [monX][tue][wedX][thu][fri][sat][sun] A query can then inspect a single field to see if the user is available on Monday by searching for [mon]. In the above example, it wouldn't find [mon] (because it's [monX]), thus telling you the user wasn't available that day. Of course, if you need to know all available days or all unavailable days, you'd read the entire field into a variable, explode it, and write a PHP function or method. I suspect there are better ways than this to achieve your result. For example, you use a tinyint and inspect individual bits to see if the user was or wasn't available. But why bother given today's server power? Anyway, I hope this gets you started on a more sophisticated solution.
×
×
  • 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.