Jump to content

DataSpy

Members
  • Posts

    54
  • Joined

  • Last visited

    Never

Everything posted by DataSpy

  1. Thanks, I figured it out I used LIKE and then made the passed variable for all categories %% The query looks like this $query_search_movies = "SELECT movies.movie_main_title, movies.movie_foreign_title, movies.movie_year, movies.movie_catagory, movies.movie_language, movies.movie_country, movies.movie_discs, movies.movie_format, movies.movie_extention, movies.movie_link, notes.notes_id, notes.notes_notes FROM movies LEFT JOIN notes ON movies.movie_notes_id = notes.notes_id WHERE movies.movie_catagory LIKE '$_POST[movie_catagory]' ORDER BY movies.movie_main_title"; $result_search_movies = mysqli_query($con, $query_search_movies) or die(mysqli_error($con)); Thanks for the help!!!
  2. I'm using a drop down menu to get a value to search a mysql db. The problem comes in when they want to search for everything for example in categories, it would be: all categories, comedy, horror, ect... How do I use a WHERE clause to search for everything, I tried * but that doesn't work. Example of my WHERE clause: FROM movies ORDER BY movie_main_title WHERE $row[movie_catagory] = $_POST[movie_catagory]"; Any help would be greatly appreciated, thanks in advance!!!
  3. Thank you!!!
  4. this finds out if the post is empty or not if it's not empty it submits the notes to the notes table and assigns it the notes id if it is empty it just assigns a variable the empty post $drama_notes = mysql_real_escape_string($_POST['drama_notes']); if (!empty($_POST['drama_notes'])) { $insert_notes = "INSERT INTO notes ( notes_notes ) VALUES( '$drama_notes')"; $result_notes = mysql_query($insert_notes) or die(mysql_error()); $drama_notes_id = mysql_insert_id(); } else { $drama_notes_id = mysql_real_escape_string($_POST['drama_notes']); } this just inserts the rest of the data into the db $insert_drama = "INSERT INTO drama ( drama_main_title, drama_romanization, drama_foreign_title, drama_type, drama_discs, drama_episodes, drama_complete, drama_type2, drama_format, drama_extention, drama_subtitles, drama_fansub_group_id, drama_link, drama_notes_id ) VALUES( '$drama_main_title', '$drama_romanization', '$drama_foreign_title', '$drama_type', '$drama_disc_num ' '$drama_disc_type', '$drama_episodes', '$drama_complete', '$drama_type2', '$drama_format', '$drama_extention', '$drama_subtitles', '$drama_fansub_group_id', '$drama_link', '$drama_notes_id')"; $result_drama = mysql_query($insert_drama) or die(mysql_error()); echo "1 record added<br>click <a href=add_drama1.php>here</a> to add another drama!<br>"; here's the mysql table in question CREATE TABLE IF NOT EXISTS `drama` ( `drama_id` smallint(5) NOT NULL AUTO_INCREMENT, `drama_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `drama_main_title` varchar(75) NOT NULL, `drama_romanization` varchar(100) NOT NULL, `drama_foreign_title` varchar(255) NOT NULL, `drama_type` varchar( NOT NULL, `drama_discs` varchar(9) NOT NULL, `drama_episodes` varchar(5) NOT NULL, `drama_complete` varchar(3) NOT NULL, `drama_type2` varchar(11) NOT NULL, `drama_format` varchar(4) NOT NULL, `drama_extention` varchar(3) NOT NULL, `drama_subtitles` varchar(4) NOT NULL, `drama_fansub_group_id` smallint(3) NOT NULL, `drama_link` varchar(175) NOT NULL, `drama_notes_id` smallint(5) DEFAULT NULL, PRIMARY KEY (`drama_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ; it's actually odd, I can insert null values into almost everything that says NOT NULL (I have a form that has some things preselected with drop down boxes). I think I'm having a problem because it's an int column. Thanks for the help!!!!
  5. I have NULL set to Yes and it still doesn't work
  6. I'm trying to insert a empty value into a smallint column but when it inserts it puts a 0 in instead. I echo back the data before it inserts and it's empty, is this possible? Any help greatly appreciated, thanks in advance!
×
×
  • 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.