Jump to content

franzwarning

Members
  • Posts

    31
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

franzwarning's Achievements

Member

Member (2/5)

0

Reputation

  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
×
×
  • 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.