Jump to content

Recommended Posts

this below is the idiot error  it submits everything except baby into my database just fine

baby = select box like all the others html is fine

 

<?php
$gender = $_POST['gender'];
$gender1 = $_POST['gender1'];
$Species1 = $_POST['Species1'];
$Species2 = $_POST['Species2'];
$baby = $_Post['baby'];

$query="insert into breeding (gender, gender1, Species1, Species2, baby) values ('$gender','$gender1','$Species1','$Species2','$baby')";
$result = mysql_query($query);
?>

 

 

 

Okay now for the question the code below im trying to add a counter to it but all the fields need to match  so anytime all gender 1 and 2 species 1 and 2 baby match  it adds to a counter and displays

but only if they all  match. Im not sure where to start on that so tips are awesome or instruction since im new to this

 

<?php $query  = "SELECT * FROM breeding";
$result = mysql_query($query);
if (mysql_num_rows($result) > 0)
{
// iterate through resultset
// print article titles
while($row = mysql_fetch_object($result))
{
?>	
<tr>
	<td><?php echo $row->gender; ?>   <?php echo $row->Species1; ?></td>
	<td><?php echo $row->gender1; ?>   <?php echo $row->Species2; ?></td>
	<td><?php echo $row->baby; ?></td>
<td>HERE ID LIKE TO ECHO TOTAL </td>
	</tr>

									<?php
}
}
// if no records present
// display message
else
{
?>
<p>No press releases currently available</p>
<?php
}



?>

 

 

http://box1.host1free.com/~crimso/breeding.php  theres a test link

1. In PHP variables are case-sensitive. $_POST is not the same as $_Post.

2. Don't use multiple rows with all the same values. Add a column that counts how many there are, then set it to 1 (if the values don't exist yet) or increment it (if the values do exist).

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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