adding data to a mysql table?
Posted: Mon Apr 04, 2005 7:42 am
i've recently embarked on a quest to both learn php& mysql AND do somethng usefull with it (for once... i have a habit of learning programming languages & not finishing what i set out to do with it
)
anyway... i've started coding a search engine
http://oscarent-host-dot.com/search (search "all" to show all 5 entries in the database)
and everything is working fine except... when i made a script for people to submit urls to the database so i don't have to do it manually, the script doesn't add any data to the table... i checked on mysql.com but according to the examples i'm doing it right
btw all database names, table names, passwords, etc are correct...
AND
the 12 at the start of the insert is the primary key for the db... i couldn't figure out how to read the highest existing value & add 1
can anyone please help me

thanks
anyway... i've started coding a search engine
http://oscarent-host-dot.com/search (search "all" to show all 5 entries in the database)
and everything is working fine except... when i made a script for people to submit urls to the database so i don't have to do it manually, the script doesn't add any data to the table... i checked on mysql.com but according to the examples i'm doing it right
Code: Select all
<form name="form1" method="post" action="
<?php
// i'm trying to connect to database: oscarent_titansearch, table: search, with user: oscarent_admin with no password
$dbh=mysql_connect ("localhost", "oscarent_admin", "") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("oscarent_titansearch");
mysql_query("INSERT INTO search VALUES(12,$sitename,$siteurl, $sitedescrip,$keywords) or die('error: ' . mysql_error()");
?>">
<p class="sub"><span class="sub4"><strong>Data For Site Submission to Titan Search: </strong></span><br>
<br>
Site Name<br>
<input name="sitename" type="text" size="50" maxlength="50">
<br>
<br>
Site Address(URL):<br>
<input name="siteurl" type="text" size="50" maxlength="100">
</p>
<p class="sub">Description:<br>
<input name="sitedescrip" type="text" id="textfield" size="100" maxlength="200">
<br>
<br>
Keywords (insert as CSV's eg.[wod, word2, grand]):<br>
<textarea name="keywords" cols="100" rows="6"></textarea>
<input name="imageField" type="image" src="http://www.nike-philips.com/en/images/submit_button.gif" border="0">
</p>
</form>btw all database names, table names, passwords, etc are correct...
AND
the 12 at the start of the insert is the primary key for the db... i couldn't figure out how to read the highest existing value & add 1
can anyone please help me
thanks