determine if a number is even or odd in php

Hello

work on a site that uses php and mysql. on one page, I pull data from a database and put it in a table. data on scientific articles, and so I have the following fields: id (unique to each row), title, author, content type (contains the url to the PDF) and size. When I run it, the background of the whole picture is white. I want it so that each row of the table alternates between having a light gray and a white background. I thought looking in my loop to see if the $i variable is even or odd. using an if statement so $i is even, the background is gray, if $i is odd, the background is white. How can I do this and I'm on the right track or is at - it an easier way to do this? Here's the code. IM new to php and mysql. Thank you!!

.oO (jmack159)

> so I tried, and there isn't enough work. I get this error: Parse error:
> parse error in c:\program www\publications.php on line 64 files\easyphp1-8\. any
> suggestions?

Yep - correct the error. ;)

> $is_even = ($i % 2)

There is a missing semicolon.

Micha

Tags: Dreamweaver

Similar Questions

  • How to know if a number is even or odd

    Hello

    I need to know if a number is even or odd.

    ¿Does anyone how to proceed or if there is a function in Ora10G to solve this problem?

    Thx for your time!

    Hello

    Use the MOD function:

    SQL> select mod(13,2) from dual;
    
     MOD(13,2)
    ----------
             1
    
    SQL> select mod(14,2) from dual;
    
     MOD(14,2)
    ----------
             0
    

    If MOD(num,2) is even when a zero is returned.

  • Help me determine the revision number [Studio 1537]

    Dell Studio 1537 laptop (IE. 2009)

    I'm trying to determine what replacement lid, hinges and the bezel I should order for fix up of my old Studio before I sell it.  I know that I should be able to disassemble and read labels to find out what revision it is, but staff repair Dells exchanged so many parts around during the process when I had sent in their I don't know what are the original parts, or where I could look at to determine what revision number, I would need with the current configuration.  Any advice would be appreciated.  Read on for more details...

    The problem

    The bezel fits the cover properly, but not around the screen.  It covers the bottom edge and one side of the screen by about 1/8 ", although there is a black area exposed on the top edge and the opposite side.  Basically, it seems that the lcd screen is not properly aligned inside the cover, but I removed the bezel to fix it myself to see that the screen is mounded and well aligned.  After some research I remember reading something on the various revisions of the Studio 15 series, using different parts, which are not all compatible between them, but I don't know if the cover is the cause of the problem, or have the bezel bad for this cover... or if these parts are, but the LCD is bad for both.  so the last however-many-years, I lived with the screen out of the Center.

    To add more complications to the problem, I know that there are several other parts changed to a time or an other (see below for details), so cannot be sure that, if necessary, are original.  The only part I feel confident comes from my original CD is the lower cover that has the number of Service and other info stickers on.  It's all a big cover tho, so it could easily had been changed from one unit to another.  So with that taken into account, indeed, I know not what is original and what is not, or what part should I use to find the correct revision number and get the replacement parts for the cover right.

    Any ideas where I could look to find the revision number of right for the parts that are on it now?  My best guess is that I should see exactly what LCD is in it and go from there.  I think that since it is the only part that I want to keep the cover Assembly, so I should try to match everything to her.  I'm pretty sure that any revision of the lid will be attached to the base without problem, but again, I don't know that for sure.  If no indication would be greatly appreciated.

    History

    I had to sent to Dell warranty to correct the anomaly of the hinge that was common with these models of Studio, but when I got back, they put a bunch of parts wrong inside.  The glasses fit properly around the screen, the keyboard was not backlit, the hard drive has been the ability of bad, and they changed the rest-wrists/trackpad "marbled" design that was used on previous models.  I had to send it back to them 3 times, before they managed to return to me with especially good pieces in total.  It is in his possession or in transit to or from, for a total of about 3 months before I finally just gave up.

    During this episode, they even called to say that my motherboard need replaced due to damage fluid and that the USB ports were broken, and that it would cost me ~ $350 to fix because it was due to an abuse of the user, so not covered by the warranty.  The laptop works perfectly when I sent it, other than the hinge, and I knew without doubt that fluid had never been spilled on it, and that the USB ports had never given me any problems.  I had to be very strict with them, that I wanted to just hinge replaced, and that if she didn't start and run when I came back, I was going to throw it in the trash, where it belonged and buy a new one, but another company.  As far as I know, these "problems" were never "fixed".  Needless to say, this is the last product of Dell, I bought.

    But back to the point... Then, when they finally got it back to me with only the evil bezel (or lcd panel, or cover... whatever the cause of the problem), and the different style of the palmrest, I said "close enough" and admitted that if I wanted to use the computer, anytime soon, I have to settle with the best effort of incompetent repair staffs and it was her.  So that the how her since then, but at this point, Ive got a new laptop and I would now like to fix their screw-up if I can sell it without taking a hit to his condition.  And in case you were wondering, Yes, the same hinge is broken in the same way, once again, so I need to correct this defect in the design and get the screen/bezel adapted with a correct alignment.  Covers a bit scuffed, so I thought I would buy just a set cover so it is good condition for sale.

    Thank you for taking the time to read and for all the advice

    Okay, so I got parts, and all is right with the world again. Haha. I spent less than $ 20 on a brand-new couvercle lid with hinges, buttons power WLAN, antennas and a new scope.  I had to share my webcam and small green card that defines along the lower part of the cover.  Bezel fits my screen.  Actually ended up getting a cover of art 'Algae' instead of the plain of black or color... the covers of art were actually the cheapest option.  Parts from eBay.

    So here's the rub:. It turns out that the revision number is not relevant.  The items are sorted by part number (P/N), and apparently they used slightly different parts from one year to the other, at least for some parts. Judging from my experience, I would say anyone who attempted to repair game p/n with the same series as you have currently ensure the good editing.

    My 1537 takes a lid of the P600X series (original was P613X, black; replacement is P602X, algae).  Although it looks like any cover would fit, I noticed that the antenna leads on other series were in front of the yew, mine. They were grouped in the same pair, just ran into the lid on opposite sides. It seems that the antenna could possibly be traded around to match the original, but I can't say for sure. It is also possible that the son would still be able to be channelled through the computer and connected to network for both cards, but once again, it is purely speculation on my part.

    The bezel seems to vary depending on what LCD is equipped.  Apparently, there was at least 2 variations, a CFL and LED, backlight as well as changes in the proportions (not sure if these changes are correlated with the backlight, or if these are yet another set of alternatives to consider, as I was not to replace the LCD screen).  From what I understand they have connectors that are different, based on the backlight.  I think mine uses the latest LED backlight, but still once, don't look too far in the screens, it is just the impression I got, and assumes that it is the original Panel, and that Dell did not change with other variants.

    As the bezel, it seems to be the series a bit out there. The injector suitable for my laptop is M135C, although Dell had replaced the original by a M138C, which covers the bottom and left edges of the screen while exposing a black area of the outter screens on the top and side edges straight. The differences are very difficult to detect without having them both in hand to compare, choose different parties based on their appearance is not the way to go.

    Therefore, in summary, I believe that the combination is for my 1537...

    COVER: P600X series

    : LED backlighting

    BEZEL: M135C

  • ASM: determine the total number of bytes read/written & Ops / s

    Hello

    My environment:

    • Oracle 11.2.0.3 EE
    • SuSE Enterprise Linux 11 SP1, 64-bit
    • ASM starts on RAW LUNS (2 per group) Hitachi disk storage
    • DB-server: HP DL380 G7

    I want to disc ASM ssd drive switch, direct attach to via HP DS2700 attachment:

    • DiskGroup + DATA
      5x400GB Enterprise SSD, RAID 5, 1.6 TB of raw capacity
      used to redo, data files
    • DiskGroup + ARCH
      4x400GB Enterprise SSD, RAID0 + 1, capacity of 800GBraw
      used to redo, Archives, Flash Recovery Area

    As I understand until this SSD technology, SSD have a livetime, indicating that there is a guaranteed amount of data that can be read/written on this subject. My goal is to design a system that has no point of two ssd failure in the same RAID group.

    1. How can I determine the total number of bytes read/written in ASM starts so far?
      My idea was to dermine ASM block size (select block_size from v$ asm_diskgroup) and then look at total reads and writes columns via iostat command in asmcmd. I guess that these values are since the last start of the DSO.
    2. Is it possible to determine the IOPS / sec per diskgroup?

    Thank you
    SCSI

    Casimir wrote:

    Do the calculation for 1. gives me an odd result:

    ASMCMD disk group management controls said that the default view is the amount of bytes and that the -io parameter must be used to display the number of e/s instead.

  • Determine the Total number of images in a loaded SWF file

    I used the loader class and the load method to load a swf file that has multiple frames.  Does anyone have a suggestion how to determine the total number of frames in the SWF file script after loading?

    AFTER loading is complete (that is to say, use a listener), you can access the content property of the loader (cast as a movielcip):

    MovieClip (yourloader.content) .totalFrames;

  • Is there a direct way to know if a number is even

    I did this to search if the number is even. But is there a Boolean manner to find.

    n = 5;

    outn ((n/2-math.ceil(n/2) < 0)) {}

    {n = mathfloor (math.random) * 10}

    It returns me a value n between 0 and 10.

    But if I just n = math.floor (math.raNDOM) * 10 and

    check if n/2 == number &! = int;

    How can I do this kind of career...

    var n = 5

    trace ((n%2) == 0)

  • Even or odd number or workstations

    Hi, I have a form put in place where people can enter the information in my database. the thing I want to do is I want to summarize all positions and whether that post the results to an amount of odd or of posts.
    for example:
    Jim entered - this weather is beautiful 1/odd - jim post will be odd
    Tom entered - I can't stand the Sun its too hot outside. 2/even - tom post will be same
    Entered Jessica-[NULL] I like cloudy days the best. 3/odd - jessica post will be odd

    If anyone knows how I can do this, can you please help me? Thanks in advance.

    After insertion, download the new # of messages


    even

    odd

  • Route filteration based on either even or odd network number

    I want to block the roads from the networking of odd numbers announced in my router. Example, I want to enable same roads of the 150.100.x.0 where x is 16,18,20,22,24. Thank you

    Use this:

    access-list 1 permit 150.100.0.0 0.0.254.0

    See you soon,.

    Paresh.

  • Random number generator. Even and odd numbers

    I have a problem.

    I have a generator of random numbers, it goes from 0 to 20, I need to have two indicators, we show you how many numbers are pairs, and how much isn't.

    I tried to table D use the decimated 1, but as these numbers are random, it doesn´t works for me. I m new with LabView and I Don t know if there is another way to make it work, I need help, especially with a few examples.

    Thank you very much.


  • Identification of even and odd Page

    If possible, I need help please,

    Here is a script so resolute, simplified to show the basics I adjust to operate at a complete script.

    This script is totally insufficient, but I have no idea how do work, if the page is odd then alert 'Odd Page', and so even then alert 'Same Page'.

    pgNum = app.activeDocument.sections [0] .pageNumberStart

    If (pgNum == 1) {alert ('odd Page')};

    ElseIf (pgNum == 2) {alert ('same Page')};

    Must be running on unique Pages (and not facing Pages) so cannot use the 'PageSideOptions.RIGHT_HAND' or 'PageSideOptions.LEFT_HAND '.

    Thanks a lot for any help, Brendan

    Hi Brendan,

    According to the doc, the Section.pageNumberStart property is "valid only when continue the numbering is false," then you must rely on Section.pageStart instead.

    Now, given a Page, you have two useful properties,

    • Page.Name is a string that is the name of the page, which means usually only the page number (but it depends on the Section.pageNumberStyle.)
    • Page.documentOffset is the sequence of the page in the document index (while Page.index is the index within the spread, not relevant here.)

    Assuming that Page.name is correct for your project, simply interpreted as a number, then, to check if pgNum % 2 is 0 or 1.

    var pg = app.activeDocument.sections[0].pageStart,
        pgNum = parseInt(pg.name,10),
        side;
    
    if( isNaN(pgNum) )
    {
        alert( "Page name can't be parsed as an integer." )
    }
    else
    {
        side = (pgNum%2) ? "Odd " : "Even ";
        alert( side + " Page" );
    }
    

    @+

    Marc

  • How to determine the part number of replacement fan

    How can I determine what fan I need to order for a Pavillion DV6 age of 4 years. Fan is wearing out I think. He snores and hums, but if I hit the computer it stops for awhile. Sounds very mechanical.

    I'd rather do not disassemble the laptop until I have the replacement in hand.

    Hello

    We cannot say because we do not know what is your Pavilion DV6.  Please follow the instructions below to find the product/model of your machine:

    http://support.HP.com/us-en/document/c00033108

    Normally, you can use the product/model of your machine and look for Maintenance and Service of Guide or party store. No product/code number, impossible to get the right part.

    Kind regards.

  • Determine the Version number

    Hello

    In the JDE, we can define the version number applications (by going into properties, then on Version :), I was wondering if there is a way to determine version number of the application that you programmatically entered here?)  There are classes that allow you to do this?

    Thank you

    Solved please use

    ApplicationDescriptor.currentApplicationDescriptor () .getVersion)

  • even and odd numbers with level

    Hi Master,

    I tried to display numbers with level like that...

    Select the level from dual connect by level < = 10;

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    How to display odd and even numbers with level. I tried with mod(level,0) but does not work very well.

    Please notify.

    Concerning

    SA


    Odd:

    Select 2 * level - 1 from dual connect by level<>

    /

    2 * LEVEL 1
    ----------
    1
    3
    5
    7
    9

    Scott@ORCL >

    Still:

    Select 2 * double connection by level<>

    /

    2 * LEVEL
    ----------
    2
    4
    6
    8
    10

    Scott@ORCL >

    SY.

  • Help! Change to purge/margins of the even and odd pages in the same file?

    I'm outlining a children's book and the printer requires domestic files to be submitted in the unique layout (borderless). The binding margin side and bleed is different from upper, lower and the outer edges - essentially the pages reflect each other. How can I set up the document so even pages have a configuration option and odd pages have the mirror settings (without lining up as faced with pages in spreads)?

    When you make the book use facing Pages in the Document format. This will give you the Master Pages to a mirroring, called "facing pages".

    When you make the PDF using file > export and choose PDF but do not check the option 'Spreads '.

  • Selection of the same Page even or odd

    Is there a typical way to set all odd in a document pages, as it is well that all the same.

    I have scripts (with the help of these forums) that the page turns on the current page

    example:

    var crtpage = this.pageNum
    var crtpagerotate = this.getPageRotation({nPage:crtpage});)
    try {}
    this.setPageRotations ({nStart:crtpage, nEnd:crtpage, nRotate:(90+crtpagerotate)%360});})
    }
    catch (e)
    {
    App.Alert ("processing error:" + e)
    }

    But I would like to be able to rotate all of the 90 odd pages and all pages 270

    Any help is appreciated

    the variable 'i' will be your number of page, so this should be what you want (not tested)

    for (i = 0; i< this.numpages;="">
    {

    if(i % 2) {}

    var crtpagerotate = this.getPageRotation({nPage:i});)
    this.setPageRotations ({start: i, nEnd: i, nRotate:(270+crtpagerotate)%360});})
    }
    else {}
    var crtpagerotate = this.getPageRotation({nPage:i});)
    this.setPageRotations ({start: i, nEnd: i, nRotate:(90+crtpagerotate)%360});})
    }
    }

