Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Old July 2nd, 2003, 12:35 PM
cliffmar cliffmar is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 7 cliffmar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
PHP Record Navigation

I have a page that is used to update info. in a MySQL Database. I have used the built in Dreamweaver navigation feature to navigate through records but need a way to input a clientId to get to a particular record without having to use back or next buttons to scroll through 2500 records. Can anyone show me how to do this please?

Reply With Quote
Old July 2nd, 2003, 03:18 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
RE: PHP Record Navigation

select * from My_table where client_id = the_id_I_want

Reply With Quote
Old July 2nd, 2003, 06:30 PM
cliffmar cliffmar is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 7 cliffmar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: PHP Record Navigation

I get the select statement but am not sure how to code the PHP around the statement. Of course I'll nedd a text box and a button,
but what would the action be? PHP_SELF?
or do I need to post it to another page to process it? I'm really new to this and must apoligize for my ignorance. If possible could someone be more specific.

Reply With Quote
Old July 2nd, 2003, 08:36 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
RE: PHP Record Navigation

post the code you are using now to show the db records so I have a better Idea of how you are doing things now.

Reply With Quote
Old July 2nd, 2003, 08:46 PM
cliffmar cliffmar is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 7 cliffmar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: PHP Record Navigation


<?php
$currentPage = $HTTP_SERVER_VARS["PHP_SELF"];

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}

$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}

if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE clients SET FirstName=%s, LastName=%s, Address=%s, City=%s, `State`=%s, PostalCode=%s, PhoneNumber=%s, EmailAddress=%s, Notes=%s WHERE ClientId=%s",
GetSQLValueString($HTTP_POST_VARS['FirstName'], "text"),
GetSQLValueString($HTTP_POST_VARS['LastName'], "text"),
GetSQLValueString($HTTP_POST_VARS['Address'], "text"),
GetSQLValueString($HTTP_POST_VARS['City'], "text"),
GetSQLValueString($HTTP_POST_VARS['State'], "text"),
GetSQLValueString($HTTP_POST_VARS['PostalCode'], "text"),
GetSQLValueString($HTTP_POST_VARS['PhoneNumber'], "text"),
GetSQLValueString($HTTP_POST_VARS['EmailAddress'], "text"),
GetSQLValueString($HTTP_POST_VARS['Notes'], "text"),
GetSQLValueString($HTTP_POST_VARS['ClientId'], "int"));

mysql_select_db($database_cielo_dbcon, $cielo_dbcon);
$Result1 = mysql_query($updateSQL, $cielo_dbcon) or die(mysql_error());

$updateGoTo = "clientupdate.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}

