sasa
-
Posts
2,804 -
Joined
-
Last visited
-
Days Won
1
Posts posted by sasa
-
-
try to change read to `read`
-
try[code]
while ($srow = mysql_fetch_array($sresult)) {
$currentsub = $srow['sub'];
echo '<tr>
<td> '.$currentsub.'</td>
<td> <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] -
change to [code]if ($x < $num_records) {
$y = mysql_result($list_result, $x, 'name');
$z= "+" . mysql_result($list_result, $x, 'number');
$col2 = ' ';
$col3 = ' ';
} else {
$y = ' ';
$z = ' ';
$col2 = 'Girl';
$col3 = 'Guy';
}
echo "<td>$y $z</td>";
echo "<td>$col2</td>";
echo "<td>$col3</td>";[/code]
-
change
Make payments with PayPal - it's
to
Make payments with PayPal - it\'s -
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 -
call function before echo, thet set variable
-
try[code]echo '<a href="title.php?id_parent='.$result['title'].'"> ' . $result['title'] . ' </a>';[/code]
-
you have $row[0] and $row['subject']
try print_r($row); -
must be[code]if( isset($_POST['page']) && !empty($_POST['page']) && ctype_digit($_POST['page']) ){[/code]
-
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 '
-
add [code]if (isset($_POST)) foreach ($_POST as $k => $v) $$k = $v;[/code]
after 1st '<?php' (line 12) -
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] -
try[code]
select year*10000+month*100+day as date where date > 20060601[/code] -
try to change
<form method='post' action='edit.php'>
to
<form method='post' action=''>
or
<form method='post' action='edit.php?shirt_id=$shirt_id'> -
OK i find the error
try[code]
echo "<option value=\"$row2[asset_type]\"";
if(isset($_POST['asset_type']) AND in_array($row2[asset_type], $_POST['asset_type'])) print " selected = \"selected\"";
echo ">$row2[asset_type]</option>";[/code] -
try[code]
echo "<option value=\"$row2[asset_type]";
if(isset($POST['asset_type']) AND in_array($POST['asset_type'], $row2[asset_type])) print "selected = \"selected\"";
echo "\">$row2[asset_type]</option>";
[/code] -
or[code]
<?php
function i2b ($a){
$i = -1;
while (($x = pow(2,++$i)) <= $a) if ($a & $x) $out[$i] = $x;
return $out;
}
$out = i2b(55);
echo array_sum($out),' = ',implode(' + ',$out);
?>
[/code] -
sorry i make mistake row[code]while ($row = mysql_affected_rows($rwsult))[/code]must be[code]while ($row = mysql_fetch_array($result))[/code] not $rwsult ???
-
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] -
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 = ' ';
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] -
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] -
You compare number with string
PHP convert string into number and it is equak 0
try[code]
if ($data == "data1") { $rowNum = "$row"; }
[/code] -
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] -
insert in form
[code]
<input type="hidden" name="page" value="sermonsarvhice">
[/code]
pagination question
in PHP Coding Help
Posted
$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]