Jump to content

$_GET and Mysql Problem. Please Help!


paulman888888

Recommended Posts

Hi.

 

I have my code and its for a table.

But i would like little script that stores the name in $name and sex in $sex and musictype in $musictype.

I know i dont need the WHILE function because theres only one result. Because i use the WHERE function in Mysql. eg

$result = mysql_query("SELECT * FROM unit4_art WHERE id=$id");

 

Below is my table code which is way to much for what i need

<?php
$result = mysql_query("SELECT * FROM unit4_art ORDER BY id ASC"); 
$i = 0; // setup a counter
echo '<table border="1" width="100%">';
echo "<tr bgcolor='#FFFFFF'><th>ID</th><th>Name</th><th>Sex</th><th>Music Type</th><th>View</th></tr>";
while($row = mysql_fetch_array( $result ))
{
    // alternate class
    $class = ($i%2 == 0) ? '#00FF00' : '#00FF00';
$class2 = ($i%2 == 0) ? '#CCCCCC' : '#999999';

// Print out the contents of each row into a table
echo "<tr bgcolor='".$class2."' onmouseover=\"this.style.backgroundColor = '".$class."';\" onmouseout=\"this.style.backgroundColor = '".$class2."';\">";
echo '<td><center><a href="?where=infoart&id='.$row['id'].'">'.$row['id']."</a></center></td>\n";
echo "<td><center>".$row['name']."</center></td>";
echo "<td><center>".$row['sex']."</center></td>";
echo "<td><center>".$row['music']."</center></td>";
echo '<td><center><a href="?where=viewart&id='.$row['id'].'"><img src="images/buttons/go.png" /></a></center></td>';
echo "</tr>";
    $i++; // increment counter
}

echo "</table>";

?>

 

Thankyou

Paul

Link to comment
https://forums.phpfreaks.com/topic/114082-_get-and-mysql-problem-please-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.