Jump to content

ginerjm

Members
  • Content Count

    4,840
  • Joined

  • Last visited

  • Days Won

    63

ginerjm last won the day on July 27

ginerjm had the most liked content!

Community Reputation

233 Excellent

2 Followers

About ginerjm

  • Rank
    Handball player
  • Birthday 03/23/1952

Profile Information

  • Gender
    Male
  • Location
    Voorheesville NY

Recent Profile Visitors

57,909 profile views
  1. I build small folders of trip pics and add caption files (.txt) to the same folder. Then as I loop thru the image files to display them I also check for files with the same basenames but a .txt extension and display that along with the pic.
  2. The glob function is correct. Try the manual. It will tell you more.
  3. Create a drop down list of the services. When the user picks one from the list go back to the php script with that choice and the id number and build the url from an array of them keyed by the items in that dropdown list. Then use a header() call to go to their website.
  4. Took an attempt to clean up your code. See if this reads better for you. Note the subtle changes I have made here to help you understand what you are doing better. echo "<form action='' method='post' id='add_edit_reservation_form'>"; if (isset($reg_id)) { echo "<input type='hidden' name='action' value='update_reservation' /> <label>Reservation ID:</label> <input type='text' name='reg_id' value='$reg_id'/>"; } else { echo "<input type='hidden' name='action' value='add_reservation'/> <label>User_ID</label> <input type='text' name='ms_user_id' value='" . $user_info['ms_user_id'] . "'>"; } echo "<label>Which room would you like?</label> <select name='room_id'>"; foreach ($room_ids as $room_id) { if ($room_id['room_id'] == $reservation['room_id']) $selected = 'selected'; else $selected = ''; echo "<option $selected value='" .$room_id['room_id'] . "'>" . $room_id['room_name'] . "</option>"; } echo " </select><br> <label>What date would you like to reserve your room?</label> <input type='date' name='reserve_date' value='" . $reservation['reserve_date'] . "'> <br> <label>Please submit form to reserve your room.</label> <input type='submit' value='Submit'> </form> "; //********************************** // Functions below //********************************** function update_reservation($room_id, $reg_id, $reserve_date) { global $db; $query = 'UPDATE reservations SET room_id = :room_id, reserve_date = :reserve_date, WHERE reg_id =:reg_id'; try { $statement = $db->prepare($query); $statement->bindValue(':room_id', $room_id); $statement->bindValue(':reserve_date', $reserve_date); $statement->bindValue(':reg_id', $reg_id); $row_count = $statement->execute(); $statement->closeCursor(); return $row_count; } catch (PDOException $e) { $error_message = $e->getMessage(); display_db_error($error_message); } } Now - what doesn't work?
  5. I stopped reading when I saw this: This suggests a very bad database design. Joining multiple values and placing them all into one record is not the way to store data. This should really be done by making multiple related records in a separate table, linked to the main record for the user/item/primary key so that you can then easily do queries for these data values. Your current design/approach prevents this from being easily done.
  6. What does your html look like for this input tag? When I research the $_FILES array I get the following as the elements: name tmp_name size type error I get no "upload" element. I can only assume that 'upload' is the actual NAME of your input tag so you have to add another index to your grab to get the value you actually want. Such as $_FILES['upload']['name'];
  7. Yes - you have corrected the syntax errors of your first two posts and are now referencing that item properly. Now you just have to follow the other good advice you are receiving.
  8. This line: $startingFolder = '$_FILE[upload]'; is TOTALLY incorrect. In fact you are assigning the following text value "$_FILE[upload]" to the variable $startingFolder. If you added this line echo $startingFolder; following the above line you would see: $_FILE[upload] instead of what you expect to see. Move the quotes to where they should be.
  9. As well as putting your array indices in quotes as in $_FILE['upload']
  10. Your english isn't making sense to me. Are the images being saved as files in a folder or are they in a "db"?
  11. I think we gave you what you asked for. And more. My array suggestion is just a (imho) better way of connecting the values to the parms.
  12. It is since the parms are not 'user input' but simply values that your script produced. FYI - you can avoid the bind-param calls if you simply create an array of your parms and their values like this: $parms = array( 'min_price' => $min_price, 'max_price' => $max_price, 'featured' => $featured); $find_records-> execute($parms); allows for easier maintenance later on and avoids all of the bind-param calls.
  13. See if this makes sense to you. <?php /* ****************************** script name description of what this does end of comments ********************************* */ session_start(); error_reporting (E_ALL ^ E_NOTICE); include "includes/db.php"; $query = "SELECT videoid, titulo, url_video from videos"; $result = mysqli_query($connection, $query); $num_per_page =05; $table_data = " <table border='1' width='100%'> <tr> <th>Video Id</th> <th>Titulo</th> <th>Video</th> </tr> "; while (list($videoid, $titulo, $url_video) = mysqli_fetch_row($result)) { $table_data .= " <tr> <td>$videoid</td> <td>$titulo</td> <td>$url_video</td> </tr>"; } $table_data .= " </table> <br> "; $query = "SELECT * from videos"; $pr_result = mysqli_query($connection, $query); $table_data .= "Results found: " . mysqli_num_rows($pr_result); // // Now output the html data including the generated data above. // echo $html=<<<heredocs <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link href="style.css" rel="stylesheet" type="text/css" /> <link href="tablefiestas.css" rel="stylesheet" type="text/css" /> <title>La Taverna de Juan</title> </head> <body> <div id="container"> <div id="header"> <!--MENU BAR--> </div> <!--VIDEOS--> $table_data <br> <div id="footer"> <!--FOOTER--> heredocs; // echo $html; // include "includes/footer.inc.php"; echo " </div> </div> </body> </html> "; exit(); I may have not inserted the table data in the correct place in your html block but I'm sure you can place it in the correct spot if not.
  14. 1 - Yes! Stop going in and out of php mode. Learn how to code better. 2 - How about those echos you buried in the td statements? They look a bit different from your other lines doing similar things. Add a semi.
  15. Do you ever read your code when you write it? "delete records where user_id = a date value?" I thought user ids were integers like 1,2 or 3 as you used earlier. Now they are date values?
×
×
  • 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.