Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. $query1 = "(SELECT * FROM specials WHERE sport = '$sport' AND startdate = '$Ddate' AND starttime <= '$Dtime' AND endtime >= '$Dtime') UNION (SELECT * FROM specials ORDER BY id DESC LIMIT 1) LIMIT 1";
  2. try ... print "<tr class='mainrow'><td><A href='message.php?page=1&id=$getthreads3[postid]&catagory=$area'>$getthreads3[title]<br />$name</a></td><td>$getthreads3[author]</td><td>$getthreads3[numreplies]</td><td> <b>$getthreads3[lastposter]</b></td>"; print "</tr>"; } print "</table>"; ?>
  3. you can use in_array() function
  4. if you don't check any checkbox form doesn't post element 'product'
  5. 1st 2nd in CC_test.php ... foreach($_POST['checkbox'] as $value){ //insert data in database, in variable $value is value of checked checkbox ($row[1] from 1st database) ...
  6. try <?php $sql = "SELECT * from XXX where start_search BETWEEN '$nowq_date' AND '$nowq5_date' ORDER BY start_search ASC"; $result = mysql_query($sql,$connection) or die("Invalid query: " . mysql_error()); $previous_date = 0; while ($row = mysql_fetch_array($result)) { $start = $row["start"]; $end = $row["end"]; $date = $row["date"]; if($previous_date === 0){ $previous_date = $date; include ("header.php"); }else if($date != $previous_date){ $previous_date = $date; include ("footer.php"); include ("header.php"); } echo "<TABLE WIDTH='100%' BORDER='0' CELLSPACING='0' CELLPADDING='4'><TR> <TD WIDTH='25%' NOWRAP>$date</TD> <TD WIDTH='20%'>$start</TD> <TD WIDTH='15%'>$end</TD> </TR></TABLE>"; } include ("footer.php"); ?>
  7. try <?php require 'php/tilkobling.php'; $query="SELECT movies.id, movies.name, movies.age_limit, movies.length_time, movies.filmweb, movies.picture, date.id AS date_id, date, time.id AS time_id, time FROM movies JOIN date ON movies.id = date.movie_id JOIN time ON date.id = time.date_id ORDER BY movies.name, date, time"; $result=mysql_query($query); $current_film_name = ""; $current_film_date = ""; $end_table = ""; $bestll = " <tr> <td height='90' align='center' valign='middle'><a href='bestill.html'><img src='../bestill.png' alt='bestill' width='70' height='21' border='0' /></a></td> </tr>"; while($movie = mysql_fetch_assoc($result)) { if ($current_film_name != $movie['name']) { $current_film_name = $movie['name']; $current_film_date = ""; if ($end_table) { echo " <td rowspan='2' valign='top'>$dates </td>"; echo " <td rowspan='2' align='center' valign='top'>$times</td>"; echo " <td rowspan='2' align='center' valign='top'></td>"; echo " </tr>"; echo $bestll; } $br = ""; echo $end_table; $end_table = "</table>"; echo "<table background='bilder/Vindu_oversikt.png' width='764' height='300' align='center' cellpadding='0' cellspacing='0'>"; echo " <tr>"; echo " <td height='29' colspan='7' valign='bottom'> {$movie['name']} </td>"; echo "</tr>"; echo "<tr>"; echo " <td width='204' rowspan='3' align='right' valign='top'><strong></strong><img border='2px' src='{$movie['picture']}' alt='{$movie['name']}' width='190' height='235' /></td>"; echo " <td width='116' align='center' valign='top' bordercolor='#F0F0F0'><span class='style12'>Aldersgrense:</span></td>"; echo " <td width='82' height='6' valign='top'><span class='style12'>Spilltid:</span></td>"; echo " <td width='64' height='6' valign='top'><span class='style12'>Filmweb:</span></td>"; echo " <td width='74' height='6' valign='top'><span class='style12'>Dato:</span></td>"; echo " <td width='84' height='6' align='center' valign='top'><span class='style12'>Klokkeslett:</span></td>"; echo " <td width='138' align='center' valign='top'>Ledige billetter:</td>"; echo "</tr>"; echo "<tr>"; echo "<td height='160' align='center' valign='top'>{$movie['age_limit']} år</td>"; echo "<td rowspan='2' valign='top'>{$movie['length_time']}</td>"; echo "<td rowspan='2' valign='top'><a href='$film_filmweb'>Link</a></td>"; } if ($current_film_date != $movie['date']) { $current_film_date = $movie['date']; $dates = $dates.$br.$current_film_date; } else { $dates .= $br; } $times = $times. $br.$movie['time']; $br = "<br />"; } if ($end_table) { echo " <td rowspan='2' valign='top'>$dates </td>"; echo " <td rowspan='2' align='center' valign='top'>$times</td>"; echo " <td rowspan='2' align='center' valign='top'></td>"; echo " </tr>"; echo $bestll, $end_table; } ?> not tested
  8. echo $goldMatch[0][2], ' - ', $goldMatch[0][5], ' - ', $goldMatch[0][7];
  9. move smallest = numbers[0]; before for loop, and then you can start your loop with 1
  10. try link.php?url=<?php $link1 = 'link' . $cat . $subcat . $post; echo $$link1; ?>
  11. change name from checkbox to checkbox[]
  12. change form patr to <?php $sqlvas = "SELECT * FROM vas ORDER BY vasname"; $resultvas = mysql_query($sqlvas); $rowvas = mysql_fetch_array($resultvas); ?> <TR> <TD><?php IF ($rowvas) { DO { ?> <INPUT TYPE="checkbox" NAME="vas[]" VALUE="<?php echo $rowvas["vasID"]; ?>"><FONT CLASS="normalText"> <?php echo $rowvas["vasname"]; ?> (<?php echo $rowvas["price"]; ?>)</FONT><INPUT TYPE="text" NAME="txtDate[<?php echo $rowvas["vasID"]; ?>]" MAXLENGTH="10" SIZE="15"><BR> <?php } while ($rowvas = mysql_fetch_array($resultvas)); }?> and on submit page try foreach($_POST['vas'] as $id){ echo $id, ' --> ', $_POST['txtDate'][$id]; }
  13. try <?php function show_cat($data, $id = 0, $pre = ''){ echo "$pre<ul>\n"; foreach ($data[$id] as $row){ echo "$pre\t<li>\n\t$pre$row[name]\n"; if (isset($data[$row['id']])) show_cat($data, $row['id'], $pre."\t"); echo "$pre\t</li>\n"; } echo "$pre</ul>\n"; } mysql_connect('localhost','root','') or die(mysql_error()); mysql_select_db('test'); $sql = 'SELECT * FROM categories ORDER BY rank'; $query = mysql_query($sql) OR die(mysql_error()); while ($row = mysql_fetch_assoc($query)) { $data[$row['parent_id'] + 0][] = $row; } show_cat($data); ?>
  14. try <?php $test = 'Array ( [576113096] => Array ( [name] => Nobues [skillintraining] => Fighters [skilllevel] => IV [skillTime] => Array ( [note] => [days] => 2 [hours] => 5 [minutes] => 53 [seconds] => 40 ) [WalletAmount] => 65,508,812.57 ISK ) [1404986087] => Array ( [name] => Lireil Crow [skillintraining] => Astrometric Triangulation [skilllevel] => IV [skillTime] => Array ( [note] => [days] => 1 [hours] => 3 [minutes] => 21 [seconds] => 32 ) [WalletAmount] => 9,177,531.37 ISK ) [217317000] => Array ( [name] => Hansoloo [skillintraining] => Amarr Carrier [skilllevel] => V [skillTime] => Array ( [note] => [days] => 60 [hours] => 22 [minutes] => 26 [seconds] => 33 ) [WalletAmount] => 65,100.15 ISK ) [689240734] => Array ( [name] => Mung Lore [skillintraining] => Torpedoes [skilllevel] => V [skillTime] => Array ( [note] => [days] => 8 [hours] => 9 [minutes] => 30 [seconds] => 3 ) [WalletAmount] => 194,399.22 ISK ) )'; $test = preg_replace('/\( *\[/','([' ,$test); $test = preg_replace('/=> ([^\[)]*) *([\[)])/','=> \'\1\' \2', $test); $test = str_replace("'Array (' ", 'Array (', $test); $test = preg_replace('/ \[/', ', [',$test); $test = preg_replace('/[\[\]]/','\'',$test); eval('$out = '.$test.';'); print_r($out); ?>
  15. change line $test = range(1,20); to $test = $myarray;
  16. <?php $array_1 = array('car', 'truck', 'bicycle'); $array_2 = array('first', 'second', 'third'); extract(array_combine($array_2,$array_1)); echo $first,' - ', $third; ?>
  17. try <?php $test = range(1,20); $test = array_chunk($test, 5); echo "<table>\n"; foreach ($test as $line) echo "<tr>\n\t<td>", implode("</td>\n\t<td>", $line), "</td>\n</tr>\n"; echo "</table>\n"; ?>
  18. or <?php // example data...list and sorting would come from query $list = array('apple','angry','banana','carrot','fickle','8track','_blah','wtf','first','9ball','?something'); sort($list); // example loop...should use while loop for db data // foreach item in the list... $letter = 'A'; echo "#<br />\n"; foreach($list as $item) { // get first char and capitalize $currentItem = strtoupper(substr($item,0,1)); while ($letter <= $currentItem and $currentItem <= 'Z'){ echo $letter, "<br />\n"; $letter++; } echo " - $item<br />\n"; } // end foreach item while (strlen($letter) < 2){ echo $letter, "<br />\n"; $letter++; } ?>
  19. try <?php $check ="<b>Snake</b>"; $sr = array('<b>','</b>'); $re = array('|||<b>','</b>|||'); $string="some of our Pacific Gopher <b>Snake</b> populations receive some gene flow from the Great Basin Gopher <b>Snake</b> (Pituophis catenifer deserticola). The Great Basin Gopher <b>Snake</b> does intergrade with the Pacific Gopher <b>Snake</b> to the north of us in Siskiyou"; $str = explode ('|||', str_replace($sr, $re, $string)); print_r($str); ?>
  20. try <?php // 1st create unselected options $options=""; $query_tableA = "SELECT * from tableA"; $result_tableA = mysql_query($query_tableA); while ($row_tableA = mysql_fetch_array($result_tableA)) { $tableAID = $row_tableA['id']; $tableADesc = $row_tableA['description']; $options.="\t<OPTION VALUE=\"$tableAID\">$tableADesc</option>\n"; } $query = "SELECT `svcIssueCatID1`, `svcIssueCatNotes1`, `svcIssueCatID2`, `svcIssueCatNotes2`,`svcIssueCatID3`, `svcIssueCatNotes3`,FROM `tableB` WHERE `date`=\"".$selDate."\" "; $result = mysql_query($query); while ($row = mysql_fetch_array($result)){ $tableBID[1] = $row['svcIssueCatID1']; $tableBID[2] = $row['svcIssueCatID2']; $tableBID[3] = $row['svcIssueCatID3']; $tableBID[4] = $row['svcIssueCatID4']; $tableBNotes[1] =$row[svcIssueCatNotes1]; $tableBNotes[2] =$row[svcIssueCatNotes2]; $tableBNotes[3] =$row[svcIssueCatNotes3]; $tableBNotes[4] =$row[svcIssueCatNotes4]; for ($i = 1; $i <= 4; $i++); $search = "<OPTION VALUE=\"".$tableBID[$i]."\">"; $replace = "<OPTION VALUE=\"".$tableBID[$i]."\" selected=\"selected\">"; echo "<SELECT name=\"CatID_$i\">\n"; echo str_replace($search, $replace, $options); echo "</SELECT>\n"; echo "<textarea name=\"Notes_$i\" cols=\"50\" rows=\"6\">".$tableBNotes[$i]."</textarea>\n"; } ?>
  21. look JOIN commands in mysql
×
×
  • 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.