Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. change while ($day_num<=$days_in_month) { foreach($working_days as $wd) { if($day_num=$wd) { echo '<td><a href="/book.php?day='.$day_num.'"><font color="darkgreen"> '.$day_num.' </font></a></td>'; } //end if else { echo "<td> $day_num </td>"; } //end else } //end foreach to while ($day_num<=$days_in_month) { //foreach($working_days as $wd) { if(in_array($day_num,$working_days)) { echo '<td><a href="/book.php?day='.$day_num.'"><font color="darkgreen"> '.$day_num.' </font></a></td>'; } //end if else { echo "<td> $day_num </td>"; } //end else //} //end foreach
  2. try <?php $ads = array ( 'ad-stt-weddings-elisha-orin-photography', 'ad-stt-weddings-brandi-mays-videographer', 'ad-stt-weddings-sugar-and-spice-artistry', 'ad-stt-weddings-weddings-the-island-way'); shuffle($ads); $count = 0; $max = 2; foreach ( $ads as $ad ) { if ($count++ >= $max) break; WriteContent($ad); } ?>
  3. just use $query = "DELETE FROM tgl_users WHERE team_id = '".$_GET['team_id'] ."'";
  4. if you want to save data you must use database, isn't it
  5. try to cange form to <? // Connect database. $host="localhost"; // Host name. $db_user="test"; // MySQL username. $db_password="test"; // MySQL password. $database="test"; // Database name. mysql_connect($host,$db_user,$db_password); mysql_select_db($database); // Select all data records in table "name_list" and put them into $result. $result=mysql_query("select * from Players"); ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form id="form1" name="form1" method="post" action="playerupdate.php"> <table border="1" cellpadding="3" cellspacing="0"> <td align="center" bgcolor="#FFCC00"><strong>Clan</strong></td> <td align="center" bgcolor="#FFCC00"><strong>Name</strong></td> <td align="center" bgcolor="#FFCC00"><strong>GP</strong></td> <td align="center" bgcolor="#FFCC00"><strong>Scores</strong></td> <td align="center" bgcolor="#FFCC00"><strong>Kills</strong></td> <td align="center" bgcolor="#FFCC00"><strong>Deaths</strong></td> <td align="center" bgcolor="#FFCC00"><strong>SPG</strong></td> <td align="center" bgcolor="#FFCC00"><strong>KPG</strong></td> <td align="center" bgcolor="#FFCC00"><strong>K/D</strong></td> <td align="center" bgcolor="#FFCC00"><strong>FA</strong></td> <td align="center" bgcolor="#FFCC00"><strong>FC</strong></td> <td align="center" bgcolor="#FFCC00"><strong>FP%</strong></td> <td align="center" bgcolor="#FFCC00"><strong>MVP</strong></td> </tr> <? // Fetch record rows in $result by while loop and put them into $row. while($row=mysql_fetch_assoc($result)){ $id = $row['Player']; // if 'Player' is primary key of your table ?> <tr> <td bgcolor="#FFFFCC"><input name="ClanName[<? echo $id; ?>"] size="4" type="text" id="<? echo $row['ClanName']; ?>" value="<? echo $row['ClanName']; ?>" /></td> <td bgcolor="#FFFFCC"><input name="Player[<? echo $id; ?>"] size="15" type="text" id="<? echo $row['Player']; ?>" value="<? echo $row['Player']; ?>" /></td> <td bgcolor="#FFFFCC"><input name="GP[<? echo $id; ?>"] size="4" type="text" id="<? echo $row['GP']; ?>" value="<? echo $row['GP']; ?>" /></td> <td bgcolor="#FFFFCC"><input name="Scores[<? echo $id; ?>"] size="4" type="text" id="<? echo $row['Scores']; ?>" value="<? echo $row['Scores']; ?>" /></td> <td bgcolor="#FFFFCC"><input name="Kills[<? echo $id; ?>"] size="4" type="text" id="<? echo $row['Kills']; ?>" value="<? echo $row['Kills']; ?>" /></td> <td bgcolor="#FFFFCC"><input name="Deaths[<? echo $id; ?>"] size="4" type="text" id="<? echo $row['Deaths']; ?>" value="<? echo $row['Deaths']; ?>" /></td> <td bgcolor="#FFFFCC"><input name="SPG[<? echo $id; ?>"] size="4" type="text" id="<? echo $row['SPG']; ?>" value="<? echo $row['SPG']; ?>" /></td> <td bgcolor="#FFFFCC"><input name="KPG[<? echo $id; ?>"] size="4" type="text" id="<? echo $row['KPG']; ?>" value="<? echo $row['KPG']; ?>" /></td> <td bgcolor="#FFFFCC"><input name="KD[<? echo $id; ?>"] size="4" type="text" id="<? echo $row['KD']; ?>" value="<? echo $row['KD']; ?>" /></td> <td bgcolor="#FFFFCC"><input name="FA[<? echo $id; ?>"] size="4" type="text" id="<? echo $row['FA']; ?>" value="<? echo $row['FA']; ?>" /></td> <td bgcolor="#FFFFCC"><input name="FC[<? echo $id; ?>"] size="4" type="text" id="<? echo $row['FC']; ?>" value="<? echo $row['FC']; ?>" /></td> <td bgcolor="#FFFFCC"><input name="FP[<? echo $id; ?>"] size="4" type="text" id="<? echo $row['FP']; ?>" value="<? echo $row['FP']; ?>" /></td> <td bgcolor="#FFFFCC"><input name="MVP[<? echo $id; ?>"] size="4" type="text" id="<? echo $row['MVP']; ?>" value="<? echo $row['MVP']; ?>" /></td> </tr> <? } // End while loop. ?> </table> <input type="submit" name="Submit" value="Update" /> </form> </body> </html> and 2nd page to <? if($_POST['Submit']){ // If receive Submit button variable. $host="localhost"; // Host name. $db_user="test"; // MySQL username. $db_password="test"; // MySQL password. $database="test"; // Database name. mysql_connect($host,$db_user,$db_password); mysql_select_db($database); foreach ($_POST['Player'] as $id => $Player){ $ClanName = $_POST['ClanName'][$id]; $GP = $_POST['GP'][$id]; // etc. mysql_query("UPDATE Players SET ClanName='$ClanName', GP='$GP' WHERE Player='$id'"); } echo "--- Update Complete ---"; } ?>
  6. try <link rel="stylesheet" type="text/css" href="style.css" /> <br><br> <form action='info.php' method='POST' name='myform'> <input type='text' name='code' size='16' align='center'> <a href='javascript: document.myform.submit()' type='submit'> <img src='Go.png' align='center' border='0' /> </a> </form> <br><br><br><br><br> <b><font family='arial'>Warning: Best viewed in Google Chrome</font></b>
  7. try <?php $input = "a:10 b:20 c:30 a:50 b:60 c:70 a:150 b:160 c:170"; preg_match_all('/c:(\d+)/',$input,$out); print_r($out); ?>
  8. try <?php if (isset($_GET['id'], $_GET["delete"]) && is_numeric($_GET['id']) && $_GET['delete'] =="true")//This line gets the value and reads it { $prod_id = (int) $_GET['id']; unset($_SESSION["product"][$prod_id]); $_SESSION["product"] = array_values($_SESSION["product"]); header ('Location: products.php?cat=1'); } ?>
  9. try <?php if (!isset($_SESSION['checked'])) { $_SESSION['checked'] = array(); } $_SESSION['checked'] = array_values(array_merge($_SESSION['checked'], $_GET['new_checked'])); ?>
  10. variable $row_post_list is NOT setup in function you must past it via functions parameters or make it global
  11. <style type="text/css"> .mnt {margin-left:30;} .date {margin-left:60; float:left; display:inline;} .text {} </style> <?php include("connect.php"); $getbookings = mysql_query("SELECT * FROM phpbb_posts WHERE forum_id='10' ORDER BY post_subject DESC"); $topcid = $_GET['topic_id']; $checkbookings = mysql_num_rows($getbookings); if($checkbookings==0) { echo 'No Bookings Yet'; } else { $year = ''; $mont = ''; while($row = mysql_fetch_assoc($getbookings)) { $y = substr($row['post_subject'], 0, 4); $m = substr($row['post_subject'], 5, 2); if ($y != $year){ echo "<div class='year'>$y</div>\n"; $year = $y; echo "<div class='mnt'>$m</div>\n"; $mont = $m; } if ($m != $mont){ echo "<div class='mnt'>$m</div>\n"; $mont = $m; } $date = date('l jS F Y', strtotime($row['post_subject'])); echo '<div class="date">'.$date.' - </div><div class="text">'.nl2br($row['post_text'])."</div>\n"; } } ?>
  12. try <?php $test = array(1 => array('text' => 'england', 'count' => 2), array('text' => 'scotland', 'count' => 5), array('text' => 'wales', 'count' => 1) ); echo '<pre>',print_r($test), '</pre><hr />'; function my_compare($a, $b){ if ($a['count'] == $b['count']) return 0; return $a['count'] < $b['count'] ? 1 : -1; } uasort($test, 'my_compare'); echo '<pre>',print_r($test), '</pre><hr />'; ?>
  13. take look at http://www.allsyntax.com/tutorials/PHP/24/Building-a-Comments-Script/1.php
  14. you can order by random with seed see mysql manual http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#function_rand
  15. <?php $the_month = '12'; //Set as August $the_year = '1999'; //Set as 1999 $temp = $the_month+1; $the_next_month = str_pad($temp>12 ? $temp-12 : $temp,2,'0',0); $the_next_year = $temp>12 ? $the_year+1 : $the_year; echo $the_next_month,'-',$the_next_year; ?>
  16. or foreach ($a as $k => $v) { $a[$k][] = count($v); }
  17. try <html> <head> <title>Two-dimensional Arrays</title> </head> <body> <h1>Two-Dimensional Arrays</h1> <?php $Rockbands = array( array('Rockband', 'Song 1', 'Song 2', 'Song 3'), array('Beatles','Love Me Do', 'Hey Jude','Helter Skelter'), array('Rolling Stones','Waiting on a Friend','Angie','Yesterday\'s Papers'), array('Eagles','Life in the Fast Lane','Hotel California','Best of My Love') ); ?> <table border="1"> <?php foreach($Rockbands as $Rockband) { echo '<tr>'; foreach($Rockband as $item) { echo "<td>$item</td>"; } echo '</tr>'; } ?> </table> <hr /> <?php $Rockbands1= array(); foreach ($Rockbands as $i => $Rockband){ foreach ($Rockband as $j => $value) $Rockbands1[$j][$i] = $value; } echo '<table border="1">'; foreach($Rockbands1 as $Rockband) { echo '<tr>'; foreach($Rockband as $item) { echo "<td>$item</td>"; } echo '</tr>'; } ?> </table> </body> </html>
  18. ... WHERE calUser='$username' AND calDate>NOW() ...
  19. <?php echo " <a href='{$_SERVER['PHP_SELF']}?currentpage={$nextpage}&name=", $_POST['name'], '&zipcode=' , $_POST['zipcode'] , '&state=' , $_POST['state'] , '&food_types= ' , $_POST['frmSearch']['food_types'][0], !isset($_POST['frmSearch']['offerings']) ? "" : ('&offerings= ' . $_POST['frmSearch']['offerings'][0]) . "'>></a> "; ?>
  20. in your function local variables ($username, ...) isn't declare
  21. try <html> <head> <title>Ad List</title> <style type="text/css" media="all">@import "style.css";</style> </head> <body> <?php include 'database.inc.php'; $query = "SELECT *, GROUP_CONCAT(`note` SEPARATOR '</div><div id=\"notes\">') AS note1 FROM ads LEFT JOIN notes ON ads.id = notes.aid GROUP BY ads.id"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)) { echo '<div id="container">'; echo '<h2>'.$row['advertiser'].'</h2>'; echo '<p>'.$row['salesExecutive'].'</p>'; echo '<form action="notes.php" method="post">'; echo '<input type="hidden" name="aid" value="'.$row['id'].'">'; echo '<label for="notes">Notes</label> <br />'; echo '<textarea name="note" rows="2" cols="100">'; echo '</textarea><br /><br />'; echo '<input value="Submit" type="submit">'; echo '</form>'; echo '<div id="notes">'.$row['note1'].'</div>'; echo '</div>'; } ?> </body> </html> btw in HTML id attribute is unique
  22. add element to array $error[] = 'Username Bob was taken'; $error[] = 'passwords didn't match'; etc. empty array $error = array(); count array count($error);
×
×
  • 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.