I was wondering if anyone had thought of a useful way to get images out of BLOB fields in a database table and send them to a rendered HTML page inline. This whole calling another script via a URI that fetches the picture as a served "page" via a second request seems very redundant.
I've seen the client side encoded binary tricks through javascript, and they are clever but rely on the client's browser settings too much to be comfortable. The fact that IE refuses to implement the data: URI is a pain in the royal parts. An idea I had was to save the results as temp files and serve them that way, but again, terribly redundant - not to mention hard on the server.
So have any bright sparks come up an elegant and W3C friendly way to pull an image binary from a BLOB and include it in an tag?
(I'm aware of the database overhead with many BLOBs - this is just an exercise in extreme cleverness)
Has anyone else ever had this happen when calling an object dynamically (meaning you get $var as a string then do new $var()
The parent completely and totally ignores calls from the child?!?!?!
Child snippet:
function getProductList($attributes) {
//var_dump(get_parent_class($this));exit;
return parent::getProductList($attributes);
}
Parent snippet:
function getProductList($attributes = false) {
echo "break here";exit;
global $dbs;
//var_dump($...
I can get anything I want from the child function, nothing from the parent. The commented line above giving me the parent class shows the correct value. I mean, if the parent wasn't loaded, I'd get an error right? It extends the parent class, etc. So why can I not get anything from the parent object????
I've never had this happen and am totally perplexed. Or going insane. Perhaps I broke PHP's already weak OO structure??? Anyone ever had this happen before?
I'm an ultra goober. Had an extra bracket at the end of a function (and missing one later) that basically ended the class before that method. Duh.
Pre-question: what's a good method for displaying a script in livejournal?
Real question: Below the cut is a very quick function I wrote up to query for the existence of a table in MySQL. I want to cut it down even further and I was thinking the logic :
start table exists query `SHOW TABLES LIKE 'myTable'; if result && result num_rows > 0 then table exists? return true else return false end table exists
would be faster because it wouldn't loop. My thought is, the only way the query could return true(1+ results) is if it matched that table exactly (lack of %'s in the query expression). Anyone disagree?
I'm not sure if this is the place to discuss this, but I don't know where to ask. If not, please feel free to redirect me to the appropriate place.
I'm almost ready to release my program to the public, but I'm not comfortable with the GPL license. I'll like to use some "free for non-commercial use" license that also allows people to modify the code for their own use and distribute the modified code (but only the modified part, not everything, something like "mods") as long as is non-commercial. Commercial users will be required to pay a fee.
I searched, but the closer I found to something like this are the Creative Commons licenses.
Do you know of any license that may cover this? Thanks!
I've been searching around trying to find a util or script that will take a php script, parse all the include, include_once, require, and require_once statements, then create a new file with all the code joined together.
I have the script which allows to register new users (field 'nick' in data base) and set their default status as "simpleuser" (field 'stat' in data base). And I want a page where all new users with status "simpleuser" will be listed one after another in table. And near each nick will be form where I could select a user's new status ('moderator' or 'administrator'). And after this table will be a button for subnision which updated database with new values.
I've wtitten code. But it doesn't work :(
So, it consists of two files [B]sending.php[/B] and [B]user_submit.php[/B].
sending.php
include('connection.php');
$query = "SELECT id, nick, email FROM test WHERE stat = 'newuser'"; $result = mysql_query($query) or die("ERROR: $query.".mysql_error());
// if records are present if (mysql_num_rows($result) > 0) { $row = mysql_fetch_assoc($result); $id = $row->id;
Problem here: There is only one user shown in the table, but in the db there're many of them. Why does it show only one?
user_submit.php
if (isset($_POST['submit'])) {
include('connection.php');
$result = mysql_query("UPDATE test SET stat = '{$_POST['newstat']}' WHERE id = '{$_POST['id']}'"); // close connection mysql_close($connection);
// print success message echo 'Done'; } else { die('ERROR: Data not correctly submitted'); }
?>
The problem here is: It doesn't set new status to users. But I'm not sure that mistake which causes this problem in user_submit.php, it might be in sending.php
As I look for alternative employment I see a lot of wanted ads asking for a web designer who are proficient in several web-programming languages (they usually specify PHP/ASP/CGI-Perl), the use of several different databasing formats (Access, SQL of some sort, Oracle) - proficient in several different forms of design (Photoshop, Flash, Illustrator, FreeHand, Quark, etc) as well as being a master of JavaScript, XHTML, XML, DHTML, CSS and any other acronym they seem to have found on google.
To me this sounds like they are asking for a web-design team wrapped into one person. Am I crazy; or are they?
Originally I was looking to incorporate phpOpenTracker into our project( enteprise level +15k daily users) to record impressions, hits, and then modify the schema to add on system/application auditing. But before I start ripping into the code, is there any other open source packages that can handle some sort of weekly merge table schema along with doing internal logging of user actions (guest and authenticated users). I started writing my own logging engine, and that is most likely the best way to go, but I am running short on time.
Another package I found was TraceWatch, but it's pretty useless (non-GPL, obfuscuated code, and no suggestion of being able to purchase a license == dead end). My requirements is that we can modify/edit the entire system to our needs, it needs to be as flexible as possible (lots of lookup tables to reduce information replication), and of course GPL'd/open source or available for licensing.
We are currently seeking highly talented PHP professionals to join our team. All positions are full time, direct hire positions and relocation assistance is provided.
If you would like to learn more about the many opportunities we have within Yahoo, please forward a copy of your resume to me at carlal@yahoo-inc.com and the best number and time to reach you. I’ll review your information upon receipt and if your experiences/goals are aligned with our current needs, I’ll contact you to gather some more information about your background and interests. Yahoo! Inc is an equal opportunity employer.I look forward to hearing from you soon.
I have a question about the the 'best' (most efficient? cleanest? elegant?) way to process form data for a page. I don't know if I should process the data, update the DB, etc at the top of the page I'm displaying, or if I should handle it in a PHP file that then redirects to a page that displays HTML.
Should I:
index.php // Some code here include 'formProcessingStuff.php'; // Lots of code include 'showBody.php'; // Lots more code ?>
or
formsubmit.php //Page that processes the form
// Tons of code that processes and validates info and updates DB
// Now we want to give the user a page to see what he just did header('Location: displayContentPage.php');
?>
displayContentPage.php // Code that shows the body of the page ?>
The latter seems much cleaner and easier to see and understand and code. More encapulation to make updates easier down the line. But is this a Good Practice? Is it acceptable? What problems/drawbacks might I run into?
what im looking for is a script to find out who in my database is available/online and put their ad on the main page. sort of like at the bottom of forums where its says who is active, but with a photo and link. super simple. let me know how much. edanya at edanya dotcom :o)
I'm at a loss for what is causing this error and not moving an uploaded file, if someone could take a look at the code and see what I might be missing would be appreciated, here is the output: Upload: 617.txt Type: text/plain Size: 8.900390625 Kb Stored in: /tmp/phpMhLXr8 Warning: move_uploaded_file(1/617.txt): failed to open stream: No such file or directory in /mnt/w0701/d15/s12/b0287a72/www/media-n.org/playlist/upload_file2.php on line 18
Warning: move_uploaded_file(): Unable to move '/tmp/phpMhLXr8' to '1/617.txt' in /mnt/w0701/d15/s12/b0287a72/www/media-n.org/playlist/upload_file2.php on line 18 Stored in: 1/617.txt1
This post has been heavily edited because I realized my problem and now have another question so sorry for any confusion
My original question was about the data from 3 tables not being displayed properly and I realized that my query was not actually returning results simply because the other two tables did not have data in them yet. (This is going to be added later) This brings me to my next question.
Is there some way that I can have it check for data in the other table (I now only have two data tables instead of 3 - Company and CallDetail) and if there is data there, append the query to the regular query. I have an idea how to do this but I'm not sure if it makes logistical sense. I need to be able to check if there have been any additions to the second table (CallDetail) for each Company and include the data when the page is loaded (if there is data to be loaded). I hope this makes sense. :\ Thanks again for your help.
I want to find a list of hostnames that were logged in between a given time period (say, one hour). In this example, I want the 4 hostnames that were being used on 2007-01-25 between 09:00:00 and 09:59:59. What query would I use to pull out those four hostnames? I'm being thrown off by the hostname with tid=256, which was being used between 9 and 10 but it wasn't logged in or out during those times. Can I even capture the data I need with the current schema? If I need to change something, that's not a problem.
If y'all could help me out I'd appreciate it. Thanks!
Edit: A friend and I got it figured out:
select thostname from login where time(tlogintime) < time('09:59:59') AND time(tlogouttime) > time('09:00:00') AND date(tlogintime) = date('2007-01-25');
I am still new at PHP programming and have already picked up some tips by watching this community. This is my first time posting and I hope to solve my problem this way. Thanks in advance!
Ok, here is what I'm trying to do. I have installed the email package 'Roundcubemail' on the hosting server and website and am trying to modify the code so that I can add a fixed message to each email that will be sent out. Something like a disclaimer at the bottom of business emails.
File 1 --------> In the following directory, I found this file...
/mysite/roundcubemail/config/main.inc.php
and this code....
171> // path to a text file which will be added to each sent message
172> // paths are relative to the RoundCube root folder
173> $rcmail_config['generic_message_footer'] = '';
File 2 -------> Then, I found this file in directory...
File 3 -------> Ok, I have created a text file 'footer.txt' and added a new directory '/mysite/roundcubemail/footer/' that now contains my footer-file.
I want to write a php program that involves recognizing the URL of the page the user is currently on, but I'm not sure exactly how to do this.
What I want from the program is basically this: If Current URL is ____ then on link click go to this _____ URL. else if current URL is _____ then on link click go to this ____ URL. . . . etc.
Is there a way to call the current URL and do this?
It's been a while since i posted in here, but last time i got a great response and was sorted out quickly, so fingers crossed someone can spot the mischievous bit of code that is causing me problems and help me out :)
I am populating a drop down menu from a DB. I have sub categories and articles within those Subcats. I want the drop down to list the sub categories, then if there is only ONE article attached to that Subcat then it ges to a paage to display that article. If there are more than one, then it goes to a page that lists the articles for the user to choose.
I had the code working fine to display when just one article is assigned to each subcat. It even works when there is more than one.
HOWEVER, the problem is that if there is more than one article per subcat, it repeats the subcat name in the drop down. So if there are two articles, it lists the subcat twice, three articles shows three subcats, etc.
anyone able to look through the code and see where i am going wrong? :) pretty please? :)
many thanks in advance!
---lots of other php stuff up here, including an if statement just before the cut off point---
$catid = $rowCat['cat_id']; } // end if isset
$subcatSQL = "SELECT DISTINCT c.cat_id, c.cat_title, c.cat_parentid, c.cat_type, c.cat_visible"; $subcatSQL .= " FROM tbl_cats c"; $subcatSQL .= " WHERE c.cat_visible=1 AND c.cat_parentid = '$catid'"; $subcatSQL .= " AND c.cat_type LIKE 'articles%'"; $subcatSQL .= " ORDER BY c.cat_id ASC"; $rsSubCat = mysql_query($subcatSQL, $conn) or die("Query failed : " . mysql_error()); while($rowSubCat = mysql_fetch_array($rsSubCat)){
$subcatid = $rowSubCat['cat_id'];
$artSQL = "SELECT a.art_id, a.art_title, a.art_visible, ac.artcat_artid, ac.artcat_catid"; $artSQL .= " FROM tbl_articles a, tbl_art_cats ac"; $artSQL .= " WHERE ac.artcat_catid = '$subcatid' AND ac.artcat_artid = a.art_id"; $artSQL .= " ORDER BY a.art_id ASC"; $rsArt = mysql_query($artSQL, $conn) or die("Query failed : " . mysql_error()); $num_rows = mysql_num_rows($rsArt);
while($rowArt = mysql_fetch_array($rsArt)){
if ($num_rows > 1) { ?>
} elseif ($num_rows = 1) { ?>
} //end of elseif
} // end rowart while } //end rowsubcat while } // end of rowcat while ?>
Okay, well. Whatever. I'm really novice at all this and I'm not absorbing any of this information in the least. I'm using w3schools.com and it's like a maze to actually find something. Anyways, I'd like to know if I can find out what all of this means. It's just a request your password page, but I don't know how to change the body (I believe it's the "invite:password:request") How do I find what document has that? That's the first question. how to locate those.
Second question: I keep getting " require_once(dirname(dirname(__FILE__))."/includes.php"); ". I don't understand why it keeps using that. Well, again, just ask for whatever you want to find out things that aren't clear yet. It's a pre-written script that I'm trying to take apart. One of the main things I want to do is take off this drop down menu at the top of every page that lets you select a language since I only want English.