PHP - Selecting Words/patterns From Sentences
Similar TutorialsHi all, I realised as users register themselves in the registration form, they wrote their comments and experience in the comment box which was provided Example (this is the content which they have written) 'Sentence 1 - Abccafsafsafafasdfafasfafs Sentence 2 - dasddsadsadsadsdaddsda' As you can see, between Sentence 1 and 2 there is a break (space). However when we store it in our database, and generate it out as a webpage, the break (space) is gone, and sentence 1 and 2 merged Example 'Abccafsafsafafasdfafasfafsdasddsadsadsadsdaddsda' My question is, how can we prevent 2 different sentences from merging? Thanks Below is my code and attached it what has been generated after we have posted it in webpage Code: [Select] cho '<div id="panel3">'; echo '<table>'; /***Tutor's Comments***/ echo'<div id="tutor_comments">'; echo '<br/><tr><td class="row_header">Tutor\'s Comments</td></tr>'; if (!empty($row2['tutor_comments'])) { echo '<tr><td>' . $row2['tutor_comments'] . '<br/><br/></td></tr>'; } /***Tutor's Commitments***/ echo '<tr><td class="row_header">Tutor\'s Commitment</td></tr>'; if (!empty($row2['tutor_commitment'])) { echo '<tr><td>' . $row2['tutor_commitment'] . '<br/><br/></td></tr>'; } /***Admin_comments***/ echo '<tr><td class="row_header">Admin\'s Comments</td></tr>'; if (!empty($row2['admin_comments'])) { echo '<tr><td>' . $row2['admin_comments'] . '<br/><br/></td></tr>'; } echo '</table>'; //End of Panel 3's table echo '</div>'; //End of tutor_comments DIV Creating my own little MVC framework to understand it better. Question - When a view outputs a page with a form in it, how is the form handled? ie, what is the action of the form? Where does the IF statement that checks if the submit button was pressed, go? I was told inside a method in the Model...but I don't understand how a method can check if a form has been submitted or not. Any help greatly appreciated. Hey everyone! New member here still getting the hang of PHP. Any help is much appreciated. Suppose the array contains: array ('http://www.php.net/styles/site.css', 'http://www.example.com/styles/some.js', 'http://www.domain.net/styles/hey.php'); How do I get php to find the array item that contains let's say "css" and instead of returning just "css" it returns the entire string that has the "css" in it, instance "http://www.php.net/styles/site.css". I was thinking of using the following: preg_match('/[SOME_PCRE_PATTERN].css/', 'http://static.php.net/www.php.net/styles/site.css', $matches); Problem is since the links could be different and have all sorts of different characters in it, I have no idea what to put for the PCRE_PATTERN. In other words, this: $links = array ('http://www.php.net/styles/site.css', 'http://www.example.com/styles/some.js', 'http://www.domain.net/styles/hey.php'); foreach ($links as $key) { preg_match('/css/', $key, $matches); $results[] = $matches; } print_r ($results); Returns this: Array ( [0] => Array ( [0] => css ) [1] => Array ( ) [2] => Array ( ) ) I would like it to return: Array ( [0] => Array ( [0] => http://www.php.net/styles/site.css ) [1] => Array ( ) [2] => Array ( ) ) I hope that makes sense to you guys. Once again, any help is appreciated and thank you! Hey guys, I have been programming for a while and I want to know what sort of design patterns I should look into when making a game? For example what design pattern is best for: Database management User management Forum management Etc I can only think of singleton or factory (for user/forum) I am reasonably new to OOP, but would like to learn it properly, so I thought creating a simple program such as rock-paper-siccors would work to be able to expand it eventually, and hopefully it will teach me reusable code practice. <input type="text" maxlength="5" name="zip" value="Zip Code" pattern="(\d{5})?" />So, if the zip code is filled, it should be a five digit number. If it's not filled it's optional. The above RegEx is forcing everyone to enter a zip code. Can HTML do this, or am I going to have to script it? 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 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. 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 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 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 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. This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=334572.0 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 />"; } 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 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 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 "; 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? Greetings all. I am building a website which will have a popup box. When a link is clicked on, the proper data will show in the box. I just need to know how I can detect which link was clicked. e.g. <a href="#">link one</a> <a href="#">link two</a> $a[1]="item1 | item2 | item3" $a[2]="item4 | item5 | item6" list($one, $two, $three)=explode("|",$a ) Where x is dependent on the link clicked. All the sites I have seen so far speak of basic array structures and how to set them up. If it makes any difference, the links are inside an unordered list setup. Thanks for any help. 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++; } Hey there, this I've no idea how can be done with PHP. I'm looking for a way to randomly select a 7 digits number from a *.txt and then print it on a webpage. Do any one know how can this be done? Thank you. |