Jump to content

franzwarning

Members
  • Posts

    31
  • Joined

  • Last visited

    Never

Everything posted by franzwarning

  1. Hi there, Say I have some table, foo, and I want to select all rows in foo where 'name' is a member of an array of names that I have. How would I go about doing that? Cheers, George
  2. Hi, What's the best way I can organize my database to keep track of which users like certain photos. Should I just create a new table called "Likes" and store the user_id along with the photo_id? Or is there a more efficient way? Thanks, George
  3. Alright, you've convinced me. Cheers, Raymond
  4. I feel like that's less efficient though. I have a table called groups, where each row contains a group id, and all the member of that group in a BLOB.
  5. After doing some research, I think I can do it like this: <?php $result = ibase_query("SELECT blob_value FROM table"); $data = ibase_fetch_object($result); $blob_data = ibase_blob_info($data->BLOB_VALUE); $blob_hndl = ibase_blob_open($data->BLOB_VALUE); echo ibase_blob_get($blob_hndl, $blob_data[0]); ?> But what is ibase? Is it like mysql_query but for BLOBS?
  6. I plan on storing multiple user_id's in binary format, assuming each id is an int (4 bytes).
  7. Hi there, How could I get the value of every 4 bytes of a BLOB? Additionally, how can I add an item to the end of a BLOB and store it back in the database? Cheers, George
  8. How would I go about randomly selecting the last two photos (jpgs) in a folder and echoing the url? Cheers, George
  9. Hi, I'm trying to see if the url that I've created ends in .jpg. How would I go about doing that? Cheers, George
  10. Thanks, that's the kinda of approach I was looking for. If I did search for an image in google how would I save the image to a php script? Cheers, George
  11. Hi, How could I get random images off the web? When I mean random I mean anything, from ads to pictures of the ocean. I don't even know where to begin. Cheers, George
  12. Here is my current code to display files from the end to beginning : <?php function func() { $date = date("Y-m-d"); $picarray = array(); $userarray = array(); $handle = opendir ('pqimages/'.$date.'/'); while (false !==($file = readdir($handle))) { if($file != "." && $file != "..") { $picarray[] = "http://blah.com/pqimages/".$date."/".$file.""; $userarray[]= "pqimages/".$date."/".$file.""; } } sort($picarray); sort($userarray); closedir($handle); $json_array = json_encode($picarray); echo $json_array; } func(); ?> How could I change this from end to beginning for ($picarray)? Cheers, George
  13. Hello, How could I resize the image to 320x480 before it is uploaded. Here is the code for the upload: <?php require("connect.php"); $query = mysql_query("SELECT * FROM items ORDER BY id DESC"); if (mysql_num_rows($query) > 0) { $row = mysql_fetch_assoc($query); $id = $row['id']; $id++; echo $id."<br>"; $username = $_GET['user']; $dateofupload = date("Y-m-d"); $uploaddir = './pqimages/'.$dateofupload.'/'; $file = basename($_FILES['userfile']['name']); $uploadfile = $uploaddir.$id.".jpg"; if (move_uploaded_file($_FILES['userfile']['tmp_name'],$uploadfile)){ echo "http://randomaydesigns.com/pqimages/{$file}"; $userid = mysql_query("SELECT * FROM users WHERE username ='$username'"); while ($row2 = mysql_fetch_assoc($userid)){ $userid = $row2['id']; $updateuserlastupload = mysql_query("UPDATE users SET lastupload='pqimages/".$dateofupload."/$id.jpg' WHERE username='$username'"); $updateuser = mysql_query("INSERT INTO items VALUES('','$userid','1','i','','','pqimages/".$dateofupload."/$id.jpg','0','a','$dateofupload')"); } } } ?> Cheers, GEORGE
  14. How should I go about keeping track of photos that a user has rated, since I only want the user to rate the photo once? Can I store arrays in a mysql database? thanks, George
  15. Hi, I'm having trouble carrying items between two files. The problem is that it works too well. Whenever I include a php file that echos something, the other php files echos the same thing. What are some ways to stop this, but still have access to the variable. Thanks, GEORGE
  16. Hi, I have this php code to display the url of the files and it works fine, it just has a weird order when it is echoed out. Here is the code: <?php $date = date("Y-m-d"); $picarray = array(); $handle = opendir ('pqimages/'.$date.'/'); while (false !== ($file = readdir($handle))) { if($file != "." && $file != "..") { $picarray[] = "http://randomaydesigns.com/pqimages/".$date."/".$file.""; } } $json_array = json_encode($picarray); echo $json_array; ?> There are three files in the folder and they are 33,34,35.jpg it displays them like 33,35,34.jpg Any Recommendations? Thanks, GEORGE
  17. Hi, here is my script to get the usernames of a few members. I'm trying to encode it using JSON. <?php require("connect.php"); $date = date("Y-m-d"); $picarray = array(); $handle = opendir ('pqimages/'.$date.'/'); while (false !== ($file = readdir($handle))) { if($file != "." && $file != "..") { $getusername = mysql_query("SELECT * FROM users WHERE lastupload='pqimages/".$date."/".$file."'"); while ($row = mysql_fetch_assoc($getusername)){ $usernames= $row['username']; $people = array(); $people[] = $usernames; echo json_encode($people); } } } ?> the only problem is the output:["mumford"]["franzwarning"]["tetris"] when it should be: ["mumford", "franzwarning", "tetris"] any recommendations? Thanks, George
  18. Hi, How could I make a php script that creates a new folder (with the name as the date) every day automatically? Cheers, George
  19. Hi, I want to be able to click on the photo and go to the next one in a folder. I have this code already, I just am not quite sure how to finish it. -George <?php $count = $_GET['count']; $dir = "images"; $names = array(); $handle = opendir($dir); while ($name = readdir($handle)){ if(is_dir("$dir/$name")) { if($name != '.' && $name != '..') { echo "directory: $name\n"; } } elseif ($name != '.DS_Store' ) { $names[] = $name; } } closedir($handle); $numberofitems = count($names); $numberofitems--; if ($count <= $numberofitems){ echo "<p>"; echo "<img src='images/".$names[$count]."'>"; } else {echo "end";} ?>
×
×
  • 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.