Jump to content

fozze

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by fozze

  1. thank you for helping all sorted now can believe i forgot to add a name attribute :/ grr and as for the dots never even new i needed them :s lol thanks for the help all working now =) Owen
  2. this is probably going to be really simple to fix but i cant figure it out :/ on one page i have a form which uses php to populate a dropdown box, now this form will allow the user to add 1 to the person which was selected in the dropdown box. The code for this looks like this.. <form action="addpoint.php" method="post"> <select> <?php $sql="SELECT id,name FROM man"; $result =mysql_query($sql); while ($data=mysql_fetch_assoc($result)){ ?> <option value ="<?php echo $data['id'] ?>" ><?php echo $data['name'] ?></option> <?php } ?> </select> <input type="submit" value="Add Point"/> </form> the php to process this form looks like this.. <?php $sql="UPDATE man SET points = (points + 1) WHERE name = ('$_POST[name]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "$_POST[name] has been added"; mysql_close($con) ?> The problem i have is that i dont think its pulling the name from the form so therefore it wont effect the database, ive tried the sql like this.. UPDATE man SET points = (points + 1) WHERE name = 'joe' and it works fine, any help would be gratefully received Owen
  3. hmmm.......in that case i might just start again :/ haha thanks for your help
  4. Hi, Hoping someone could help me, im not great at php programming and im trying to implement a search form which searches a sql database but for some reason its not working i keep on getting the following error.. " Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\site\contact\search.php on line 141" Im not sure why this happens and its really starting to bug me now :/ I have to pages to the search feature, one page which contains the <form> and the other with the PHP code.... the form.. <form method="get" action="search.php"> <label>Search Term: <input type="text" id="query" name="query"/> </label> <label> <select name="category" id="category"> <option value="none">Please Select a Type</option> <option value="teamname">Manager Name</option> <option value="manager">Team Name</option> <option value="age">Age Group</option> </select> </label> <input name="Search" type="submit" value="Search"/> </form> the PHP code.. <?php $query=$_GET['query']; $db_host="localhost"; $db_username="root"; $db_password=""; $db_name="info"; $db_tb_name="info"; $db_tb_atr_name=$_GET['category']; mysql_connect("$db_host","$db_username","$db_password"); mysql_select_db("$db_name"); $query_for_result=mysql_query("SELECT * FROM $tb_name WHERE $db_tb_atr_name like '%".$query."%'"); while($data_fetch=mysql_fetch_array($query_for_result)) { echo "<p>"; echo $data_fetch['table_attribute']; echo "</p>"; } mysql_close(); ?> Id be really great full for any light you guys could shed on this for me with thanks, fozze
×
×
  • 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.