Search the Community
Showing results for tags 'php echo'.
-
this is my php code for my profile.php. it is to display the users name after login. <?php session_start(); require "connect.php"; if($_SESSION['name']) { $name = $_SESSION['name']; $query = mysql_query("SELECT name FROM register WHERE name ='$name'"); $numrows = mysql_num_rows($query); if(1 == $numrows) { while ($rows = mysql_fetch_assoc($query)) { echo "Welcome, ".$rows['name']."!"; } } } ?> i want to display this: while ($rows = mysql_fetch_assoc($query)) { echo "Welcome, ".$rows['name']."!"; } between some html. ive tried but it isnt working. this is the code i did: <?php if(1 == $numrows) { ?><?php while (@$rows = mysql_fetch_assoc(@$query))?><h3><?php echo "Welcome, ".@$rows['name']; ?><?php }?> i tried: <?php while (@$rows = mysql_fetch_assoc(@$query))?><h3><?php echo "Welcome, ".@$rows['name']; ?> but both doesnt work. as in only "Welcome, " is displayed in my page. any pointers is much appreciated!
-
Hello i am getting nothing printed on the page using this code, just a blank page is showing. Can any body help me out from this issue : <?php if (!ini_get("register_globals")) { import_request_variables('GPC'); } //E?C?? ??I C?E? CEO E? $phpver = phpversion(); if ($phpver < '4.1.0') { $_GET = $HTTP_GET_VARS; $_POST = $HTTP_POST_VARS; $_SERVER = $HTTP_SERVER_VARS; } $phpver = explode(".", $phpver); $phpver = "$phpver[0]$phpver[1]"; if ($phpver >= 41) { $PHP_SELF = $_SERVER['PHP_SELF']; } class Pager { function getPagerData($numHits, $limit, $page) { $numHits = (int) $numHits; $limit = max((int) $limit, 1); $page = (int) $page; $numPages = ceil($numHits / $limit); $page = max($page, 1); $page = min($page, $numPages); $offset = ($page - 1) * $limit; $ret = new stdClass; $ret->offset = $offset; $ret->limit = $limit; $ret->numPages = $numPages; $ret->page = $page; return $ret; } } // get the pager input values $page = $_GET['page']; $limit = 50; $result = mysql_query("select count(*) from dada where category='Music'"); $total = mysql_result($result, 0, 0); // work out the pager values $pager = Pager::getPagerData($total, $limit, $page); $offset = $pager->offset; $limit = $pager->limit; $page = $pager->page; // use pager values to fetch data $query = "select * from dada order by id DESC category='Music' limit $offset, $limit"; $result = mysql_query($query); $num=mysql_numrows($result); ?> <?php $i=0; while ($i<$num) { $id=mysql_result($result,$i,"id"); $name=mysql_result($result,$i,"name"); $image=mysql_result($result,$i,"image"); $category=mysql_result($result,$i,"category"); $linkdown=mysql_result($result,$i,"linkdown"); $pubsite=mysql_result($result,$i,"pubsite"); $description=mysql_result($result,$i,"description"); $os=mysql_result($result,$i,"os"); echo "<b><u><font size=\"4\">$name</font></u></b><br><font size=\"3\">$description</font><br><a href=\"$pubsite\" rel=\"nofollow\"><font color=\"#060d45\"><b>Publisher WebSite</b></font></a> <a href=\"$linkdown\" rel=\"nofollow\"><font color=\"#060d45\"><b>Download</b></font></a> <hr>"; $i++ ; } ?> music.php
- 4 replies
-
- print probelm
- echo
-
(and 1 more)
Tagged with: