PHP - To Dispaly An Image On Selecting The Item From The Select Box
In my php site i have a select button.On selecting an item from the select box ,the corresponding picture should be displayed in the <img>,from the mysql database.
This is not happening with the following code <form name='abc' method='post'> <select name="std_name" onChange="this.form.submit();"> <option value="...Select...">...Select...</option> <option value="Adam">Adam </option> <option value="Amanda">Amanda</option> <option value="Angel">Angel </option> <option value="Brewier">Brewier</option> <option value="Butle">Butler </option> <option value="Carrie">Carrie </option> </select><br /> <?php if(isset($_POST['submit'])) { $aname1=$_POST['std_name']; $sql1="select * from std where name='$aname1'"; $result=mysql_query($sql1); while($n=mysql_fetch_row($result)) { echo $n[2]; echo "<img src='$n[2]' width='118' height='133' name='std/>";} } ?> <img src="Adam.jpg" width="118" height="133" name="std"/><br /> </form> Similar Tutorialshello, i have this simple problem, how can i point to an item in a menu so that it shows the correct page i'm currently visiting? for example, i have this menu : Code: [Select] <div class="submenu"> <div class="submenu-head">Products</div> <ul> <li class="first-item current"> <a tabindex="1" class="first-item current" href="index.php">Products</a> </li> <li> <a tabindex="1" href="add_product.php"> Add new Product </a> </li> </ul> </div> where class="first-item current" points to the current page i'm visiting (i.e Products is highlited) so when i visit another page (add_product.php) i want to do this Code: [Select] <div class="submenu"> <div class="submenu-head">Products</div> <ul> <li > <a tabindex="1" href="index.php">Products</a> </li> <li class="first-item current"> <a tabindex="1" class="first-item current" href="add_product.php"> Add new Product </a> </li> </ul> </div> the usual way i solve this problem is by using a switch statement Code: [Select] switch($header_title) { case "index": echo "<div class="submenu"> <div class="submenu-head">Products</div> <ul> <li class="first-item current"> <a tabindex="1" class="first-item current" href="index.php">Products</a> </li> <li> <a tabindex="1" href="add_product.php"> Add new Product </a> </li> </ul> </div>"; break; switch "add_product": echo "<div class="submenu"> <div class="submenu-head">Products</div> <ul> <li > <a tabindex="1" href="index.php">Products</a> </li> <li class="first-item current"> <a tabindex="1" class="first-item current" href="add_product.php"> Add new Product </a> </li> </ul> </div>"; break} but this is not very efficient, cause if have 10 menu links i would have to write 10 cases so how can u do this without having to write all those cases, like maybe use a function instead?? Hi, I have an array of items and I randomly want to remove one from the array. What's the easiest way to go about this? I am unsure of how to select something made up of a composite key. Allow me describe the entity... Event ShowID (pk) VenueID (pk) StartDateTime (pk) My Checkout process will have an HTML Table displaying maybe 3-4 different Events like this... Code: [Select] ========================= Register in 3 Easy Steps... Step #1: Select a Date and Attendees Event Ticket (Update) Choose Name Cost Attendees Total One Flower Show $20 ___ $0 <<Buy a Ticket>> Mankato, MN Sept 24, 2011 Flower Show $20 _3_ $60 <<Buy a Ticket>> Willmar, MN Oct 1, 2011 Banjo Jamboree $50 ___ $0 <<Buy a Ticket>> Brainerd, MN Oct 8, 2011 ========================= When a User clicks on a particular "Buy a Ticket" button, how do I capture the 3 Composite Key Values I need so I can insert them into my Order table? Maybe a better question to ask, is HOW/WHERE would I store the 3 Composite Key Values so that when a User clicks on a given "Buy a Ticket" button, that I have the values I need to build my Order record?? Normally with just one value (e.g. Drop-Down List), when someone selects a value, there is a corresponding code that you'd use. For example "Extra Large" in a Drop-Down List equals "3". Hope I'm making sense?! Thanks, Debbie This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=354366.0 I have a script that seems to work well to insert a bookmark into a users database when he/she is logged into the system but I am having a hard time figuring out how I would go about making a work-a-round for having an item selected before being logged in, and inserted after they have logged in or registered. For example, I would like a user to be able to select an Item to add to bookmark whether that user is logged in/registered or not and if they are not, they would be greeted with a login/registration form and after successful login the add bookmark script would be initiated on the item previously selected. What I've got this far: Simple form to add bookmark: <form name="bm_table" action="add_bms.php" method="post"> <input type="text" name="new_url" value="http://" /> <input type="submit" value="Add Bookmark"/> </form> Then I have the add bookmark script: BEGIN php $new_url = $_POST['new_url']; try { check_valid_user(); //cannot get past this part since it ends the script....code below if (!filled_out($_POST)) { throw new Exception('Form not completely filled out.'); } // check URL format if (strstr($new_url, 'http://') === false) { $new_url = 'http://'.$new_url; } // check URL is valid if (!(@fopen($new_url, 'r'))) { throw new Exception('Not a valid URL.'); } // try to add bm add_bm($new_url); echo 'Bookmark added.'; // get the bookmarks this user has saved if ($url_array = get_user_urls($_SESSION['valid_user'])) { display_user_urls($url_array); } } catch (Exception $e) { echo $e->getMessage(); } END php Checking valid user - the portion I cannot get past in the above script: function check_valid_user() { // see if somebody is logged in and notify them if not if (isset($_SESSION['valid_user'])) { echo "Logged in as ".$_SESSION['valid_user'].".<br />"; } else { // they are not logged in do_html_heading('Problem:'); echo 'You are not logged in.<br />'; do_html_url('login.php', 'Login'); do_html_footer(); exit; } } How would I go about modifying the script so that a user could fill in the form (later it would be a link...obviously they probably wouldn't be filling in a form that is log-in specific - but same concept I think) Thanks in advance for the help! tec4 Hi there, I think this is a big question but I'd appretiate any help you can provide!! I have a list of items and subitems in a table that looks like this: id parent_id title 1 0 House Chores 2 1 Take Out Trash 3 1 Clean Room 4 0 Grocery List 5 4 Eggs 6 4 Produce 7 6 Lettuce 8 6 Tomato 9 4 Milk I want to display it like this: (+) House Chores: > Take Out Trash > Clean Room (+) Grocery List: > Eggs (+) Produce > Letutce > Tomato > Milk So basically each entry in the table has an unique id and also a parent id if it's nested inside another item. I "sort of" got it figured out in one way, but it doesnt really allow for nested subgroups. I'd like to know how would y'all PHP freaks to this Also taking suggestions for the javascript code to expand/collapse the tree !! Thank you! Would like to be able to click on a radio button that represents an image. Once selected and submitted, have that image display on another page. I have an idea, but need some guidance. BTW, is using php only doable? Is there a simpler or more elegant way to do this? Thanks all! Well I am looking to change this url Code: [Select] http://website.com/product.php?Item=2369 to Code: [Select] http://website.com/product.php?Item=Item-Name Heres a snip of the code that handles that. <?php include_once('mysql_connect.php');$id = (int)$_GET['Item'];?>() any help would be appreciated. Below is a page which is supposed to output the name, blog contribution and picture of contributing members of a website. <div id="blog_content" class="" style="height:90%; width:97%; border:5px solid #c0c0c0; background-color: #FFFFFF;"> <!--opens blog content--> <?php //address error handling ini_set ('display_errors', 1); error_reporting (E_ALL & ~E_NOTICE); //include the config file require_once("config.php"); //Define the query. Select all rows from firstname column in members table, title column in blogs table,and entry column in blogs table, sorting in ascneding order by the title entry, knowing that the id column in mebers table is the same as the id column in blogs table. $sql = "SELECT blogs.title,blogs.entry,members.firstname,images.image FROM blogs LEFT JOIN members ON blogs.member_id = members.member_id LEFT JOIN images ON blogs.member_id = images.member_id ORDER BY blogs.title ASC "; $query = mysql_query($sql); if($query !== false && mysql_num_rows($query) > 0) { while(($row = mysql_fetch_assoc($query)) !== false) { echo '<div id="blog_content1" style="float:left; position:relative;bottom:18px;left:13px; background-color: #FFFFFF; height:16.7%; width:100%; border:0px none none;" <!--opens blog_content1 same as main center top 1 and 2 from index page everything scaled down by a factor of 3, heightwise--> <div class="red_bar" style="height:3%; width:100%; border:1px solid #959595;"> <!--a--> <div class="shade1" style="height:5px; width:100%; border:0px none none;"> </div> <div class="shade2" style="height:5px; width:100%; border:0px none none"> </div> <div class="shade3" style="height:5px%; width:100%; border:0px none none"> </div> </div> <!-- closes red bar--> <div class="content" style="height:28.3%; width:100%; border:0px none none;"> <!----> <div class="slideshow" id="keylin" style="float:left; width:20%; border:0px none none;"> <!--a--> <div><img header("Content-type: image/jpeg"); name="" alt="" id="" height="105" width="105" src="$row[image]" /></div> </div> <!-- closes pic--> <div class="content_text" style="float:right; position:relative;top:7px;left:0px; max-height:150px; width:78.5%; border-width:4.5px; border-bottom-style:solid; border-right-style:solid; border-color:#c0c0c0; "> <!--a-->'; echo "<h3>".$row['title']."</h3>"; echo "<p>" .$row['entry']."<br />".$row['firstname']."</p>"; echo '</div> <!-- closes content text--> </div> <!-- closes content--> </div> <!-- closes blog_content1-->'; } } else if($query == false) { echo "<p>Query was not successful because:<strong>".mysql_error()."</strong></p>"; echo "<p>The query being run was \"".$sql."\"</p>"; } else if($query !== false && mysql_num_rows($query) == 0) { echo "<p>The query returned 0 results.</p>"; } mysql_close(); //Close the database connection. ?> </div> <!-- closes blog content--> The select query is designed to retrieve all the blog contributions(represented by the fields blogs.title and blogs.entry) from the database, alongside the contributing member (member.firstname) and the member's picture(images.image), using the member_id column to join the 3 tables involved, and outputs them on the webpage. The title, entry and firstname values are successfully displayed on the resulting page. However, I can't seem to figure out how to get the picture to be displayed. Note that the picture was successfully stored in the database and I was able to view it on a separate page using a simple select query. It is now just a question of how to get it to display on this particularly crowded page. Anyone knows how I can output the picture in the img tag? I tried placing the header("Content-type: image/jpeg"); statement at the top of the php segment, then just right below the select query and finally just right above the img tag, but in every case, I just got a big white blank page starring at me. How and where should I place the header statement? And what else am I to do to get this picture displayed? Any help is appreciated. I wrote the page below to display a member's area of a website. The page is a mix of html and php code. the first part of is a block of php, which authenticates the user and displays the header. The middle part is a block of html which contains the bulk of the page. Embedded in this block of html are two sections of php, the first of which is supposed to display a user uploaded picture, enclosed in div tags, and the second of which, prints out the user's first name, from the database. The end of the script is a line of php that displays the footer. Now the page displays correctly when the section of php that contains the select query for displaying the picture(starting line 104) is omitted. But once I include that section, all i see is a blank page. Why is that section of php problematic? What can be done to fix it? Here is the data for the full page. Thanks for any help. <?php //address error handling ini_set ('display_errors', 1); error_reporting (E_ALL & ~E_NOTICE); //authenticate user require('auth.php'); //define title define('TITLE' , 'Members'); require ('header.html'); //need the header ?> <div id="main" style="background-color: #FFFFFF; height:71%; width:101%; border:0px none none; margin:auto; "> <!-- --> <div id="main_left" style="float:left; height:100%; width:20%; border:0px none none;"> <!--opens main left--> <div id="main_left_top" style="float:left; position:relative;bottom:5px;right:5px; height:31.25%; width:100%; background-color: #FFFFFF; border:1px solid #c0c0c0; margin:1px;"> <!--opens main left top--> </div> <!-- closes main left top--> <div id="main_left_center" style="float:left; background-color: #FFFFFF; height:33%; width:100%; border-color:#a0a0a0;border-style:outset;border-width:1px; margin:auto; "> <!--opens the white content area--> </div> <!-- closes main left center--> <div id="main_left_bottom" style="float:left; background-color: #FFFFFF; height:33%; width:100%; border-color:#a0a0a0;border-style:outset;border-width:1px; margin:auto; "> <!--opens the white content area--> </div> <!-- closes main left bottom--> </div> <!-- closes main left--> <div id="main_center" class="content_text" style="float:left; height:100%; width:58%; background-color: #FFFFFF; border:1px solid #c0c0c0;"> <!--opens main center--> <div id="image_box" style="float:left; background-color: #c0c0c0; height:150px; width:140px; border-color:#a0a0a0;border-style:outset;border-width:1px; margin:auto; "> <?php //address error handling ini_set ('display_errors', 1); error_reporting (E_ALL & ~E_NOTICE); $query = "SELECT* FROM images WHERE member_id ='{$_SESSION['id']}' AND cartegoty 'main' "; $result = mysql_query($query); $result_data = mysql_fetch_array($result); header("Content-type: image/jpeg") ; echo $result_data['image']; ?> </div> <a href="upload_image_page.php">click here to uplaod a picture</a> <h1>Welcome <?php echo ucfirst($_SESSION['firstname']);?></h1> <a href="member_profile.php">My Profile</a> | <a href="logout.php">Logout</a> <p>This is a password protected area only accessible to members. </p> <a href="blog_entries.php">Add to Hahap Tok Library</a> </div> <!-- closes main center--> <div id="main_right" style="float:left; background-color: #FFFFFF; height:100%; width:20%; border-color:#a0a0a0;border-style:outset;border-width:1px; margin:auto; "> <!--opens the white content area--> <div id="main_right_top" style="float:left; background-color: #FFFFFF; height:33%; width:100%; border-color:#a0a0a0;border-style:outset;border-width:1px; margin:auto; "> <!--opens the white content area--> </div> <!-- closes main left top--> <div id="main_right_center" style="float:left; background-color: #FFFFFF; height:33%; width:100%; border-color:#a0a0a0;border-style:outset;border-width:1px; margin:auto; "> <!--opens the white content area--> </div> <!-- closes main left center--> <div id="main_right_bottom" style="float:left; background-color: #FFFFFF; height:34%; width:100%; border-color:#a0a0a0;border-style:outset;border-width:1px; margin:auto; "> <!--opens the white content area--> </div> <!-- closes main left bottom--> </div> <!-- closes main right--> </div> <!-- closes main--> <?php require('footer.html'); ?> hi i am trying to use a query like this SELECT * FROM `fares` WHERE `KMS` >=201 LIMIT 0 , 30 which pops up a databse list of 30 rows which looks something like the one below KMS SL_AD SL_CH 205 122 120 210 124 120 215 125 120 220 127 121 225 128 122 all i want to do is somehow sort and get only the first row(205 122 120) in my php program/ Thanks in advance hey all how would I do this.. I'm guessing I need to go four different SELECT queries I have prices in my DB I need to select the highest price one echo it select the second highest price echo it select third highest echo it then select everything else and echo them I have this so far but i dont know how to get the second, third, ext highest. $result = mysql_query("SELECT * FROM stuff ORDER BY price DESC LIMIT 1"); while($row = mysql_fetch_array($result)) { echo $row['image'] . " " . $row['link']; echo "<br />"; } Hi there, I have a bit of a situation that I'm stuck on, I have a list of items that are in a playlist and when the mediaplayer finishes the current item I want it to redirect to the next item in the playlist. The song is grabbed from the database through the ID in the URL (EG. v=1) Song1 (v=1) Song2 (v=2) Song3 (v=3) If the current song is Song1 then when the mediaplayer has finished I want it to then go to the next song (Song2, V=2). Code: [Select] $get = mysql_query("SELECT * FROM `music` WHERE `musicartist`='".$m['musicartist']."' ORDER BY musictitle") or die(mysql_error()); $geti = mysql_fetch_array($get); $ci1 = mysql_query("SELECT * FROM music WHERE musicid > '".$geti['musicid']."' ORDER by musicid ASC LIMIT 1")or die(mysql_error()); $ci = mysql_fetch_array($ci1); I currently have this but I know I'm wrong! When the next song comes on the playlist sort of goes crazy.. http://www.mymediaupload.com/music.php?v=179 You don't have to listen to the song, just slide the slider on the playlist to the end, and the next page that is loaded is ID171 when its supposed to be (HORN OF OCS which is 197) The full result of $geti is below: Code: [Select] <table border=1 cellspacing=1 cellpadding=0><tr> <th>musicid</th><th>musictitle</th><th>musicartist</th><th>musicgenre</th><th>musiclocation</th><th>musicuploaderid</th><th>musicuploader</th><th>musicalbum</th><th>views</th><th>musicalbumart</th><th>dateadded</th><th>itunes</th><th>feature</th><th>rating</th><th>active</th><th>raw</th><th>notes</th><th>notesuser</th><th>mmupick</th></tr> <tr> <td>170</td><td>All I Ever Wanted</td><td>Basshunter</td><td>Dance</td><td>Music/02 All I Ever Wanted.mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>58</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>186</td><td>All I Ever Wanted [Ultra DJ's Mix]</td><td>Basshunter</td><td>Remix</td><td>Music/02 All I Ever Wanted [Ultra DJs Mix.mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>26</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>164</td><td>Angel In The Night</td><td>Basshunter</td><td>Dance</td><td>Music/05 Angel In The Night.mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>60</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>187</td><td>Angel In The Night [Headhunters Remix]</td><td>Basshunter</td><td>Remix</td><td>Music/03 Angel In The Night [Headhunters R.mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>78</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>214</td><td>Basscreator</td><td>Basshunter</td><td>Dance</td><td>Music/11 Bass Creator.mp3</td><td>1</td><td>MMU_Admin</td><td>LOL (International V)</td><td>42</td><td>http://www.mymediaupload.com/Music/Artwork/5051442800128.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>191</td><td>Camila (Swedish Version)</td><td>Basshunter</td><td>Dance</td><td>Music/08 Camilla [Swedish Version].mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>40</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>182</td><td>Can You</td><td>Basshunter</td><td>Dance</td><td>Music/12 Can You.mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>37</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>177</td><td>Day And Night</td><td>Basshunter</td><td>Dance</td><td>Music/07 Day And Night.mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>29</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>175</td><td>Dont Walk Away</td><td>Basshunter</td><td>Dance</td><td>Music/05 Dont Walk Away.mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>59</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>1</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>90</td><td>Dota</td><td>Basshunter</td><td>Dance</td><td>Music/Basshunter - Dota.mp3</td><td>8</td><td>Roge</td><td>LOL (International V)</td><td>207</td><td>http://www.mymediaupload.com/Music/Artwork/5051442800128.jpg</td><td>2009-11-07</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>213</td><td>Dota 2007 [DJ Ellan Remix]</td><td>Basshunter</td><td>Remix</td><td>Music/15 Dota 2007 ( Dj Ellan mix).mp3</td><td>1</td><td>MMU_Admin</td><td>LOL (International V)</td><td>34</td><td>http://www.mymediaupload.com/Music/Artwork/5051442800128.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>166</td><td>Every Morning</td><td>Basshunter</td><td>Dance</td><td>Music/Every Morning.mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>34</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>217</td><td>Every Morning [Hot Pink Delorean Remix]</td><td>Basshunter</td><td>Remix</td><td>Music/Every Morning (Hot Pink Delorean Rem.mp3</td><td>1</td><td>MMU_Admin</td><td>LOL (International V)</td><td>63</td><td>http://www.mymediaupload.com/Music/Artwork/5051442800128.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>167</td><td>Every Morning [Micheal Mind Edit]</td><td>Basshunter</td><td>Remix</td><td>Music/Every Morning (Michael Mix).mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>32</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>168</td><td>Every Morning [Raindropz Mix]</td><td>Basshunter</td><td>Remix</td><td>Music/Every Morning (Raindropz Mix).mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>28</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>179</td><td>Far From Home</td><td>Basshunter</td><td>Dance</td><td>Music/09 Far From Home.mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>39</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>196</td><td>Heaven</td><td>Basshunter</td><td>Dance</td><td>Music/Heaven.mp3</td><td>1</td><td>MMU_Admin</td><td>LOL (International V)</td><td>33</td><td>http://www.mymediaupload.com/Music/Artwork/5051442800128.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>197</td><td>Horn Of Orcs</td><td>Basshunter</td><td>Dance</td><td>Music/Horn Of Orcs.mp3</td><td>1</td><td>MMU_Admin</td><td>LOL (International V)</td><td>45</td><td>http://www.mymediaupload.com/Music/Artwork/5051442800128.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>171</td><td>I Can Walk On Water</td><td>Basshunter</td><td>Dance</td><td>Music/10 I Can Walk On Water.mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>32</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>178</td><td>I Can't Deny [Featuring Lauren]</td><td>Basshunter</td><td>Remix</td><td>Music/08 I Cant Deny [Feat. Lauren].mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>31</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>180</td><td>I Know You Know</td><td>Basshunter</td><td>Dance</td><td>Music/10 I Know U Know.mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>32</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>165</td><td>I Miss You</td><td>Basshunter</td><td>Dance</td><td>Music/04 Basshunter - I Miss You.mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>52</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>188</td><td>I Miss You [Hyperzone Remix]</td><td>Basshunter</td><td>Remix</td><td>Music/04 I Miss You [Hyperzone Remix].mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>25</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>172</td><td>I Promised Myself</td><td>Basshunter</td><td>Dance</td><td>Music/02 I Promised Myself.mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>35</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>176</td><td>I Still Love</td><td>Basshunter</td><td>Dance</td><td>Music/06 I Still Love.mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>30</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>174</td><td>I Will Love Again [Featuring Stunt]</td><td>Basshunter</td><td>Remix</td><td>Music/04 I Will Learn To Love Again [Feat..mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>56</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>198</td><td>I Will Touch The Sky</td><td>Basshunter</td><td>Dance</td><td>Music/I Will Tuch The Sky.mp3</td><td>1</td><td>MMU_Admin</td><td>LOL (International V)</td><td>88</td><td>http://www.mymediaupload.com/Music/Artwork/5051442800128.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>199</td><td>I&#39;m So In Love With You</td><td>Basshunter</td><td>Dance</td><td>Music/Im So In Love With You.mp3</td><td>1</td><td>MMU_Admin</td><td>LOL (International V)</td><td>30</td><td>http://www.mymediaupload.com/Music/Artwork/5051442800128.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>215</td><td>In Her Eyes</td><td>Basshunter</td><td>Dance</td><td>Music/11 In Her Eyes - Basshunter.mp3</td><td>1</td><td>MMU_Admin</td><td>LOL (International V)</td><td>42</td><td>http://www.mymediaupload.com/Music/Artwork/5051442800128.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>712</td><td>Jingle Bells</td><td>Basshunter</td><td>Xmas</td><td>Music/Basshunter - Jingle Bells (Official Music Video) HQ.mp3</td><td>1</td><td>MMU_Admin</td><td>Unknown</td><td>27</td><td>http://www.mymediaupload.com/img/AlbumR.png</td><td>2010-12-15</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>203</td><td>Now You&#39;re Gone</td><td>Basshunter</td><td>Dance</td><td>Music/Now youre gone.mp3</td><td>1</td><td>MMU_Admin</td><td>LOL (International V)</td><td>37</td><td>http://www.mymediaupload.com/Music/Artwork/5051442800128.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>608</td><td>Now You&#39;re Gone (Dark Intensity Remix)</td><td>Basshunter</td><td>Remix</td><td>Music/Now You re Gone (Dark Intensisty).mp3</td><td>1</td><td>MMU_Admin</td><td>Dark Intensity Remixs</td><td>8</td><td>http://www.mymediaupload.com/Music/Artwork/DarkIntensity.png</td><td>2010-10-01</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>185</td><td>Now You&#39;re Gone [DJ Alex Mix]</td><td>Basshunter</td><td>Remix</td><td>Music/01 Now Youre Gone [DJ Alex Extended</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>30</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>184</td><td>Numbers</td><td>Basshunter</td><td>Dance</td><td>Music/15 Numbers [Hidden Track].mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>106</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>181</td><td>On Our Side</td><td>Basshunter</td><td>Dance</td><td>Music/11 On Our Side.mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>35</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>183</td><td>Plane To Spain</td><td>Basshunter</td><td>Dance</td><td>Music/13 Plane To Spain.mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>48</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>169</td><td>Please Don't Go</td><td>Basshunter</td><td>Dance</td><td>Music/Please Dont Go.mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>25</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>189</td><td>Please Don't Go [Bad Behaviour Remix]</td><td>Basshunter</td><td>Remix</td><td>Music/05 Please Dont Go [Bad Behaviour Re.mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>34</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>321</td><td>Russian Privjet</td><td>Basshunter</td><td>Dance</td><td>Music/Basshunter - Russian Privjet93849.mp3</td><td>1</td><td>MMU_Admin</td><td>LOL (International V)</td><td>71</td><td>http://www.mymediaupload.com/Music/Artwork/5051442800128.jpg</td><td>2010-02-20</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>499</td><td>Saturday</td><td>Basshunter</td><td>Dance</td><td>Music/Basshunter - Saturday1.mp3</td><td>1</td><td>MMU_Admin</td><td>Saturday - EP</td><td>33</td><td>http://www.mymediaupload.com/img/AlbumA.png</td><td>2010-06-14</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>211</td><td>So Near So Close</td><td>Basshunter</td><td>Dance</td><td>Music/05 So Near So Close.mp3</td><td>1</td><td>MMU_Admin</td><td>LOL (International V)</td><td>28</td><td>http://www.mymediaupload.com/Music/Artwork/5051442800128.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>205</td><td>Stay Alive</td><td>Basshunter</td><td>Dance</td><td>Music/Stay Alive.mp3</td><td>1</td><td>MMU_Admin</td><td>LOL (International V)</td><td>43</td><td>http://www.mymediaupload.com/Music/Artwork/5051442800128.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>206</td><td>Tetris</td><td>Basshunter</td><td>Dance</td><td>Music/Tetris.mp3</td><td>1</td><td>MMU_Admin</td><td>LOL (International V)</td><td>32</td><td>http://www.mymediaupload.com/Music/Artwork/5051442800128.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>195</td><td>The Basshunter Song</td><td>Basshunter</td><td>Dance</td><td>Music/The BassHunter Song.mp3</td><td>1</td><td>MMU_Admin</td><td>LOL (International V)</td><td>27</td><td>http://www.mymediaupload.com/Music/Artwork/5051442800128.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>202</td><td>The Night</td><td>Basshunter</td><td>Dance</td><td>Music/The Night.mp3</td><td>1</td><td>MMU_Admin</td><td>LOL (International V)</td><td>54</td><td>http://www.mymediaupload.com/Music/Artwork/5051442800128.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>216</td><td>The Warpzone</td><td>Basshunter</td><td>Dance</td><td>Music/The Warpzone.mp3</td><td>1</td><td>MMU_Admin</td><td>LOL (International V)</td><td>440</td><td>http://www.mymediaupload.com/Music/Artwork/5051442800128.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>207</td><td>Thunder In Paradise</td><td>Basshunter</td><td>Dance</td><td>Music/Thunder In Paradise.mp3</td><td>1</td><td>MMU_Admin</td><td>LOL (International V)</td><td>27</td><td>http://www.mymediaupload.com/Music/Artwork/5051442800128.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>208</td><td>Trance Up</td><td>Basshunter</td><td>Dance</td><td>Music/Trance Up.mp3</td><td>1</td><td>MMU_Admin</td><td>LOL (International V)</td><td>31</td><td>http://www.mymediaupload.com/Music/Artwork/5051442800128.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>190</td><td>Walk On Water [Ultra DJ's Remix]</td><td>Basshunter</td><td>Remix</td><td>Music/06 Walk On Water [Ultra DJs Remix].mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>24</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>209</td><td>Welcome To Rainbow</td><td>Basshunter</td><td>Dance</td><td>Music/Welcome to Rainbow.mp3</td><td>1</td><td>MMU_Admin</td><td>LOL (International V)</td><td>28</td><td>http://www.mymediaupload.com/Music/Artwork/5051442800128.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>210</td><td>Welcome To Rainbow [Hardstyle Remix]</td><td>Basshunter</td><td>Remix</td><td>Music/02 Welcome To Rainbow (Hardstyle Rem.mp3</td><td>1</td><td>MMU_Admin</td><td>LOL (International V)</td><td>28</td><td>http://www.mymediaupload.com/Music/Artwork/5051442800128.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>212</td><td>When You Leave [Numa Numa]</td><td>Basshunter</td><td>Remix</td><td>Music/When You Leave (Numa Numa).mp3</td><td>1</td><td>MMU_Admin</td><td>LOL (International V)</td><td>39</td><td>http://www.mymediaupload.com/Music/Artwork/5051442800128.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>173</td><td>Why</td><td>Basshunter</td><td>Dance</td><td>Music/03 Why.mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>34</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> <tr> <td>192</td><td>Without Stars (Swedish Version)</td><td>Basshunter</td><td>Dance</td><td>Music/09 Without Stars [Swedish Version].mp3</td><td>1</td><td>MMU_Admin</td><td>Bass Generation</td><td>40</td><td>http://www.mymediaupload.com/Music/Artwork/BassGeneration.jpg</td><td>2009-11-13</td><td>No iTunes Link Specified</td><td>0</td><td>0</td><td>1</td><td>NULL</td><td>0</td><td>0</td><td>0</td></tr> </table> I'm sorry if you can't understand what I mean its just I find it hard to explain stuff I am able to view record numbers 22, 84, and 203 by exectuing my PHP script with the correct record ID. However, what I really want to do is have a simple form whereby I can input the desired record number and have it upload the data for me. I imagine it would look something like this: "SELECT * FROM mytable WHERE id = specified_record" but need a bit of guidance to get the HTML input fields 'name' into the PHP request. Hi, this is the first time I've asked for some help from a forum. I guess this code has sort of got me stumped. So, I have a system where a user can enter a number. The number goes into a mysql database. A random number is also generated and it is added into another column. So, I want users to be able to delete the number using the random number. I've shown it to them, and I need help working my delete script. Code: [Select] <?php $con = mysql_connect("localhost","",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("a8784hos_adopts", $con); $adopt = $_POST['adoptid']; $uniquecode = $_POST['uniquecode']; $result = mysql_query("SELECT uniquecode, id FROM id WHERE id='$adopt'"); mysql_fetch_array($result); if (($adopt == $row['id']) || ($uniquecode == $row['uniquecode'])){ mysql_query("DELETE FROM id WHERE id='$adopt'"); echo 'Done! <br/><br/><a href="tester.php">Go back....</a>'; } else { echo 'Bad unique code. <br/><br/><a href="tester.php">Go back....</a>'; } ?> So, the random number is uniquecode in the database, and the number is id. However, when I try this code, it always tell me I have a bad unique code. What am I doing wrong? Thanks. I don't know why. I've been debugging this for the past hour. My query function I built will not return anything. It passes the parameters just fine, but when it gets to the bind_param, I personally don't think that part is working since it doesn't update the query string when I debug it and therefore gives me a null when I call for the $stmt->num_rows(); function. Here is my query that is calling it: Code: [Select] <?php include_once dirname(__FILE__).'/class/Database.php'; $DB = new Database(); echo $DB->select('usr_username', 'user_usr', 'usr_id = ?', '', '', 'i', '2', 'username'); ?> Here is my Database class: Code: [Select] <?php include_once '/../includes/constants.php'; class Database { private $cxn; private $numResult; private $stmt; private $row; function __construct() { $this->cxn = mysqli_connect(DB_SERVER, DB_USER, DB_PASS, DB_NAME) or die('Could not connect to the database.'); } public function select($rows, $table, $where='', $order='', $limit='', $type='', $input='', $result='') { $this->stmt = $this->cxn->stmt_init(); $query = 'SELECT '.$rows.' FROM '.$table; if($where != '') { $query .= ' WHERE '.$where; } if($order != '') { $query .= ' ORDER BY '.$order; } if($limit != '') { $query .= ' LIMIT '.$limit; } $this->stmt = $this->cxn->prepare($query); if($where != '') { $this->stmt->bind_param($type, $input); } $this->stmt->execute(); $this->stmt->bind_result($result); $this->numResult = $this->stmt->num_rows; for ($i = 0; $i < $this->numResult; $i++) { // look at when you get up. returning 0 instead of 1! $this->row = $this->stmt->fetch_array(MYSQLI_ASSOC); return $this->row; } return false; //return an error } } ?> Thanks for any help! I wish the num_rows would return 1 result and not be null. Hi guys, essentially, I have very limited knowledge with mysql and have hit a brick wall. The row that I am trying to select is the following: Now, I am trying to use the following script to achieve that: Quote $query = "SELECT meta_value FROM wp_usermeta WHERE user_id='$id' & meta_key='simple_local_avatar'"; The $id is being passed as 1 from a cookie, and I know for sure that thats working properly, but I cant figure out the coding to select it correctly. I need the script to search for the ID of the user & then user the simple_user_avatar to find the right entry. Please someone cast your knowledge and help me out! Oh, little adendum. All that happens when the script runs is that the first row of the table is called out, which is: This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=334572.0 Hi all I am having some problems with the logic behind a simple idea. Basically I have a list which returns the names of players from a json request, what I simply want to do is for the user to click on the name which then activates it, so basically they can then run a command directed at that name, so something like Code: [Select] Names a b c[onlick select] d Action Ban Thanks Error: Code: [Select] No error, Im have trouble Having This Loop Select Only 2 Uploads At a Time. Code: Code: [Select] <?php //porperties $result = mysql_query("SELECT * FROM uploaded"); while($r=mysql_fetch_array($result)) { $link=$r["link"]; $name=$r["name"]; $type=$r["type"]; $size=$r["size"]; $date=$r["date"]; $id=$r["id"]; echo " The File $name Was Currently Updated<br> Size: $size<br> Type: $type<br> Date Updated: $date<br> Link: <a href='$link'>Download</a><br><br> "; } ?> Couldn't Think of a Good name For this,Sorry |