$maxRows_Recordset1 = 1;
$pageNum_Recordset1 = 0;
if (isset($HTTP_GET_VARS['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $HTTP_GET_VARS['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

mysql_select_db($database_cielo_dbcon, $cielo_dbcon);
$query_Recordset1 = "SELECT * FROM clients";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $cielo_dbcon) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

if (isset($HTTP_GET_VARS['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $HTTP_GET_VARS['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;

$queryString_Recordset1 = "";
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
$params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_Recordset1") == false &&
stristr($param, "totalRows_Recordset1") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_Recordset1 = "&" . implode("&", $newParams);
}
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Las Vegas Spa and Salon - Cielo Salon and Spa</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="cielo_style.css" rel="stylesheet" type="text/css" />
</head>

<body background="images/bg3.gif" leftmargin="0" topmargin="0">
<table width="750" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="center"><img src="images/page_top.gif" width="750" height="93"></div></td>
</tr>
<tr>
<td valign="top" background="images/bar_top.gif" class="navigation"><img src="images/top_spacer.gif" width="12" height="13"><strong><a href="index.html">Home</a>
</strong> <strong>|</strong><strong> <a href="spapackage.html">Spa Packages</a>
| <a href="facialtreatments.html">Facial Treatments</a> | <a href="bodycare.html">Body
Care Treatments</a> | <a href="massage.html">Body Massage</a> | <a href="waxing.html">Waxing</a>
| <a href="contact.html">Contact Us</a> </strong></td>
</tr>
</table>
<table width="750" height="588" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="137" height="351" valign="top" background="images/cielo_swoosh_trans.gif" bgcolor="#663333" class="menu">
<div align="center">
<p align="left"><br>
<font color="#FFFFFF"><img src="images/top_spacer.gif" width="8" height="21"></font><a href="info.html#location">Location</a><br>
<font color="#FFFFFF"><img src="images/top_spacer.gif" width="8" height="21"></font><a href="info.html#hours">Hours
of Operation</a><br>
<font color="#FFFFFF"><img src="images/top_spacer.gif" width="8" height="21"></font><a href="info.html#policies">Policies</a><br>
<font color="#FFFFFF"><img src="images/top_spacer.gif" width="8" height="21"></font><a href="info.html#appointments">Appointments
</a><br>
<font color="#FFFFFF"><img src="images/top_spacer.gif" width="8" height="21"></font><a href="info.html#etiquette">Spa
Etiquette</a> <br>
<font color="#FFFFFF"><img src="images/top_spacer.gif" width="8" height="21"><a href="specials.html" target="_self">Special
Offers</a></font><br>
<font color="#FFFFFF"><img src="images/top_spacer.gif" width="8" height="21"></font><a href="products.html">Product
Lines</a> <br>
<font color="#FFFFFF"><img src="images/top_spacer.gif" width="8" height="21"><a href="tour.html">Our
Facilities</a></font><br>
<font color="#FFFFFF"><img src="images/top_spacer.gif" width="8" height="21"><a href="estheticians.html" target="_self">Estheticians</a><br>
<img src="images/top_spacer.gif" width="8" height="21"><a href="stylists.html">Stylists</a><br>
<img src="images/top_spacer.gif" width="8" height="21"><a href="staff.php" target="_self">Staff
Area</a></font></p>
<p><br>
</p>
</div></td>
<td width="613" rowspan="2" valign="top"> <br> <div align="center">
<h3>Update Clients</h3>
<table border="0" width="50%" align="center">

<tr>
<td width="23%" align="center"> <strong><a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>">First</a>
</strong></td>
<td width="31%" align="center"> <strong><a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">Previous</a><br />
</strong></td>
<td width="23%" align="center"> <strong><a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>">Next</a>
</strong></td>
<td width="23%" align="center"> <strong><a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>">Last</a>
</strong></td>
</tr>
</table>
<br>
<font color="#993333"><strong>Showing Record <?php echo ($startRow_Recordset1 + 1) ?> of <?php echo $totalRows_Recordset1 ?></strong></font> </div>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">ClientId:</td>
<td><?php echo $row_Recordset1['ClientId']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">FirstName:</td>
<td><input type="text" name="FirstName" value="<?php echo $row_Recordset1['FirstName']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">LastName:</td>
<td><input type="text" name="LastName" value="<?php echo $row_Recordset1['LastName']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Address:</td>
<td><input type="text" name="Address" value="<?php echo $row_Recordset1['Address']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">City:</td>
<td><input type="text" name="City" value="<?php echo $row_Recordset1['City']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">State:</td>
<td><input type="text" name="State" value="<?php echo $row_Recordset1['State']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">PostalCode:</td>
<td><input type="text" name="PostalCode" value="<?php echo $row_Recordset1['PostalCode']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">PhoneNumber:</td>
<td><input type="text" name="PhoneNumber" value="<?php echo $row_Recordset1['PhoneNumber']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">EmailAddress:</td>
<td><input type="text" name="EmailAddress" value="<?php echo $row_Recordset1['EmailAddress']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td align="right" valign="top" nowrap>Notes:</td>
<td><textarea name="Notes" cols="26" rows="4"><?php echo $row_Recordset1['Notes']; ?></textarea></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">&nbsp;</td>
<td><input type="submit" value="Update Record"></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="ClientId" value="<?php echo $row_Recordset1['ClientId']; ?>">
</form>
<p align="center"><font size="2" face="Geneva, Arial, Helvetica, sans-serif">
2003 Cielo Salon and Spa. All Rights Reserved.<br>
Powered by <a href="http://futurescapedesign.com" target="_self"><u>FutureScape
Design</u></a>.</font> <br>
</p></td>
</tr>
<tr>
<td height="237" valign="top" class="menu" bgcolor="#663333">&nbsp;</td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > PHP Record Navigation


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap