PHP - Selecting The Right Item In A Menu
hello,
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?? Similar TutorialsIn 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> Hey guys, I have a drop down menu like so <select name="Categories[]"> <Option value="Horror" Name="Horror">Horror</Option> <Option value="Romance" Name="Romance">Romance</Option> ......................................... Like that, just out of interest once the user has selected the option I am unsure on how to extract what the user chose from the drop down menu, how do you grab the value from array of the drop down menu that the user has selected. Any help A.S.A.P would really be appreciated. It also has to be an array. I also thought of using the $_POST['Categories']; to try grab the value if that is the correct way to go about it. Thank you in advance. I've followed a few tutorials, as I've never touched drop down before (more of a conventional navbar guy ). But none are dropping the nested list :-\. I even took the code from one, no changes made, and it still didn't drop the menu
This is as far as I got on this tutorial (http://line25.com/tu...s-dropdown-menu) before coming here
#topbar-navigation { width: 101%; margin: 0 auto; ; margin-top: -8px; height: 56px; background: #ffffff; display: inline-block; text-align: center; min-width: 1100px; -webkit-box-shadow: 0 1px 8px 0px #b5b5b5; -moz-box-shadow: 0 1px 8px 0px #b5b5b5; box-shadow: 0 1px 8px 0px #b5b5b5; } #topbar-navigation ul { display: inline-table; list-style: none; position: absolute; margin-left: auto; margin-right: auto; margin-top: 20px; top: 0; left: 765px; right: 0; } #topbar-navigation ul:after { content: ""; clear: both; display: block; } #topbar-navigation ul ul { display: none; } #topbar-navigation ul li:hover > ul { display: block; } #topbar-navigation ul li a { display: block; padding: 25px 40px; color: #99a0a8; text-decoration: none; font-family: 'sinkin_sans400_regular'; font-size: 12px; } <div id="topbar-navigation"> <a href="index.php"><img src="images/moduniverselogo.png" class="site-logo" draggable="false" /></a> <ul> <li><a href="#">Welcome, <b style="color:#ff924e" ><?php echo $user->data['username'] ?></b></a></li> <ul> <li><a href="#">My Profile</a></li> <li><a href="#">Edit Account</a></li> <li><a href="#">Log Out</a></li> </ul> </ul> </div>I want it nested to the right like on the site currently: http://i.imgur.com/llZPUbZ.png Edited by Azercii, 20 June 2014 - 10:01 PM. 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! 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. 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 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 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 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: 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, 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. 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 running a query to get a certain student's quiz results from all attempts and print one after the other in a simple table for now. The student is designated by an email address. I need results from all of the rows containing this particular email. The issue I think I am having is that when I use "WHERE" and specify an email address that exists many times in the table it isn't storing the variable correctly. Here is code below that I cannot get working right. When I try to print these variables as a test to see if they are working I get nothing. No errors either. I have checked all names, spellings, and capitalization about 5 times. Thanks for looking at it. Code: [Select] $QuizQuery = mysql_query("SELECT * FROM Quiz_Results WHERE Email = '".$_SESSION['UserEmail']."' AND Quiz_Name = 'M1'") or die(mysql_error()); $i=1; while ($QuizResults = mysql_fetch_array($QuizQuery)){ $UserEmail = $QuizResults['Email']; $Score = $QuizResults['Score']; $Date = $QuizResults['Date_Taken']; echo "<table width='650' border='1'><tr><td>"; echo "Attempt #".$i."<br></td><td>Sco ".$Score."</td><td>"; if($QuizResults['Pass'] == "PASSED"){ echo "Passed"; } else { echo "Failed"; } echo "</td><td>Date Taken: ".$Date."</td></tr></table>"; $i++; } I want the user to input there name, then have a php script to find the memeber in a members database and then grab the whole row by the user name. so if my db has 3 colums id, user, password, then want it to take out all three fields based on the users name. Can anyone help me? I have a script where you add an entry into a DB. I want to take everyone from another table in this DB and send the newly added content to them. My problem is displaying all of the contacts into the $to= location. This is what I currently have: <?php error_reporting(-1); //-------------email section----------------// $title = $_POST['title']; $story = $_POST['story']; $date = $_POST['date']; //do { //$to = $row_Fake['fake_email']; //} //while($row_Fake = mysql_fetch_assoc($Fake)); while ($row_Fake = mysql_fetch_assoc($Fake)) { $to = $row_Fake['fake_email']; } //$to = "colinrblambert@gmail.com"; $subject = "New Halnor Update!"; $message = " <html> <head> <title>New Update!</title> </head> <body> <div align='center'>"; //do{ echo $row_Fake['fake_email'].", "; } while($row_Fake = mysql_fetch_assoc($Fake)); //$row['fake_email']; "We have a new update from ".$date." to share with you !<br /><br /> <table border='0'> <tr> <td valign='top' width='200'><b>".$title."</b></td> <td>".nl2br($story)."</td> </tr> </table> </div> </body> </html> "; $x = 1; $str = "test"; do{ $str .= $x; $x++; }while($x<10); // Always set content-type when sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; // More headers $headers .= 'From: <admin@website.com>'. "\r\n"; //$headers .= 'Cc: myboss@example.com' . "\r\n"; mail($to,$subject,$message,$headers); } header(sprintf("Location: %s", $insertGoTo)); } ?>Kind of lost right now. Can someone help? I have a table called users with a fieldname called service_id. In a table called services I have id and name. I want to query the users table and, based on the service_id, display the name of the service (which is stored in the services table). However, when I try this code I get No records returned. I later echo out under a while statement $row['name']; or $row['id'] $query = "SELECT users.username, users.lname, users.fname, users.service_id, services.name, services.id FROM users, services WHERE users.inst_id = '".$userarray['inst_id']."' and users.id !='".$userarray['id']."' and users.service_id = services.id "; |