Jump to content

Jessica

Staff Alumni
  • Posts

    8,968
  • Joined

  • Last visited

  • Days Won

    41

Posts posted by Jessica

  1. Well, you can't do that... That means key => value.

    Maybe make a class, then an array of instances of it and loop through there.

    Or for a simpler version,
    [code]
    $person = ('name'=>'andrew', 'age'=>21, 'loc'=>'UK');
    $people[] = $person;
    $person = ('name'=>'joe', 'age'=>23, 'loc'=>'USA');
    $people[] = $person;

    foreach($people AS $person){
      $age = $person['age'];
      $name = $person['name'];
      //etc...
    }
    [/code]
  2. If you want something to change after the page has loaded, you need javascript. It's okay, it doesn't bite too hard.

    I don't know if PHP can create animated gifs - I know it does gifs, but the animation I don't know about. The only other option I see is to make an animated gif counting down.

    Just use javascript ;)
  3. If you upload a zip, that is ONE file. If you upload an image, that is ONE file. It does not matter how many files were in the zip, it is now ONE file. Treat it as such.

    If you then want to extract the images, you'll probably need some sort of add-on.
  4. You're calling the query twice. Remove the first one.

    [code]
    echo "<table border=\"1\" width=\"100%\" id=\"table3\">\n" . "<tr>\n" . "<td>Storm ID</td>" . "<td>Status</td>" . "<td>Updated</td>" . "<td>Valid On</td>" . "<td>Conditions</td>" . "<td>Location</td>" . "<td>Likelihood</td>" . "<td>Risk</td>" . "<td>Alert Mode Consideration</td></tr>" . "<tr><td>1</td>";
    $q = mysql_query("SELECT * FROM `swc_alertanalysis`") or die (mysql_error());
    while($row = mysql_fetch_assoc($q)) {
        //Is status a field in your table? If so...
        $status = $row['status'];
        if ($status == 'active') {
            ...
    [/code]
    Now you need to know WHY.

    Please go read some of the tutorials. Seriously. They're written for a reason.

    You can clean up your html several ways. First, you don't need to keep concatenating strings. You can have one long string.
    You can even close your PHP and just write HTML.

    [code]
    <table border="1" width="100%" id="table3">
      <tr>
          <td>Storm ID</td>
          <td>Status</td>
          <td>Updated</td>
          <td>Valid On</td>
          <td>Conditions</td>
          <td>Location</td>
          <td>Likelihood</td>
          <td>Risk</td>
          <td>Alert Mode Consideration</td>
      </tr>
    <?
    $q = mysql_query("SELECT * FROM `swc_alertanalysis`") or die (mysql_error());
    while($row = mysql_fetch_assoc($q)) {
        //Is status a field in your table? If so...
        $status = $row['status'];
        if ($status == 'active') {
            ...
    [/code]
  5. This is the code you posted.
    [code]echo "<td align=center bgcolor=red><font face=Arial color=#FFFFFF>VERY LIKELY</font></td>";
    }
    if(mysql_num_rows($q) == 0) { echo "<tr><td align=center bgcolor=gray><font face=Arial color=#FFFFFF>-</font></td><td align=center bgcolor=gray><font face=Arial color=#FFFFFF>INACTIVE</font></td></tr>"; }
    ") or die(mysql_error());
    ?>[/code]

    You don't see how this:
    [code]") or die(mysql_error());[/code]
    is not valid code? What do you think this does?
    You were supposed to put that on the end of your query. Instead you put it at the end of your code.

    This symbol: " starts and ends a string. So, you have a STRING being started on that line and it never ends. So php can't compile the code.

    Just remove the line. I'm not trying to be rude, but you need to take a minute and read through the code and say, okay, what does this do? Is this causing the error? If I comment out this line, does the error still occur? Ok, it doesn't, so this is the line that is causing this error. Oh wait, this line doesn't make any sense.
  6. Look at the code you posted last. Do you see anywhere where you have a string beginning a line and you never close it? A string is surrounded by quotes. Look at the line right above your closing tag. I know you are a beginner which is why you need to understand what the code means, not just let us keep fixing it for you :)

×
×
  • 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.