mrbitsinfo
-
Posts
5 -
Joined
-
Last visited
Never
Posts posted by mrbitsinfo
-
-
good day to all
if have a code like this
<ul>
<li><a href="downloads/<?php echo $row_detail['des1']; ?>"><?php echo $row_detailis['download1']; ?></a></li>
<li><a href="downloads/<?php echo $row_detail['des2']; ?>"><?php echo $row_details['download2']; ?></a></li>
</ul></td>
<td><div align="center">
as u can see i have a database feld DES1 have a name for a file to download and DOWNLOAD1 the file to download my probelm is IF des1 = ".." dont put the link in href
i put something like this but not work
if(des1==".."){
<li><a><?php echo $row_detailis['download1']; ?></a></li>
}else{
<li><a href="downloads/<?php echo $row_detail['des1']; ?>"><?php echo $row_detailis['download1']; ?></a></li>
}
what can be wrong??
TNX in advance
-
i c how can i fix it so it be available in all pages when i click on next or prev links??
-
kinda new in php so hope somebody can help me im about to get mad with this
i have 2 pages index.htm and list_tbl.php
in the index.htm i have a textbox so the customers write what they want to find in my site with a search button like this :
<form id="form1" name="form1" method="post" action="list_tbl.php" target="_blank">
in the list_tbl.php is like this
<?php
$srch = $_POST['prod_search'];
$se = "%";
'$all' = $se.$srch.$se;
$msj="You look for : ";
$msj2=$mensaj.$srch;
$regis=" your search match :";
$regis2=" Items";
$conn = mysql_connect('localhost','root','pass') or trigger_error("tbl_die", E_USER_ERROR);
.
.
.
.
.
works fine if i write 4 example "blue metal" in the index the php page get me
You Look for blue metal Your search match XX items
but if the filter get more then 1 page when i clik in the next link the filter is gone
the "blue metal" string is lost and i have all the items in the table
why the $_post Value is lost after paginate???
1000 TNX
-
i have this simple table browse get me the filter let say 15 items of a table of 74 but after i click in the link forward the filter erase and disply me the all records... waht im doing wrong.... TNX in advance
<img src="images/misc/search.JPG" width="367" height="100" />
<br />
<?php
$strng = $_POST['search:strng'];
$separa = "%";
$all = $separa.$strng.$separa;
$mensaj="U Look for : ";
$mensaj2=$mensaj.$stng;
$regis=" u search get :";
$regis2=" Items";
$conn = mysql_connect('localhost','zerocctv_Admin','password') or trigger_error("almacen", E_USER_ERROR);
$db = mysql_select_db('zerocctv_almacen',$conn) or trigger_error("almacenz", E_USER_ERROR);
$sql = "SELECT COUNT(*) FROM modelos where descrip like '$all'";
$result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR);
$r = mysql_fetch_row($result);
$numrows = $r[0];
$rowsperpage = 10;
$totalpages = ceil($numrows / $rowsperpage);
// get the current page or set a default
if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) {
$currentpage = (int) $_GET['currentpage'];
} else {
$currentpage = 1;
}
if ($currentpage > $totalpages) {
$currentpage = $totalpages;
}
if ($currentpage < 1) {
$currentpage = 1;
}
$offset = ($currentpage - 1) * $rowsperpage;
$sql = "SELECT modelo, paginal,precio,foto FROM modelos where descrip like '$all' LIMIT $offset, $rowsperpage";
$result = mysql_query($sql, $conn) or trigger_error("SQLkk2", E_USER_ERROR);
echo $Mensaj2 ;
echo $regis. $numrows . $regis2 ;
echo "<table width=\50%\ border=\1\ bordercolor=\#0033FF\ cellspacing=\1\">" ;
while ($list = mysql_fetch_assoc($result)) {
echo "<tr>";
echo "<td>><font color='red'>" . $list['model'] . "</font></td>";
echo "<td><font color='black'>" . $list['pagl'] . "</font></td>";
echo "<td><font color='black'>" . $list['prize'] . "</font></td>";
echo "<td><font color='black'>" . $list['pict'] . "</font></td>";
echo "<tr></tr>";
echo "</tr>";
}
echo "</table>";
//****** build the pagination links ******/
$range = 3;
if ($currentpage > 1) {
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=1'><<</a> ";
$prevpage = $currentpage - 1;
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'><</a> ";
}
for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) {
if (($x > 0) && ($x <= $totalpages)) {
if ($x == $currentpage) {
echo " [<b>$x</b>] ";
} else {
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> ";
}
}
}
if ($currentpage != $totalpages) {
$nextpage = $currentpage + 1;
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage'>></a> ";
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages'>>></a> ";
}
?>
link or not link
in PHP Coding Help
Posted
sorry was a misstype
<?php echo $row_detail['des1']; ?>"><?php echo $row_detail['download1']; ?></a></li>
detail is the name of the recordset, desx=the name of the download, downloadx is the file to download.. i have 4 fields for files to sownload but not allways are 4 files to choose so i want to put an if statement before each line so if the field "des1" was equal to ".." theres no file to download so the href tag must not display.... let say
if des1= ".."
echo ..
else
name & link to the file for download
endif