Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by sasa

  1. try[code]...
    $num_rows = min($max_num_rows,mysql_num_rows($list_result));
    echo "<table border=\"1\">\n<tr>";
    for ($i = 0 ; $i < $max_num_columns; $i++)
    echo "<td width=197><div align='center'><strong>name/nom + #</strong></div></td><td height=17 width=21><strong>Girl</strong></td><td height=17 width=21><strong>Guy</strong></td>";
    echo "</tr>\n";[/code]
  2. try[code]
    while ($srow = mysql_fetch_array($sresult)) {
    $currentsub = $srow['sub'];
    echo '<tr>
    <td>&nbsp;&nbsp;'.$currentsub.'</td>
    <td>&nbsp;&nbsp;&nbsp;<input name="catsub[]" type="checkbox" id="1" value="'
            .$cat.'$$$'.$currentsub. // or use $crow['id].'$$$'.$srov['id']
            '"><br>
    </td>
    </tr>';
    //echo '<INPUT type="hidden" name="id" value="'.$srow['id'].'">
    //<INPUT type="hidden" name="sub" value="'.$srow['sub'].'">';
    }[/code]an i head [code]$user_id = $_GET['id'];

    if (!empty($_POST['mcsubmit'])) {
    if(isset($_POST['catsub'])) {
    foreach($_POST['catsub'] as $catsub) {
    $cs = explode('$$$',$catsub);
    $category = $cs[0];
    $checked = $cs[1];
    $ssql2 = "SELECT * FROM categories";
    $sresult2 = mysql_query($ssql2) or die ('could not connect');
    $scount2 = mysql_num_rows($sresult2);
    $srow2 = mysql_fetch_array($sresult2) ;
    $category = $srow2['cat_id'];
    echo $category;



    $doquery = mysql_query("INSERT INTO users_sub (user_id, user_sub) VALUES ('$user_id', '$checked')") or die ("could not insert");
    $doquery1 = mysql_query("INSERT INTO users_cat (user_id, user_cat) VALUES ('$user_id', '$category')") or die ("could not insert1");
    $doquery2 = mysql_query("INSERT INTO users_categories (user_id, user_cats, user_subs) VALUES ('$user_id', '$category', '$checked')") or die ("could not insert2");
    }
    }
    }
    ?>[/code]
  3. change to [code]if ($x < $num_records) {
      $y = mysql_result($list_result, $x, 'name');
      $z= "+" . mysql_result($list_result, $x, 'number');
      $col2 = '&nbsp;';
      $col3 = '&nbsp;';
    } else {
      $y = '&nbsp;';
      $z = '&nbsp;';
      $col2 = 'Girl';
      $col3 = 'Guy';
    }
    echo "<td>$y $z</td>";
    echo "<td>$col2</td>";
    echo "<td>$col3</td>";[/code]
  4. add to your qwery ORDER BY casts.yearID
    then set $year1='-456'; or samting that is not posible
    in your print loop after set variable do samthing ike this[code]
    if ($year != $year1){
    $year1 = $year;
    print "<tr><td colspan=\"2\">In $year, $castmember was in the cast with:</td></tr>";
    }
    [/code]
    i make litle changes
  5. change line[code]$result = mysql_query("SELECT COUNT(*) FROM listarchive WHERE date = ".$_GET['date']." AND club = ".$_GET['club']." ");[/code]to[code]$result = mysql_query("SELECT COUNT(*) FROM listarchive WHERE date = '".$_GET['date']."' AND club = '".$_GET['club']."' ");[/code]add some '
  6. or[code]
    $forumz = array(1 => 'Announcements',
                          2 => 'General Discussion',
          3 => 'Newbie Help',
          4 => 'Fun And Games',
          5 => 'Non-Game',
          6 => 'Game Help');
    if ($user[uRank==3]) {
      $forumz[7] = 'Staff General';
      $forumz[8] = 'Staff bug report';
    }[/code]
  7. try[code]
    $query = "SELECT COUNT(employee_num) AS num, location FROM users WHERE userlevel = '1' GRUP BY location'";
    $result = mysql_query($query) or die(mysql_error());
    while ($row = mysql_affected_rows($rwsult))
    echo "<font face='Tahoma' size='2'>There are total of <b>$row['num']</b> employee's in the <b>$row['location']</b> plant</font><br />";
    [/code]
  8. try[code]
    <?php
    mysql_connect("", "", "");
    mysql_select_db("");
    $result = mysql_query('Select count(*) from your_table');
    $num_records = mysql_result($result,0,0);
    $max_num_rows = 48;
    $max_num_columns = 2;
    $per_page = $max_num_columns * $max_num_rows;
    $total_pages = ceil($num_records / $per_page);
    if (isset($_GET['page'])) $page = $_GET['page']; else $page = 1;
    $start = ($page - 1) * $per_page;
    $result = mysql_query("select info from your_table limit $start, $per_page");
    $num_columns = ceil(mysql_num_rows($result)/$max_num_rows);
    $num_rows = min($max_num_rows,mysql_num_rows($result));
    echo "<table border=\"2\">\n";
    for ($r = 0; $r < $num_rows; $r++){
    echo "<tr>\n";
    for ($c = 0; $c < $num_columns; $c++){
    $x = $c * $num_rows + $r;
    if ($x < $num_records) $y = mysql_result($result, $x, 'info'); else $y = '&nbsp;';
    echo "<td>$y</td>";
    }
    echo "</tr>\n";
    }
    echo "</table>\n";
    for ($i=1;$i <= $total_pages;$i++) {
    if ($i == $page) echo " $i "; else echo " <a href=\"?page=$i\">$i</a> ";
    }
    ?>
    [/code]
  9. i use php 4
    if string start with number PHP convert string in this number, if start with no number simbol it convert it in 0 (not '0')
    try[code]
    <?php
    if(12 == '12pm') echo '12 = 12pm '; else echo '12 != 12pm ';
    if (12 == '12 + 6') echo '12 = 12 + 6 '; else echo '12 != 12 + 9 ';
    if(12 == 'pm12') echo '12 = pm12 '; else echo '12 != pm12 ';
    if (100 == '1E2') echo '100 == 1E2'; else echo '100 != 1E2';
    ?>
    [/code]
  10. try[code]
    <?php
    $after = 3; // number of weeks
    $look_day = 4; // 0 is Sun, 1 is Mon etc

    $t=time();
    $d = date('w');

    $after = ($d >= $look_day) ? $look_day - $d + $after * 7 : $look_day - $d + --$after * 7;
    $t_new = $t + 86400 * $after;
    echo date('D d. M Y',$t_new);

    ?>
    [code][/code][/code]
×
×
  • 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.