Jump to content

stu10576

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Everything posted by stu10576

  1. I have a website (program in PHP) and I want to know how many people have visit or view my page. How do I count that. Please reply if you have any cludes, or idea, or where to start to work on it.
  2. check on www.paypal.com
  3. I have the same error like you before, instead of using serialize() and unserialize I am using other way to store data and retrive them out. For example if I have multiple value to store instead of using serialize() and unserialize I do at the query like this INSERT into table( a, b, c) Values( '$x1, $y1, $z1', '$x2,$y2,$z2', '$h')
  4. check on this //**the variable $dbname doesn't match with the $dbName <?php $username = "iiiii"; $password = "iiiiii"; //**the variable $dbname doesn't match with the $dbName below $dbname = "iiiiii"; $hostname = "localghost"; // connect and select the database $conn = mysql_connect($host, $user, $password) or die(mysql_error()); //$dbName doesn't match with the $dbname above $db = mysql_select_db($dbName, $conn) or die(mysql_error()); //Make the Query $query = "SELECT * FROM 1997data ORDER BY MFR"; $result = @mysql_query ($query)or die(mysql_error());//Run the Query if ($result {//If it ran okay display the record //Table header echo '<table align="center" cellspacing="0" cellpadding ="5"> <tr><td align="left"><b>Manufacture</b></td></tr> '; //Fetch and Print while ($row = mysql_fetch_array (result, MYSQL_ASSOC)) { echo '<tr><td align="left">' . $row['mfr'] . '</td></tr> '; } echo '</table>'; mysql_free_result ($result);//Free up resources } else { //if it did not run okay echo '<p>' . mysql_error() . '<br/><br/>Query; ' . $query . '</p>'; //Debugging } mysql_close(); //Close connection ?>
  5. Thanks HuggieBear ! It works
  6. I have 6 records (6 rows in DB). I want to print out 3 recods per page, it works fine. I want to count and print the number that match with the record number, for example on the first page it displays 1.-------(record1) 2.-------(record2) 3.-------(record3) but when I click next it goes to the second page 1.-------(record4) 2.-------(record5) 3.-------(record6) I want it to display 4.-------(record4) 5.-------(record5) 6.-------(record6) Please help ! below is my code: $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); // select database mysql_select_db($db) or die ("Unable to select database!"); mysql_query("SET NAMES utf8"); if (!(isset($pagenum))) { $pagenum = 1; } // create query $query = "SELECT * FROM techNeed where state='Alabama' order by city"; // execute query $data = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); $rows=mysql_numrows($data); $page_rows = 3; //This tells us the page number of our last page $last = ceil($rows/$page_rows); //this makes sure the page number isn't below one, or more than our maximum pages if ($pagenum < 1) { $pagenum = 1; } elseif ($pagenum > $last) { $pagenum = $last; } //This sets range that we will display in our query $max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows; $result = mysql_query("SELECT * FROM techNeed where state='Alabama' order by city $max") or die(mysql_error()); $count=1; while($info = mysql_fetch_array($result)) { $salonName=mysql_result($result,$i,"salonName"); $city=mysql_result($result,$i, "city"); $state=mysql_result($result,$i,"state"); $phone=mysql_result($result,$i,"phone"); echo " <table border='1' cellpadding='1' bgcolor='#D5EAEA' width='900'> <tr><td>$count</td><td>$salonName</td><td >$city </td></tr> <tr><td> </td><td>$state</td><td>$phone</td></tr> </table>"; $i++; $count ++; echo "<br>"; } if ($pagenum == 1) { } else { $previous = $pagenum-1; echo "<b><a href='{$_SERVER['PHP_SELF']}?pagenum=$previous'> << Trở Lại</a> "; } $next = $pagenum+1; for($k = 1; $k <= $last; $k++){ if(($pagenum) == $k){ echo "<b>$k "; } else { echo "<b><a href='{$_SERVER['PHP_SELF']}?pagenum=$k'>$k</a> "; } } if ($next == $last+1) { echo "<b> Hết "; } else { echo "<b><a href='{$_SERVER['PHP_SELF']}?pagenum=$next'>Trang Kế >></a> "; } ?>
×
×
  • 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.