franzwarning
Members-
Posts
31 -
Joined
-
Last visited
Never
Everything posted by franzwarning
-
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
-
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
-
Alright, you've convinced me. Cheers, Raymond
-
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.
-
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?
-
I plan on storing multiple user_id's in binary format, assuming each id is an int (4 bytes).
-
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
-
Randomly Select the last two images in a folder
franzwarning replied to franzwarning's topic in PHP Coding Help
Thanks! Figured it out. -
How would I go about randomly selecting the last two photos (jpgs) in a folder and echoing the url? Cheers, George
-
Determine last three characters of a string.
franzwarning replied to franzwarning's topic in PHP Coding Help
awesome, thank you! -
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
-
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
-
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
-
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
-
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
-
what does fk mean?
-
excellent thanks!
-
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
-
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
-
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
-
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
-
Hi, How could I make a php script that creates a new folder (with the name as the date) every day automatically? Cheers, George
-
You just made my day.
-
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";} ?>