need some help please
Posted: Mon Feb 28, 2011 7:26 am
Hi its been about a year, since I had to code simple database and php and am stuck I am sure its something small I have over looked
there is one database called lightsclients, table name clients, it shows a query with a url to take to a page that sends the ID of the record so the next page gets the ID from the address bar and is used in the query to pull that specific information out in to the new page, fields
I have attached code really appreciate another set of eyes over this.
page with list and send url
page to get the id and then use in the query online two so the rest of the array pulls information based on that.
there is one database called lightsclients, table name clients, it shows a query with a url to take to a page that sends the ID of the record so the next page gets the ID from the address bar and is used in the query to pull that specific information out in to the new page, fields
I have attached code really appreciate another set of eyes over this.
page with list and send url
Code: Select all
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$sql = "SELECT * FROM clients WHERE type like 'Artist' ";
$clientsNum = '';
$getClients = mysql_query( $sql ) or die( mysql_error() );
while($clients = mysql_fetch_object($getClients) )
{
echo '<p>
<a href="index.php?page=clients&id='.$clients->id.'">'.$clients->name.'</a><br>
</p>';
echo "";
$clientsNum = $clients->id;
}
{
echo mysql_num_rows($getClients) ;
echo " of clients in this section";}
page to get the id and then use in the query online two so the rest of the array pulls information based on that.
Code: Select all
$id=$_GET['id'];
$getAllClients = mysql_query('SELECT * FROM lightsclients.clients WHERE id=".$id." ') or die(mysql_error());
while ($clients = mysql_fetch_object($getAllClients)) {
if (!empty($clients->name)) {
echo "<h5>Name:</h5><p style='color:black;font-weight:100;font-size: 12px;'>" . $clients->name . "</p>";
}
if (!empty($clients->location)) {
echo "<h5>Location:</h5>" . $clients->location . "</p>";
}
if (!empty($clients->bookingagent)) {
echo "<h5>Booking Agent</h5><p style='color:black;font-weight:100;font-size: 12px;'>" . $clients->bookingagent . "</p>";
}
if (!empty($clients->image)) {
echo "<h5>Image</h5><p style='color:black;font-weight:100;font-size: 12px;'>" . $clients->image . "</p>";
}
if (!empty($clients->bio)) {
echo "<h5>Bio:</h5><p style='color:black;font-weight:100;font-size: 12px;'>" . $clients->bio . "</p>";
}
if (!empty($clients->website)) {
echo "<h5> Visit there personal web page</h5><p style='color:black;font-weight:100;font-size: 12px;'>";
echo '<a href="http://'.$clients->website.'">'."click here".'</a></P>';
}
}