PHP - Selecting Data Inserted In The Same If
Hi Guys, actually I'm doing hard with this code. the fact is that Im inserting data (name, phone number, nss) and im doing a select to get the id number where nss is like $nss (. I don`t know why I can`t receive data, i think the fact is that all the code is inside an if statement) But that is why im here guys. In adittion I tryed to get the max id in order to print into mail function. But I couldn't . This is my code...
************************************************************************************************************ //Database connection done perfectly $mysqli = mysqli_connect( "****", "***", "***", "***");
************************************************************************************************************ // Im working with bots and the intent received is this, in addition i get variables correctly.
************************************************************************************************************ //here im inserting the variables in the correct order. The database is getting the values correctly too.
************************************************************************************************************
************************************************************************************************************
//here is the section when im going to select the id from the table, where the nss number is equal to the nss variable number that i've putted (but idk if the insert is done at this point....
************************************************************************************************************ For example i'm getting the mail, the name and lastname correctly from my function (which gets the parameters and turn the information in readable characters to php)
$to = $email; } ************************************CODE DONE ***********************************************************
So guys, Idk what is happening here, I tryed lot of things but when im get the email I dont get the id value..... I think is because the insert hasn't been completed while the if is open..... In adition I wanto to ask you guys if somebody knows how to get correctly the data from this code... Firstly I was trying to get the max id from my table and then plus 1 to increase the number. and in that order put the id by myself or atleast get the value in that way. I tryed closely, but i finish getting the array value.. I going to show my code...
function obtener_Id(){ Similar TutorialsHi, I am making a website where the user can create a login and he's then redirected to the secured pages this is working ok. Then I want the user who's not yet completely registered to enter his full name and credentials and store this data in the table Owner. however when I am trying to do this with the below mentioned code I don't get any output on error level and I don't get any data inserted in my table what am I missing here Code: [Select] <?php //session starten session_start(); ini_set('display_errors', 'On'); error_reporting(E_ALL | E_STRICT); print_r($_SESSION['user_id']); //database verbinding maken mysql_connect("127.0.0.1", "root", "pass")or die("cannot connect"); mysql_select_db("tobysplace")or die("cannot select DB"); //kijken of de gebruikers_id al gekend is in de tabel Owner $result = mysql_query("Select gebruiker_id from Owner where gebruiker_id ='".mysql_real_escape_string($_SESSION['user_id'])"'"); If(!$result){ $gebruiker_id = mysql_insert_id(); } else { $gebruiker_id = mysql_real_escape_string($_SESSION['user_id']); } //de gegevens van de eigenaar wegschrijven in de database $Owner_query="insert into Owner( name, lastname, email, address1, town, postcode, phone, gebruiker_id)values( '" . mysql_real_escape_string($_SESSION['name']) . "', '" . mysql_real_escape_string($_SESSION['lastname']) . "', '" . mysql_real_escape_string($_SESSION['email']) . "', '" . mysql_real_escape_string($_SESSION['address1']) . "', '" . mysql_real_escape_string($_SESSION['town']) . "', '" . mysql_real_escape_string($_SESSION['postcode']) . "', '" . mysql_real_escape_string($_SESSION['phone']) . "', '" . mysql_real_escape_string($_SESSION['user_id']) ."')"; // // de query uitvoeren $result=mysql_query($Owner_query) //foutcontrole or die("<b>A fatal MySQL error occured</b>.\n<br />Query: " . $Owner_query . "<br />\nError: (" . mysql_errno() . ") " . mysql_error()); print '<p>'.$_SESSION['name'].' U bent met succes ingeschreven op tobys-place</p>'; //} ?> If the user signs up and does not have an avatar, a default will be given to them. I am checking for the avatar/image file, however, that is not working. Here is the messy code below: if ($_SERVER['REQUEST_METHOD'] == 'POST') { // $username = $_POST['username']; // adds user info submitted upon registration to database function addUser($pdo) { $username = $_POST['username']; $password = password_hash($_POST['password'], PASSWORD_DEFAULT); $bio = $_POST['bio']; $email = $_POST['email']; $c_status = 0; $query = $pdo->prepare("INSERT into profiles001 (username, password, email, c_status, bio) VALUES (:username, :password, :email, :cstat, :bio)"); $query->bindValue(':username', $username); $query->bindValue(':password', $password); $query->bindValue(':email', $email); $query->bindValue(':cstat', $c_status); $query->bindValue(':bio', $bio); $file = $_FILES['userfile']; $file_name = $file['name']; $file_type = $file['type']; $file_size = $file['size']; $file_tmp_name = $file['tmp_name']; $file_error = $file['error']; if (!isset($_FILES['userfile'])) { $avatar = "assets/soap.jpg"; $avatar_present_query = $pdo->prepare("INSERT into profiles001 (avatar) VALUES (:avatar) WHERE username = ':username'"); $avatar_present_query->bindValue(':avatar', $avatar); $avatar_present_query->bindValue(':username', $username); $avatar_present_query->execute(); $query->execute(); } // $query->execute(); } addUser($pdo);
I have tried to run my code and it works. I am not getting any error message but when I checked my database nothing was added. Code: [Select] <?php session_start(); include '../Database/connection.php'; if ($_FILES["file"]["error"] > 0) { echo "Error: " . $_FILES["file"]["error"] . "<br />"; } $filename = $_FILES["file"]["tmp_name"]; $fd = fopen ($filename, "r"); $data = fread ($fd,filesize ($filename)); fclose ($fd); $delimiter = "\n"; $output = explode($delimiter, $data); foreach($output as $var) { $tmp = explode(".", $var); $question = $tmp[0]; $choice1 = $tmp[1]; $choice2 = $tmp[2]; $choice3 = $tmp[3]; $choice4 = $tmp[4]; $answer1 = $tmp[5]; $answer2 = $tmp[6]; $answer3 = $tmp[7]; $answer4 = $tmp[8]; $sql = "INSERT INTO question SET Que_Question='$question', Que_Choice1='$choice1', Que_Choice2='$choice2', Que_Choice3='$choice3', Que_Choice4='$choice4', Que_Answer1='$answer1', Que_Answer2='$answer2', Que_Answer3='$answer3', Que_Answer4='$answer4', Tes_ID='$_SESSION[Tes_ID]'"; mysql_query($sql); } ?> My text file holds Quote What is the sky.where.how.wen.one.0.0.1.0 What colour.where.what.how.more.0.0.1.0 Ugh. Ive been asking so many questions, betcha already know my name. Hahah. Anyways, I know I already asked a question like this, but this is different. One of the values I am trying to insert into a database is simply not working. Here is the columnes in my mysql database: c_id commet story user date_added star Every value but 'commet' is getting inserted into database. NO error, no mysql errror. I have racked my brain trying to figure out what is wrong with the script. Here is my code: Code: [Select] <?php $idget = $_GET['id']; mysqlConnect(); //submit story if(isset($_POST['submit'])) { $com_form = mysql_real_escape_string(bb($_POST['commet'])); $rat_form = $_POST['rat']; $story_form = $idget; $user = $_SESSION['user']; $date = date("Y-m-d"); $query1 = " INSERT INTO story_commets(star, story, user, date_added, commet) VALUES($rat_form, '$story_form', '$user', '$date', '$com_form') "; mysql_query($query1) or die(mysql_error()); //} } // desplay reviews $query3 = " SELECT * FROM story_commets WHERE story = '$idget' ORDER BY date_added "; $select3 = mysql_query($query3) or die(mysql_error()); //$x=1; $ratav = array(); //if(mysql_num_rows($select3) == 0) //{ echo '<div id="message"> No Reviews Yet.... <>'; //} //else //{ while($rows3 = mysql_fetch_assoc($select3)) { $commetdb = $rows3['commet']; $user_com_db = $rows3['user']; $datedb = $rows3['date_added']; $stardb = $rows3['star']; //get profile picture $query4 = " SELECT * FROM login_info WHERE user = '$user_com_db' "; $select4 = mysql_query($query4) or die(mysql_error()); $rows4 = mysql_fetch_assoc($select4) or die(mysql_error()); $profile_pic = $rows4['profile_picture']; $user_id = $rows4['id']; echo " <div class='rev_cont'> <div class='info'> <img src='$profile_pic' /> <a href=?p=profile&id=$user_id> $user_com_db </a> <> <br /> <div class='rev'> <strong> $stardb/10 </strong> <br /> $commetdb <> <div id='date'> <em> Date Added: $datedb </em> <> <> <hr /> "; $ratav[]=$stardb; } $sum = array_sum($ratav); $count = count($ratav); $av = $sum / $count; $avf = round($av, 1); echo"<div id='message'> Rating Avarage: $avf /10 <>"; //} if (isset($_SESSION['user'])) { echo" <p> Did you like this story? Did you hate it? Give it a rating and let the author know!</p> <form action='?p=review&id=$idget' method='post' target='_self'> <label> Your rating is on a scale of 1-10 </label> <select name='rat'> <option> 1 </option> <option> 2 </option> <option> 3 </option> <option> 4 </option> <option> 5 </option> <option> 6 </option> <option> 7 </option> <option> 8 </option> <option> 9 </option> <option> 10 </option> </select> <label> Commets: </label> <textarea name='commet' cols='70' rows='9'></textarea> <input name='story' type='hidden' value='$idget' /> <br /> <input type='submit' value = 'Post' name='submit' /> </form> "; } else { echo "<div id='message'> Sign in to post a review! <>"; } ?> Here are the specifics if you want it. Here is the response part of the code: Code: [Select] <?php if(isset($_POST['submit'])) { $com_form = mysql_real_escape_string(bb($_POST['commet'])); $rat_form = $_POST['rat']; $story_form = $idget; $user = $_SESSION['user']; $date = date("Y-m-d"); $query1 = " INSERT INTO story_commets(star, story, user, date_added, commet) VALUES($rat_form, '$story_form', '$user', '$date', '$com_form') "; mysql_query($query1) or die(mysql_error()); //} } ?> Here is the form part of my code: Code: [Select] <?php if (isset($_SESSION['user'])) { echo" <p> Did you like this story? Did you hate it? Give it a rating and let the author know!</p> <form action='?p=review&id=$idget' method='post' target='_self'> <label> Your rating is on a scale of 1-10 </label> <select name='rat'> <option> 1 </option> <option> 2 </option> <option> 3 </option> <option> 4 </option> <option> 5 </option> <option> 6 </option> <option> 7 </option> <option> 8 </option> <option> 9 </option> <option> 10 </option> </select> <label> Commets: </label> <textarea name='commet' cols='70' rows='9'></textarea> <input name='story' type='hidden' value='$idget' /> <br /> <input type='submit' value = 'Post' name='submit' /> </form> "; } else { echo "<div id='message'> Sign in to post a review! <>"; } ?> Its probably something really mundane. HelP! Hello everyone.
It seems like my code is not working properly.
i have tried both mysqli and PDO to insert data into database,but it only takes me back to same page again,without doing nothing in the database (been checking this a few times to be sure).
both php and html code are on the same page.
Could anyone point me to the missing link in my code?
here's my code (HTML & PHP) :
<form action="" id="SignUpForm" autocomplete="on" style="display:none" method="post"> <!-- Form is Hidden until the user is clicking the "Sign Up" button. --> <input type="hidden" name="Language" value="English"> Fill up the following fields:<br><br> First name:<input type="text" name="fname" required><br><br> Last name: <input type="text" name="lname" required><br><br> Age: <input type="number" name="UserAge" min="1" max="120" required><br><br> Gender: <input type="radio" name="Gender" value="male">Male<br> <input type="radio" name="Gender" value="Female">Female<br> E-mail Address: <input type="email" name="email" autocomplete="off" required><br><br> Pick your new password: <input type="password" maxlength=”40” name="Password" required pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,40}"> Add password strength checker here.<br><br> <!-- Uses regular expression. --> Confirm Password: <input type="password" maxlength=”40” name="ConfirmPassword" required pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,40}"><br><br> <!-- A better way is to use onblur to check user's type match. --> <hr> <script> (function(){ $("#submit").click(function(){ $(".error").hide(); //Bind an event handler to the "error" JavaScript event. var hasError = false; var passwordVal = $("#Password").val(); var checkVal = $("#ConfirmPassword").val(); if (passwordVal == '') { $("#Password").after('<span class="error">Please enter a password.</span>'); hasError = true; } else if (checkVal == '') { $("#ConfirmPassword").after('<span class="error">Please re-enter your password.</span>'); hasError = true; } else if (passwordVal != checkVal ) { $("#ConfirmPassword").after('<span class="error">Passwords do not match.</span>'); hasError = true; } if(hasError == true) {return false;} }); }); </script> <script> //The validationMessage property of a DOM node contains the message the browser displays to the user when a node's validity is checked and fails. document.getElementById("name").validationMessage; document.getElementById("lname").validationMessage; document.getElementById("UserAge").validationMessage; document.getElementById("Gender").validationMessage; document.getElementById("email").validationMessage; document.getElementById("Password").validationMessage; document.getElementById("ConfirmPassword").validationMessage; </script> Now let's go through your prefered food. Check the appropriate boxed beyond.<br><br> This will help us to better understand your food discipline:<br> <p style="text-align:center"><b> Meat And Poultry:</b></p> <div id="MeatCheckBox"> <input type="checkbox" name="FoodTypes[]" value="Hamburger">Hamburger<br> <input type="checkbox" name="FoodTypes[]" value="Steak">Steak<br> <input type="checkbox" name="FoodTypes[]" value="GroundBeef">Ground Beef<br> <input type="checkbox" name="FoodTypes[]" value="Bacon">Bacon<br> <input type="checkbox" name="FoodTypes[]" value="Beef">Beef<br> <input type="checkbox" name="FoodTypes[]" value="Salami">Salami<br> <input type="checkbox" name="FoodTypes[]" value="Chicken">Chicken (In all its forms)<br> <input type="checkbox" name="FoodTypes[]" value="NoMeat">I don't eat meat at all (Vegeterian/Vegan)<br> </div> <p style="text-align:center"><b> Fish And Seafood:</b></p> <div id="FishAndSeaFood"> <input type="checkbox" name="FoodTypes[]" value="Fish">Fish<br> <input type="checkbox" name="FoodTypes[]" value="Sushi">Sushi<br> <input type="checkbox" name="FoodTypes[]" value="CannedFish">Canned Fish<br> <input type="checkbox" name="FoodTypes[]" value="Oysters">Seafood<br> <input type="checkbox" name="FoodTypes[]" value="SmokedSalmon">Smoked Salmon<br> </div> <div id="Vegetables"> <p style="text-align:center"><b> Do you eat vegtables?</b></p><br> <input type="radio" name="YesOrNo" value="Yes">Yes <!-- Give both options the same name,Because they are related. --> <input type="radio" name="YesOrNo" value="No">No<br> </div> <hr> <p>Do you workout as part of your lifestyle?</p><br> <input type="radio" name='workout_options' value='valuable' data-id="DoWorkout" class="workout_options" /> I do workout occasionally <input type="radio" name='workout_options' value='valuable' data-id="DoNotWorkout" class="workout_options" /> I am not working out<br><br><br> <section> <div id=DoWorkout class="workout_options"><p>We see you're not having any exercise at the moment.<br><br>Did you know that doing some kind of activity like running or cardio 3 times a week improve your life quality?<br><br>We'll help you go straight from zero to hero!</p></div> <div id=DoNotWorkout class="workout_options">What type of workout you're working on at the moment? Please choose from the options beyond:<br><br><br> <input type="checkbox" name="Cardio" value="Cardio" data-id="Cardio"/>Cardio/Aerobics<br><br> <input type="checkbox" name=" Weight_Lifting" value=" Weight_Lifting" data-id="Weight_Lifting"/>Weight Lifting/ Anaerobics</div><br> </section> <input type="submit" value="Sign Up!" id="submit"> </div> </form>PHP/PDO: <?php // connnecting to MYSQL with PDO. // Connection data (server_address, database, username, password) $hostdb = 'localhost'; $namedb = 'caf_users'; $userdb = 'root'; $passdb = 'mypassword'; if (isset($_POST['SignUpButton'])) { $yesOrNo=$_POST["YesOrNo"]; $firstName=$_POST["fname"]; $lastName=$_POST["lname"]; $userGender=$_POST["Gender"]; $emailAddress=$_POST["email"]; //check if user entered the exact password twice. if ($_POST["password"] === $_POST["confirm_password"]) { $password=$_POST["password"]; $hash = password_hash($passwod, PASSWORD_DEFAULT);} // The first parameter is the password string that needs to be hashed, //and the second parameter specifies the algorithm that should be used for generating the hash. //encrypted by bcrypt algorithm. else { echo "Passwords are mismatched. Please try again."; }; $userAge=$_POST["UserAge"]; // Display message if successfully connect, otherwise retains and outputs the potential error try { $conn = new PDO("mysql:host=$hostdb; dbname=$namedb", $userdb, $passdb); //Initiate connection witht the PDO object instance. $conn->exec("SET CHARACTER SET utf8"); // Sets encoding UTF-8 echo 'Connected to database'; // Define an insert query $sql = "INSERT INTO `users` ('Workout','first_name','last_name','gender','Email_Address','Password','User_Age') VALUES ($YesOrno,$fname,$lname,$Gender,$email,$password,$UserAge)"; $count = $conn->exec($sql); $conn = null; // Disconnect if($count !== false) echo 'Number of rows added: '. $count; } catch(PDOException $e) { echo $e->getMessage(); } } ?>Thank you in advance, Osher. Hi I am trying to select and order data/numbers from a colum in a mysql data base however i run the code and it returns no value just a blank page no errors or any thing so i think the code is working right but then it returns no result? Please help thanks Here is the code: <?php $host= "XXXXXX"; $mysql_user = "XXXXXX"; $mysql_password = "XXXXXX"; $mysql_database = "XXXXXXX"; $connection = mysql_connect("$host","$mysql_user","$mysql_password") or die ("Unable to connect to MySQL server."); mysql_select_db($mysql_database) or die ("Unable to select requested database."); $row = mysql_fetch_assoc( mysql_query( "SELECT XP FROM Game ORDER BY number DESC LIMIT 1" ) ); $number = mysql_result(mysql_query("SELECT XP FROM Game ORDER BY number DESC LIMIT 1"), 0); echo "The the highest XP is $number"; ?> 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 Hey guys im making a blog and when i make a post it automatically takes the date and created an archive based on what ever i have in the database (date wise) anyways it works almost fine but if i make a date in the same month it duplicates like so: October 2010 October 2010 November 2010 Is there away where i can limit October by 1 but when i come to make a post next year it will still display like so: October 2010 November 2010 December 2010 January 2011 ... October 2011 If i show you the code might make more sense haha:: public function create_archive() { // Loop through the database grabbing all the dates:: $sql = "SELECT blog_date FROM subarc_blog"; $stmt = $this->conn->prepare($sql); $stmt->execute(); $stmt->bind_result($date); $rows = array(); while($row = $stmt->fetch()) { $date = explode("-",$date); $month = date("F",mktime(0,0,0,$date['1'])); $year = $date[0]; $item = array( 'blog_month' => $month, 'blog_year' => $year ); $rows[] = $item; } $stmt->close(); return $rows; } and the sidebar looks like so:: <ul class="sidebar"> <?php $result = $Database->create_archive(); foreach($result as $row) : ?> <li><a href=""><?php echo $row['blog_month'] . " " . $row['blog_year']; ?></a></li> <?php endforeach; ?> </ul> Hope someone can help! 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 have the following code, and really can't see what is wrong with it. Any help would be great. <?php if (!mysql_connect('127.0.0.1', 'root', '')) { echo 'Could not connect to mysql'; exit; } $dbname = 'Requests'; $result = mysql_list_tables($dbname); if (!$result) { echo "DB Error, could not list tables\n"; echo 'MySQL Error: ' . mysql_error(); exit; } while($row2 = mysql_fetch_row($result)) { foreach ($row2[0] as $table_id) { $query = "SELECT * FROM $table_id"; $dbresult = mysql_query($query); // added code to use the tablename and select all records from that table // create a new XML document $doc = new DomDocument('1.0'); // create root node $root = $doc->createElement('mixes'); $root = $doc->appendChild($root); // process one row at a time while($row = mysql_fetch_assoc($dbresult)) { // add node for each row $occ = $doc->createElement($table_id); $occ = $root->appendChild($occ); // add a child node for each field foreach ($row as $fieldname => $fieldvalue) { $child = $doc->createElement($fieldname); $child = $occ->appendChild($child); $value = $doc->createTextNode($fieldvalue); $value = $child->appendChild($value); } // foreach } // while } } echo 'Wrote: ' . $doc->save("s.xml") . ' bytes'; // Wrote: 72 bytes ?> Hi all, I am trying to get data from MySQL to display in a html table in TCPDF but it is only displaying the ID. $accom = '<h3>Accommodation:</h3> <table cellpadding="1" cellspacing="1" border="1" style="text-align:center;"> <tr> <th><strong>Organisation</strong></th> <th><strong>Contact</strong></th> <th><strong>Phone</strong></th> </tr> <tbody> <tr>'. $id = $_GET['id']; $location = $row['location']; $sql = "SELECT * FROM tours WHERE id = $id"; $result = $con->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { '<td>'.$location.'</td> <td>David</td> <td>0412345678</td> </tbody>'; } } '</tr> </table>'; Anyone got any ideas? SELECT * FROM `booking_tbl` WHERE booking_status = 'Check In' AND departure_date_time = NOW()"I use the datetime datatype for the departure_date_time so i can get data from that data because it checking the date and time but i want it to check on the date from the datetime datatype So how can i get the data only with that date without the time in the mysql datetime datatype <script type="text/javascript"> hi there, so okay i have a table named course which has 2 fields. c_id and c_name c_id here isn't unique but is indexed. okay,my problem is how to get the last inserted row in this table right after a record has been inserted. i was thinking i'd do a little query and then echo the results back to where the user fills up a form with c_id and c_name fields.. so is there a way to do this?like getting all values from the last inserted row? Wonder if someone can advise I have a script which runs on a CRON job, so every hour a script is activated. When the script runs, it INSERTS between 1 and 12 records into a database table, works a charm so far. When each QUERY is run on the script, it grabs the last ID number that was INSERTED and that is entered into another table, so if my script INSERTS a new row with an ID of 34877, then the ID number 34877 is entered into another database table. To grab the last ID number, I have always used $last_id = mysql_insert_id(); as seen on http://php.net/manual/en/function.mysql-insert-id.php which has always worked great. I now have to create another script on a CRON job, which does a similar TASK, it INSERTS a record into the same database and then grabs the last ID number. The plan is to roll about 150 of these script out, so each one is INSERTING data, and grabbing the last ID of the row just created. By 2015, they plan to have several thousand of these scripts, all being run at the same time. This is basically part of a bigger system and this is the method in which the 3rd party suppliers need data handled, so I have no option. My question is, if I have tons of scripts INSERTING data to the same database table and each time an INSERT is done, the last ID is grabbed, can PHP get overloaded and confused and then end up returning the wrong ID number of the row INSERTED. Or if I put $last_id = mysql_insert_id(); straight after each INSERT, then is it gurenteed that the right ID number is returned. Just concerned the QUERIES will end up in a que and incorrect ID numbers will be returned. Basically, is $last_id = mysql_insert_id(); flawless in getting the ID number of the row just INSERTED? Cheers everyone i have the following processing action for a form query DUMP output is: string(202) "INSERT INTO contactPO (Status, DateReceived, CustomerEmail, LastName, FirstName, PropertyID, fromdate, todate, nop) VALUES ('1', '24-08-2011', 'r', 'r', 'rrrrr', '12121', '27-10-2011', '30-10-2011','4')" but nothing is inserted Code: [Select] <?php $con = mysql_connect("localhost","international",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_query("SET NAMES 'utf8'"); mysql_select_db("international", $con); // check which button was clicked // perform calculation if ($_POST['send']) { $query = sprintf("INSERT INTO contactPO (Status, DateReceived, CustomerEmail, LastName, FirstName, PropertyID, fromdate, todate, nop) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s','%s')", mysql_real_escape_string($_POST['Status']), mysql_real_escape_string($_POST['DateReceived']), mysql_real_escape_string($_POST['CustomerEmail']), mysql_real_escape_string($_POST['LastName']), mysql_real_escape_string($_POST['FirstName']), mysql_real_escape_string($_POST['PropertyID']), mysql_real_escape_string($_POST['fromdate']), mysql_real_escape_string($_POST['todate']), mysql_real_escape_string($_POST['nop'])); var_dump($query ); //$url_success = "search-index.php?RID=".$_POST['RequestID'].""; $url_success = "search-index.php"; echo("<meta http-equiv = refresh content=6;url=".$url_success.">"); exit; mysql_close($con); } ?> Basically the following code works fine, exepct when it comes to the last result it inserts it twice, example: (3,17),(4,17),(5,17),(5,17) Any clues as to why? Thanks Code: [Select] if(count($addIDs_ary) > 0) { $str = ""; foreach($addIDs_ary as $val) { $str .= "({$val},{$playerID}),"; if(end($addIDs_ary) == $val) { $str .= "({$val},{$playerID})"; } } echo $str; // (val,val), (val,val), (val,val) etc.. $query = "INSERT INTO hitlist (hit_id,player_id) values $str"; im playing around with a rating star jquery, i trying to get the value from the radio group but it is not selected??? Code: [Select] <?php require_once('Connections/international.php'); ?> <? mysql_query("SET NAMES 'utf8'")?> <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>jQuery Star Rating Plugin v3.13 (2009-03-26)</title> <script src='http://jquery-star-rating-plugin.googlecode.com/svn/trunk/jquery.js' type="text/javascript"></script> <script src='http://jquery-star-rating-plugin.googlecode.com/svn/trunk/documentation.js' type="text/javascript"></script> <link href='http://jquery-star-rating-plugin.googlecode.com/svn/trunk/documentation.css' type="text/css" rel="stylesheet"/> <script type="text/javaScript" src="http://www.fyneworks.com/jquery/project/chili/jquery.chili-2.0.js"></script> <script type="text/javascript">try{ChiliBook.recipeFolder="/jquery/project/chili/"}catch(e){}</script> <script src='http://jquery-star-rating-plugin.googlecode.com/svn/trunk/jquery.MetaData.js' type="text/javascript" language="javascript"></script> <script src='http://jquery-star-rating-plugin.googlecode.com/svn/trunk/jquery.rating.js' type="text/javascript" language="javascript"></script> <link href='http://jquery-star-rating-plugin.googlecode.com/svn/trunk/jquery.rating.css' type="text/css" rel="stylesheet"/> </head> <body> <a name="top"></a> <div id="wrap"> <div id="body"> <div id="documentation" class="tabs"> <div id="tab-Testing"> <h2>Test Suite</h2> <script type="text/javascript" language="javascript"> $(function(){ $('#form1 :radio.star').rating(); $('#form2 :radio.star').rating({cancel: 'Cancel', cancelValue: '0'}); $('#form3 :radio.star').rating(); $('#form4 :radio.star').rating(); }); </script> <script> $(function(){ $('#tab-Testing form').submit(function(){ $('.test',this).html(''); $('input',this).each(function(){ if(this.checked) $('.test',this.form).append(''+this.name+': '+this.value+'<br/>'); }); return false; }); }); </script><div class="Clear"> </div> <form name="form1" id="form1" method="POST"> <strong style='font-size:150%'>Test 2</strong> - With defaults ('checked') <table width="100%" cellspacing="10"> <tr> <td valign="top" width=""> <table width="100%"> <tr> <td valign="top" width="50%"> <div class="Clear"> Rating 1: (N/M/Y, default M) </div> <div class="Clear"> <input class="star" type="radio" name="rating1" value="0" id="rating1_0" title="0"/> <input class="star" type="radio" name="rating1" value="1" id="rating1_1" title="1"/> <input class="star" type="radio" name="rating1" value="2" id="rating1_2" title="2"/> </div> <div class="Clear"> Rating 2: (10 - 50, default 30) </div> <div class="Clear"> <input class="star" type="radio" name="rating22" value="10"/> <input class="star" type="radio" name="rating22" value="20"/> <input class="star" type="radio" name="rating22" value="30" checked="checked"/> <input class="star" type="radio" name="rating22" value="40"/> <input class="star" type="radio" name="rating22" value="50"/> </div> <div class="Clear"> Rating 3: (1 - 7, default 4) </div> <div class="Clear"> <input class="star" type="radio" name="rating23" value="1"/> <input class="star" type="radio" name="rating23" value="2"/> <input class="star" type="radio" name="rating23" value="3"/> <input class="star" type="radio" name="rating23" value="4" checked="checked"/> <input class="star" type="radio" name="rating23" value="5"/> <input class="star" type="radio" name="rating23" value="6"/> <input class="star" type="radio" name="rating23" value="7"/> </div> </td> <td valign="top" width="50%"> <div class="Clear"> Rating 4: (1 - 5, default 1) </div> <div class="Clear"> <input class="star" type="radio" name="rating24" value="1" title="Worst" checked="checked"/> <input class="star" type="radio" name="rating24" value="2" title="Bad"/> <input class="star" type="radio" name="rating24" value="3" title="OK"/> <input class="star" type="radio" name="rating24" value="4" title="Good"/> <input class="star" type="radio" name="rating24" value="5" title="Best"/> </div> <div class="Clear"> Rating 5: (1 - 5, default 5) </div> <div class="Clear"> <input class="star" type="radio" name="rating25" value="1"/> <input class="star" type="radio" name="rating25" value="2"/> <input class="star" type="radio" name="rating25" value="3"/> <input class="star" type="radio" name="rating25" value="4"/> <input class="star" type="radio" name="rating25" value="5" checked="checked"/> </div> <div class="Clear"> Rating 6 (readonly): (1 - 5, default 3) </div> <div class="Clear"> <input class="star" type="radio" name="rating26" value="1" disabled="disabled"/> <input class="star" type="radio" name="rating26" value="2" disabled="disabled"/> <input class="star" type="radio" name="rating26" value="3" disabled="disabled" checked="checked"/> <input class="star" type="radio" name="rating26" value="4" disabled="disabled"/> <input class="star" type="radio" name="rating26" value="5" disabled="disabled"/> </div> </td> </tr> </table> </td> <td valign="top" width="5"> </td> <td valign="top" width="50"> <input type="submit" value="Submit" name="submit"/> </td> <td valign="top" width="5"> </td> <td valign="top" width="160"> <u>Test results</u>:<br/><br/> <div class="test Smaller"> <span style="color:#FF0000">Results will be displayed here</span> </div> </td> </tr> </table> <script> $(function(){ $('.hover-star').rating({ focus: function(value, link){ // 'this' is the hidden form element holding the current value // 'value' is the value selected // 'element' points to the link element that received the click. var tip = $('#hover-test'); tip[0].data = tip[0].data || tip.html(); tip.html(link.title || 'value: '+value); }, blur: function(value, link){ var tip = $('#hover-test'); $('#hover-test').html(tip[0].data || ''); } }); }); </script> <div class="Clear"> </div><div class="Clear"> </div> </div> </div> </div> <div id="push"></div> </div> </form> </body></html> <?php mysql_select_db($database_international, $international); $query=mysql_query("INSERT INTO ratings_tbl (Comfort) VALUES ('$_POST[rating1]'')"); $selected_radio = $_POST['rating1']; echo $selected_radio; var_dump($_POST); ;?> Shouldn't the following stop a blank row from being inserted into mysql? I have a description and a date but it still keeps putting a blank row before my insert and I've tried everything.... if($myvar != ''){ mysql_query("INSERT IGNORE INTO products (description, time) VALUES('$myvar',NOW() ) ") or die(mysql_error()); I have a small form, then after submit it inserts a new row with a few values (time, email) This form also sends email to the email from the form with a link. Problem, the link needs to contain an autoincrement value from the newly inserted row. How can I do this? (the form that obvioulsy doesn't work, for obviously reasons but to show what I try to accomplish:P) Code: [Select] <? if (isset($_REQUEST['Submit'])) { $time= time(); # THIS CODE TELL MYSQL TO INSERT THE DATA FROM THE FORM INTO YOUR MYSQL TABLE $sql = "INSERT INTO phpfox_invite (user_id,email,time_stamp,is_used) values ('".$b."','".mysql_real_escape_string(stripslashes($_REQUEST['email']))."','".$time."','1')"; $sql = mysql_query("SELECT invite_id FROM phpfox_invite WHERE email='".mysql_real_escape_string(stripslashes($_REQUEST['email']))."'"); $result = mysql_fetch_array( $sql ); $inviteid = $result['invite_id']; if($result = mysql_query($sql)) { $modtager = "".mysql_real_escape_string(stripslashes($_REQUEST['email'])).""; $emne = "Please complete Your registration"; $besked = "Click the link below to complete your registration: \n http://domain.com/invite/id_".$inviteid." "; $header = "from:system@domain.com"; mail($modtager, $emne, $besked, $header); echo 'Check Your Email!'; } else { echo "ERROR: ".mysql_error(); } ?> Everything works ok, but ofcourse I cannot get the 'invite_id' before the form is submitted and therefor cannot send the value |