Open an URL in default browser with ONE LINE OF CODE!
This code opens the default web browser with the specified url..(Notice the url has to be a PCHar!)
AI
AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Source Code
Uses ShellAPI (Put this in USES)
(Put this into a Button, Etc..)
ShellExecute(0,nil,'Http://www.chasewizz.co.uk',nil,nil,0);
<? php
// Simple chunk of code to take a db query and display it xx entries
// per page, by Matt Whitted (admin@virtuaweb.net).
// Not the cleanest code, but it works.
// Number of entries per page
$per_page = 25;
// You will need to change this. This should be your normal SQL query that
// you use to get the info to be displayed from the db.
$sql_text = ("SELECT * from table");
// Set page #, if no page isspecified, assume page 1
if (!$page) {
$page = 1;
}
$prev_page = $page - 1;
$next_page = $page + 1;
$query = mysql_query($sql_text);
// Set up specified page
$page_start = ($per_page * $page) - $per_page;
$num_rows = mysql_num_rows($query);
if ($num_rows <= $per_page) {
$num_pages = 1;
} else if (($num_rows % $per_page) == 0) {
$num_pages = ($num_rows / $per_page);
} else {
$num_pages = ($num_rows / $per_page) + 1;
}
$num_pages = (int) $num_pages;
if (($page > $num_pages) || ($page < 0)) {
error("You have specified an invalid page number");
}
//
// Now the pages are set right, we can
// perform the actual displaying...
$sql_text = $sql_text . " LIMIT $page_start, $per_page";
$query = mysql_query($sql_text);
while ($result = mysql_fetch_array($query)) {
// This stuff is obviously just an example. This is where you want
// to layout your HTML to display the queries. This loop will run
// once for every entry to be displayed on the current page.
echo $result[email];
echo "<br>";
}
// You will probably want to modify this stuff too. This displays
// the previous, next, and direct links to each page. It is laid out
// VERY plain below, so you will likely want to change it to fit the
// layour of your site.
// Previous
if ($prev_page) {
echo "<a href=\"$PHP_SELF page=$prev_page\">Prev</a>
}
// Page # direct links
// If you don't want direct links to each page, you should be able to
// safely remove this chunk.
for ($i = 1; $i <= $num_pages; $i++) {
if ($i != $page) {
echo " <a href=\"$PHP_SELF?page=$i\">$i</a> ";
} else {
echo " $i ";
}
}
// Next
if ($page != $num_pages) {
echo "<a href=\"$PHP_SELF page=$next_page\">Next</a>
}
?>
Upload
Original Comments (3)
Recovered from Wayback Machine