Jump to content

eZe616

Members
  • Posts

    112
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

eZe616's Achievements

Member

Member (2/5)

0

Reputation

  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();
×
×
  • 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.