How to add more than one value to a mysql database field
Posted: Fri Jun 13, 2008 10:26 am
Ok guys no more error messages! ;D
You try it out here
I think its connecting with the database even though its not valid code but I'll work on that
So this is my new code in echo.php
Please correct me if i'm wrong but i think my next step in the project is to create a form that will submit data to my database so that I have something to search?
I need to add all of the database field values for genus there are a lot of them. I think about 113 give or take
in this pic I have 4 of them added already.
I know there is a way to past them into my sql and submit them all at one time but I don't know the format. What I would like to do is create the file in a .txt file and then copy and past it to the database once its all compiled.
Is there any way you can give me any example of the code I would need to submit that to the database?
I have also added a species field that will be typed in by my users when they submit a new species into the database. but before I start doing all this I just wanted to check and make sure it was necessary.
Just to explain how the submission form will work you select a genus from the drop down then type in the species name in the text box. Click one of each of the bullet points and click the tarantula submission button.
This is the submission form
I want that to create a new tarantula in my database under the selected genus. Is this adding up?
Thanks so much for all the help and advice.
You try it out here
I think its connecting with the database even though its not valid code but I'll work on that
Code: Select all
<div class="c1">
<table cellspacing="20">
<tr>
<th>Habitat</th>
<th>Humidity</th>
<th>Speed</th>
<th>Size</th>
<th>Location</th>
<th>Aggression</th>
</tr>
<?
include("connect.php");
// now you are connected and can query the database
$request = mysql_query("SELECT * FROM common_traits
WHERE habitat = \"".$_REQUEST['habitat']."\"
AND humidity = \"".$_REQUEST['humidity']."\"
AND speed = \"".$_REQUEST['speed']."\"
AND size = \"".$_REQUEST['size']."\"
AND location = \"".$_REQUEST['location']."\",
AND aggression = \"".$_REQUEST['aggression']."\"");
// loop through the results with mysql_fetch_array()
if ( @mysql_num_rows($row) > 0 ) {
while($row = mysql_fetch_array($result)){
echo "
<tr>
<td>".$row['habitat']."</td>
<td>".$row['humidity']."</td>
<td>".$row['speed']."</td>
<td>".$row['size']."</td>
<td>".$row['location']."</td>
<td>".$row['aggression']."</td>
</tr>
";
}
} else {
echo "<tr><td colspan = 6></td></tr>";
}
// don't forget to close the mysql connection
mysql_close();
?>
</table>
<a href="http://www.tarantuladatabase.com/assets/pages/search.html"><input name="Back" type="button" value="Back" /></a></div>
</div>I need to add all of the database field values for genus there are a lot of them. I think about 113 give or take
in this pic I have 4 of them added already.
I know there is a way to past them into my sql and submit them all at one time but I don't know the format. What I would like to do is create the file in a .txt file and then copy and past it to the database once its all compiled.
Is there any way you can give me any example of the code I would need to submit that to the database?
I have also added a species field that will be typed in by my users when they submit a new species into the database. but before I start doing all this I just wanted to check and make sure it was necessary.
Just to explain how the submission form will work you select a genus from the drop down then type in the species name in the text box. Click one of each of the bullet points and click the tarantula submission button.
This is the submission form
I want that to create a new tarantula in my database under the selected genus. Is this adding up?
Thanks so much for all the help and advice.