Jump to content

eZe616

Members
  • Posts

    112
  • Joined

  • Last visited

    Never

Everything posted by eZe616

  1. There is also Qt for cross-platform GUI's. I believe they have an open source license. They don't support VS for the open source version. Other then that here are some tutorials for GUI programming. Some of them are mostly for C, but they should get you started. C: http://www.winprog.org/tutorial/ http://zetcode.com/tutorials/winapi/ C++: http://www.relisoft.com/win32/index.htm
  2. You could make both fields dropboxes. That way you make sure that only cities that have been submitted can be searched with a specific instrument also. That's how I would do it. As for the query string you could use something like this: <?php // Query string to search database $sql = "SELECT * FROM Musician WHERE instrument = 'Bassist' AND location = 'Perth'"; ?> But this depends on how your database is structured. I.E if the musician is allowed to insert more than 1 instrument, I'd assume you have a separate table to hold the instruments then. If you'd still want the regular input text field the query would be something like: <?php //Query string to search $sql = " SELECT * FROM Musician WHERE instrument = 'Bassist' AND location LIKE '%Perth%'"; ?>
  3. Let's say you want to upload 5 images and resize them. You start by giving all of the input file fields the same name e.g: <input type="file" name="image[]" /> <input type="file" name="image[]" /> <input type="file" name="image[]" /> <input type="file" name="image[]" /> <input type="file" name="image[]" /> Then you check if the form has been submitted using the isset function like you're using it now: <?php // Your script logic .... if(isset($_POST['Submit'])){ // These are used for each uploaded image so they only have the be set once $size = 240; // the thumbnail height $filedir = 'slide/'; // the directory for the original image $thumbdir = 'slide/'; // the directory for the thumbnail image $prefix = 'slide_'; // the prefix to be added to the original name $maxfile = '2000000'; $mode = '0666'; ?> Then comes the piece of code that handles each to be uploaded image individually: <?php ... // See if no errors occurred for each image foreach ($_FILES["pictures"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) { // Get image information of this particular image $userfile_name = $_FILES['image']['name'][$key]; $userfile_tmp = $_FILES['image']['tmp_name'][$key]; $userfile_size = $_FILES['image']['size'][$key]; $userfile_type = $_FILES['image']['type'][$key]; $business_id=$_SESSION['business_id']; // Your PHP code that handles/process each image individually ...... } } ?> So you get a script that kinda looks like this <?php // Your logic ... if(isset($_POST['Submit'])){ // These are used for each uploaded image so they only have the be set once $size = 240; // the thumbnail height $filedir = 'slide/'; // the directory for the original image $thumbdir = 'slide/'; // the directory for the thumbnail image $prefix = 'slide_'; // the prefix to be added to the original name $maxfile = '2000000'; $mode = '0666'; // See if no errors occurred foreach ($_FILES["pictures"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) { // Get image information of this particular image $userfile_name = $_FILES['image']['name'][$key]; $userfile_tmp = $_FILES['image']['tmp_name'][$key]; $userfile_size = $_FILES['image']['size'][$key]; $userfile_type = $_FILES['image']['type'][$key]; $business_id=$_SESSION['business_id']; // Code that handles/process each image individually ...... } } ?> Assuming also that you rename each image with a unique name so they won't override each other. Hope that helps you a little bit
  4. They explain it on the php.net website: Multiple Upload That should get you started.
  5. wouldn't they be accessing the domain already just by typing www.mysite.com/headerfont.php, even if they got the link from someplace else?So it wouldn't really matter right? Or you mean they can only use the page, if they already come from a www.mysite.com page?
  6. How about setting a cookie or a session id with f.e. your site's name in it and the headerfont.php checks the cookie or session on top of the page.
  7. kind alike "UPDATE {table} SET name='dumbo' ,blog='something' ,etc.. WHERE id=3" ??
  8. I'm having this problem using the while() function to go through my database query results.. I currently have this while($row = $db->fetchObject($result)) { $result[] = $row; } Now when I use it like this, it just stops the rest of the page from loading. So i've been using the for() alternative, but I'd prefer to use the while function. $db is the database class I use. That seems to be the cause, but I don't know why is causes it.
  9. phpriot has a tutorial on how to build a sortable list Here, maybe it's more to your liking...
  10. function runQuery($query) { $result = mysql_query($query); return $result; }
  11. I've been looking through CodeIgniter's code to get a better idea how a MVC might be programmed and I've stumble upon a piece of code I don't quite understand. They have a Common.php file that gets included, and that file contains the function 'load_class'. Now in there libraries folder they have the class Controller. Now in this class they make use of the 'load_class' function. I don't quite understand how this is possible, since the function isn't defined in the class itself. How is it possible that they can use the function inside the class itself.
  12. How so will they return the same value? In scenario one you're just returning the value you already have. In which point the function isn't necessary and you can just write $val = array[$i] In the second scenario, your passing the array, but returning the same value probably every time. In which point I don't see the need for a function also.
  13. $sql = "SELECT id, name FROM category"; I would write this piece of code as "SELECT * FROM category", since you ARE selecting all the fields in the category table. It's less writing for once. Category has two field id , name. head table has id,name,cat Now, as I understand the tables, your using the 'cat' field to join the two tables together. It would be better to join them using the category id field. An Example, your head table could look like this: Head----- id int(3) NOT NULL category_id int(2) NOT NULL name varchar(32) NOT NULL ' or something in that way. and to join them together you can try - I haven't tested it in mySQl though - $sql = "SELECT C.name, H.name, H.id FROM Category C INNER JOIN Head H ON C.id = H.category_id or something like that...not sure about it though..since I don't fully understand what you're trying to do
  14. I've looked quickly through your database.class, base.class and base_data.class. How come you put your fields all the way to the bottom? I always thought they should be put at the top of the class. When I opened your database class I only saw functions at first, and didn't know what field you were using or had at you disposal, and the database base class is quite long and the fields all all the way to the bottom. I just wanted to ask that. Sorry couldn't be more insightful.
  15. Yeah..I have an config file that is included before the class where the information of host username etc include 'config'; Class MySQL { // Necessary code goes here } $db = new MySQL();
  16. I have a quick question. I have a Database Class like the OP. Now I initialize the class in the class file itself. My class file looks kinda like this Class MySQL { // Necessary code goes here } $db = new MySQL(); Now is this a bad practice? I got it from a tutorial that did it this way and I thought it won't be so bad to have the class initialized already so I can just use it immediately without have to write the $db = new MySQL(); In every page that uses it.
  17. Yeah...I did some more seaching and found that also. It won't work, so I stopped trying and came siply wont use it.
  18. Yeah it does seem that I forgot the ul /ul, but how come does it work when I acces the page directly then? Ok...I've made the changes, but it still won't work.
  19. I have a client that wants to make a page with images on it. He doesn't want to go to another page, but display them all in 1 page. Now he only wants 1 image in a certain gallery to be the thumbnail. On clicking the thumbnail it opens a new box containing Links to the other Images using Ajax funcionality. On when you click on this link, the image is supposed to open up using the slimbox effect, kinda like the lightbox2 effect. The problem is, everything works except the slimbox effect. It doesn't work when using this method, but if I access the page directly the effect will work. My function to get the Images function makerequest(page, objID) { var obj = document.getElementById(objID); obj.style.display = "block"; var url = "getImages.php?id=" + page; xmlhttp.open("GET", url); xmlhttp.onreadystatechange = function () { if ( xmlhttp.readyState == 4 && xmlhttp.status == 200 ) { obj.innerHTML = xmlhttp.responseText; } } xmlhttp.send(null); } PHP code: <?php include 'includes/dbcon.php'; $workId = $_GET['id']; $sql = "SELECT * FROM work_images WHERE work_id='".$workId."' ORDER BY id ASC"; $result = $db->query($sql); $num = $db->numResult($result); for( $i=1; $i <= $num; $i++) { $row = $db->fetchArray($result); echo "<li><a href=\"".$row['url']."\" rel=\"lightbox[]\">Image".$i."</a></li>"; } ?> my html code <a href="javascript:;" onclick="javascript:makerequest('16','works');"> Show</a> <div id="works"> </div>
  20. This is the code I used to kinda 'fix' the problem...I don't think it's exactly what you want...but change a few things here and there and it might give you what you want.. function createInput(name,div) { var sel = document.getElementById(name); var number = sel.options[sel.selectedIndex].value; var element = document.getElementById("images"); element.innerHTML = ""; for( var i=1; i <= number; i++) { var newDiv = document.createElement('div'); if( i == 1) { newDiv.setAttribute("class","fm-req"); } else { newDiv.setAttribute("class","fm-opt"); } var newLabel = document.createElement('label'); newLabel.setAttribute("for","image"+i); newLabel.innerHTML = "Image " + (i) + ":"; newDiv.appendChild(newLabel); var newInput = document.createElement('input'); newInput.setAttribute("id","image"+1); newInput.setAttribute("name","images[]"); newInput.setAttribute("type","file"); newDiv.appendChild(newInput); document.getElementById(div).appendChild(newDiv); } } for processing all of the inputs look at the PHP manual: it gives you something like this for multiple information/files foreach ($_FILES["files"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) { $temp_name = $_FILES["files"]["tmp_name"][$key]; $name = $_FILES["thumbnail"]["name"][$key]; $path = $thumb_name; // where you want to upload it to move_uploaded_file($thumb_temp_name, $thumb_path); } } maybe you can give the fields name of "fields[]" and process them like the code above using the foreach loop??
  21. Does every user has to have there own folder? Or can every mp3 be in one folder?
  22. I would do it something like this $sql = "SELECT * FROM usernames WHERE username='".$username."' AND password='".$password."' LIMIT 1"; // Since only 1 user should be able to have that combination $result = mysql_query($sql); if ($result) { $row = mysql_fetch_array($result); $correct_user = $row['username']; $correct_pass = $row['password']; if($correct_pass == $password && $correct_user == $username) { echo "The username and password has been verified."; } }
  23. I've been thinking the same as you. I get all confused also. From what I understand. they have a function that goes through the template and replaces the { Last Name } for the actual variable using str_replace() or the preg_math() function. How exactly i'm not sure, but I think that's the way of using it... like how the BBcodes [b][/b] gets replaced with <b></b>
  24. Now how about if a current job has multiple drafts? Which need to be shown, if the client has decided which one he/she wants? I think I understand the draft_id in the images, but I do feel a little lost right now.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.