|
hello everyone! i want to upload photo, i have tag img and button (i dont use type="file") i want to write code to open directory as type="file" on button, but i can't solve it. please help me!
regard
thanks!
|
|
|
|
|
use tag input, not button
A hidden needle is way more effective than an unsheathed sword.
That is, in the hand of professionals.
What about you?
Just pray your enemies are blind
|
|
|
|
|
First time developing in PHP. Used to coding in c#, so feel free to make fun of me.
Here is the code I am using:
<?php
$response = file_get_contents($url);
$jsonResults = json_decode($response, true);
echo "Title: ".$jsonResults['items']['0']['volumeInfo']['title'];
echo "Title: ".$jsonResults['items']['1']['volumeInfo']['title'];
for ($i = 0; $i < $jsonResults['items'].length; $i++) {
echo "Link: ".$jsonResults['items'][$i]['volumeInfo']['title'];
}
?>
Now the json results look like this:
array(3) {
["items"]=>
array(10) {
[0]=>
array(7) {
<snipped>
["volumeInfo"]=>
array(12) {
["title"]=>
string(64) "MyTitle"
<snipped>
}
*****************
"We need to apply 21st-century information technology to the health care field. We need to have our medical records put on the I.T." —GW
|
|
|
|
|
PHP doesn't use the . operator for class members. If $jsonResults['items'] was an instance of a class, then the way to access the length member would be $jsonResults['items']->length .
Native arrays are not classes though, so to find their length you need to use the count function:
<?php
$length = count($jsonResults['items']);
for($i = 0; $i < $length; $i++) {
echo "Link: ".$jsonResults['items'][$i]['volumeInfo']['title'];
}
or you could use foreach instead of for :
<?php
foreach($jsonResults['items'] as $item) {
echo "Link: ".$item['volumeInfo']['title'];
}
|
|
|
|
|
I always sizeof() thou
A hidden needle is way more effective than an unsheathed sword.
That is, in the hand of professionals.
What about you?
Just pray your enemies are blind
|
|
|
|
|
Thank you both!
*****************
"We need to apply 21st-century information technology to the health care field. We need to have our medical records put on the I.T." —GW
|
|
|
|
|
Hi there,
I'm quiet new to the PHP language, tho I have mostly programmed in C# in .NET platforms. Now I want to get some experience with the opensource part of the web development.
I know the basic coding for PHP (the syntax), but I'm not sure about which app is the best to make dynamic PHP programming in (like MS Visual Studio for C#), which patterns is a most, which do I have to code by hand, and which can be autogenerated by the developer app?
I'm especially curious about the possibilities of doing DataMapping, like DataBase Markup Language/LinQ to SQL in Visual Studio for C#, where Database tables are being related to code objects like:
UML diagram:
http://yuml.me/diagram/scruffy/class/[Phones]1->*[Category]
Code with ORM to the DB table:
Phone p = new Phone();
Or how do you guys handle objects in PHP, where Foreinger keys between tables can happen, in a easy way?
|
|
|
|
|
|
Cheers, will look at the possibilities.
So, when you have to program a PHP web app by your own, do you hand code all patterns needed to control objects between each others? Like controlling FKs between relations.
|
|
|
|
|
yes I hand code it, including table/data relations. But I have what I guess would be a custom pattern I have developed over the years and find it able to adjust and handle any web/app I can toss at it while still being readable and flexible.
Chris J
www.redash.org
|
|
|
|
|
|
Hey CodeProject!
So I'm trying to make a query in PHP and mySQL..
One of the database tables has a value I want to SELECT DISTINCT while selecting everything else regularly with an asterisk (*).
Example:
<br />
<br />
$model_select = "select DISTINCT model FROM models where shw=1 ORDER BY modelid";<br />
$model_select = "select * FROM models where shw=1 ORDER BY modelid";<br />
<br />
Is there a way I can do both DISTINCT and * in the same query command? Or is there a way around this without making 2 queries?
It would be great if I could 'cause I'm using the mysql_fetch_array thing.
Thanks.
-Paul
|
|
|
|
|
I don't know, however I think it can't be done because the results would be undefined.
Assume the MODELS table holds the following data:
field1 field2
1 2
1 3
1 4
5 6
7 8
7 9
If you do "SELECT DISTINCT field1 FROM MODELS" you would get 1, 5, and 7.
Now there are three rows with field1=1, which field2 value should contribute to the result?
Assuming "SELECT field2, DISTINCT(field1) FROM MODELS" would be accepted, the field2 values would be unpredictable, i.e. the query is ambiguous.
Things would make more sense if you would need, and were allowed to do, the following:
"SELECT MAX(field2), DISTINCT(field1) FROM MODELS"
PS: this isn't a PHP question, it is a database related question, the MySQL forum would have been a better choice.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
I think you can use
select distinct * from tablename where col='mycondition'
or you may select only required columns, if you get unexpected rows
select distinct model,col1,col2,col2 from tablename where col='mycondition'
|
|
|
|
|
A sub-select with a GROUP_CONCAT should do it....although I have not test this query.
select GROUP_CONCAT((select DISTINCT model FROM models where shw=1 ORDER BY modelid)) as mod_name, * FROM models where shw=1 ORDER BY modelid
this would return the subselect as a comma seperated value on each row by a column named "mod_name".
I would advise that you do not use the "*" in the other query as this forces mysql to do a secondary query to find and return the column names for the table models, it is better to just set them in the query to improve performance.
Chris J
www.redash.org
|
|
|
|
|
Hi All,
<?php
echo "Hello World";
?>
This index.php is not outputting anything to the browser but I can copy this file to another computer and it works as expected. Also, on the problem machine phpinfo() works fine and displays everything you'd expect.
I'm running Ubuntu 11.04 32-bit, Apache 2.2.17, and PHP 5.3.5-1. I'm guessing there must be something wrong with the php configuration but I haven't a clue as to what that might be. I've also tried print() as well and get the same results.
Suggestions?
Thanks much for any help...
|
|
|
|
|
First, I would check that the page is actually blank, and not just serving the PHP as HTML.
The next thing I would check is the file permissions.
After that I would take a look at the server log to see if there are any errors reported there.
Next, I would make sure display_errors and error_reporting are turned on and insert an error into the page to make sure it is actually being executed.
|
|
|
|
|
Thanks,
display_errors help a lot. I had a parsing error. I wasn't able to see it in nano but when I erased it and re-typed the line, it worked fine.
|
|
|
|
|
Hi, I am new to PHP. I am currently working on CRM project, I need to keep track of email status and update into my database such as who read the email or who opened?, who deleted?, who replied? and also When was the email opened/deleted/replied? Date and time. is there any possible to track if someone has read the email or hasn't which I have sent the email to them?
|
|
|
|
|
And you are what, writing the mail client then. No mail client will ever sent you a notification upon deletion, reading or reply.
You could try a redirect under each and every link in the e-mail, or possibly the images used in the e-mail. And you could track the hits this redirect page gets. This would give you a somewhat decent overview of how many people open / read. But again delete is a lot harder if not impossible to track.
|
|
|
|
|
thanks for your reply, I used images with my message content, I got read status. but I need delete status. First of all I want to know is it possible to track for delete? if yes is there a way to find out if someone delete the email which i have been sent?
|
|
|
|
|
If my memory serves IMAP has some features for this but your code has to manage this. If the user can connect to the email via an outside email program, outlook for example, then I do not think you can do anything about it.
You may look at your email server, the actual software that manages the email, and see if it has any kind of user logging features.
try read this in the php manual http://php.net/manual/en/function.imap-delete.php[^]
Chris J
www.redash.org
|
|
|
|
|
Dear,
I am a self learner, i wanted to know " How to browse a .php file and which compiler is used to compile?
|
|
|
|
|
If your PHP files are related to web sites, you can use a web server that supports PHP. Xampp[^] would be one example; it will interpret the required PHP files on the spot; it can also be used to just compile-and-run a PHP file, as PHP is a general programming language, not necessarily linked to web stuff. You'd have to look the details up in the manual of your PHP system.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Hey Friends
I got a XP Machine, Active Perl Installed, Symbian SDK 0.9 installed & Carbide C++ installed & creating new symbian project.
When i compile the project, i get the error BLDMAKE ERROR: Can't find any RVCT installation.
Any idea what is that ? & how to fix it?
Regards
|
|
|
|