02-18-2009, 06:48 AM
|
#3 (permalink)
|
|
The Visitor
Join Date: Feb 2009
Posts: 4
Thanks: 0
|
Thank you for all your help.
This is what I have achieved with your suggestions.
It's nearly there BusinessName displays BusinessStreet 1 result and BusinessStreet displays BusinessName.
Next stage will it update?
Code:
<HTML>
<HEAD>
<TITLE> The Edit Directory Listing</TITLE>
<HEAD>
<BODY>
<?php
$dbcnx = @mysql_connect("localhost", "username", "password");
if (!$dbcnx) {
echo( "<P>Unable to connect to the" .
"database server at this time.</P>" );
exit();
}
//select which database you want to edit
mysql_select_db("aynsley_phpbb1",$dbcnx);
if (! @mysql_select_db("aynsley_phpbb1") ) {
echo( "<P>Unable to locate the regdir " .
"database at this time.</P>" );
exit();
}
// Request the text of all the business names
$result = mysql_query(
"SELECT BusinessName FROM regdir");
if (!$result) {
echo("<P>Error performing query: " .
mysql_error() . "</P>");
exit();
}
//mysql_query(<query>, <connection id>);
while ($row=mysql_fetch_array($result)) {
list ($BusinessStreet, $BusinessName) = $row;
}
// Request the text of all the business names
$result = mysql_query("SELECT * FROM regdir");
if (!$result) {
echo("<P>Error performing query: " .
mysql_error() . "</P>");
exit();
}
// Display the text of each BusinessName in a paragraph
while ( $row = mysql_fetch_array($result) ) {
list ($BusinessName, $BusinessStreet) = $row;
}
?>
<html>
<body>
<form method="post"action="<?php echo $PHP_SELF ?>">
Business Name:
<input type=text name="BusinessName" value="<?PHP echo $BusinessName ?>"><br>
Business Street:
<input type=text name="BusinessStreet" value="<?PHP echo $BusinessStreet ?>"><br>
<input type=submit name="submit" value="submit">
</form>
</BLOCKQUOTE>
</BODY>
</HTML>
I have two queries going on one is not working no errors
Is there a simple method to read a complete row from 1 ID field
|
|
|
|