Maybe you are looking for

  • (HP Pavilion g6) Audio devices are not installed

    Hello I can't watch my audio devices.  "No audio device is installed" appears in my sound Manager.  I clicked and ensured that I can show disabled devices.  Is it possible to reinstall the audio device for my laptop HP?  Also, is there something to c

  • HP Pavilion 15 laptop: help! HP Pavilion laptop charger works not properly.

    Hey! My laptop charger is malfunctioning. We all know that if a device is unplugged and use it permanently, it will possibly miss fees.  If the problem is when my charger is plugged in, it do not charge the cell phone or laptop to run out of charge i

  • KB2656362 ERROR CODE 800 B 0100

    I tried to install the update above but got error 800b0100 code. Tried the fix it and downloaded the recommended tool but the update does not install. Help, please

  • New arrival 11 Pro, question?

    This post has 2 parts, a question and a problem: (processor core i5 4 GB, 128 GB drive) First of all, the question is the place of sessions 11 pro high-dimmable to 8.1 of Windows Pro via the propack? Secondly, I had a problem where when the device go

  • BlackBerry software and restart okay

    Hello, I bought a Q10 and downloaded the software link blackberry yesterday. When I started the Setup, my computer started an installaionprocess after a while, he stopped and restarted again. After that, I couldn't find a new software without a new i