RE: [PHP] File upload
>The upload_single.php script is just this: >$ime = $_FILES["thefile"]["name"]; > print ($ime); >?> >I just want for begining to print the name of file. >But It doesn't work. Do you get anything if you change "name" to "tmp_name" to beging with? If I'm not mistaken ,"name" isn't filled in with anything unless You've used move_uploaded_file() first. Also check if uploads are enabled in php.ini. Oh, and if you have permissions to write in The tmp directory as well. /Jonas --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.501 / Virus Database: 299 - Release Date: 2003-07-14 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] File upload
>> maybe you should try $HTTP_POST_FILES? >I have tryed that too, but nothing happened. Hm, can't think of whatever else is wrong right Now but I just tried out your script on my Server just to see, and it outputs the Filename alright. So it's nothing wrong With your script. Granted, my server is Windows/IIS instead of Linux/Apache so Maybe there's something wrong with the Httpd.conf file somewhere? /Jonas --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.501 / Virus Database: 299 - Release Date: 2003-07-14 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] file_put_contents()?
Another stupid newbie question...(btw, is there a list more geared towards the newbies?) Is the file_put_contents() function not available in PHP 4.3.2? The reason I ask is that I get this error when I try to use it: Fatal error: Call to undefined function: file_put_contents() File_get_contents work though. Or maybe I am using it wrong? This is how I try to do it: $handle=file_put_contents($filename,$fil); With $fil filled with what I want in the file named $filename (both $fil and $filename are filled with the appropiate content). --- "... and pray that there's intelligent life somewhere out in space, because there's bugger all down here on Earth!" - Eric Idle - the Meaning of Life --- /Jonas --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.501 / Virus Database: 299 - Release Date: 2003-07-14 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP, MySQL and null?
Okay, how do I make PHP 4.3.2. and MySQL 4.0.13 to agree on what null means? I'm trying to get a form to add a new record into my database where one of the Fields might be null and for said field to actually be a null record once into The database as well... This is the script in question (a simple "Let the user add links to the site" thingy). It may not be the most elegant way of solving things...($name,$url and $comment are Variables found in $_POST if it's not obvious btw). 0): echo "Sorry, that name already exist!"; return; endif; mysql_free_result($result); $query = "SELECT id from site where url=\"$url\""; $result = mysql_query($query) or die("Query failed : " . mysql_error()); while ($row = mysql_fetch_row($result)) { $fail2=$row[0]; } if ($fail2>0): echo "Sorry, that URL already exist!"; return; endif; mysql_free_result($result); $name2=mysql_escape_string($name); $url2=mysql_escape_string($url); $comment2=mysql_escape_string($comment); $query = "INSERT into site(id,name,url,comment) VALUES (null,'$name2','$url2','$comment2')"; $result = mysql_query($query) or die("Query failed : " . mysql_error()); mysql_close($link); echo "Sitename=$name"; echo "Site's URL=$url"; if (is_null($comment)): echo "No comment"; else: echo "Comment=$comment"; endif; echo "Added!"; ?> If I have null direcly in the query string (like this part...VALUES (null,'test'...) it works Like excepted (the id field is an auto_increment one so the id is automatically changed to The next available id-number). However, what fails is when I set a variable to be null and adds that to the query. The Record is inserted into the database alright but the comment-field (in this case) doesn't Get filled in with MySQL's the null-value. It gets filled with a zero-length string instead Which screws things up, since I no longer can use constructs like "select id,name from site where comment is null;" Not a problem on this specific table but on another table where I'm about to write the insert-script it is a Huge problem! Many thanks if someone has a good solution for this! --- "... and pray that there's intelligent life somewhere out in space, because there's bugger all down here on Earth!" - Eric Idle - the Meaning of Life --- /Jonas --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.501 / Virus Database: 299 - Release Date: 2003-07-14 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP, MySQL and null?
>Have you tried inserting it without including the id field in the insert statement? I have several tables with auto increments and I never even bother >putting that field in the insert statement. Well, no. But that's not where the problem is. If I was unclear - the id-field work as it should. It's when I try to use A variable in the query-string the problem pops up. IOW - INSERT INTO SITE (id,name,url,comment) VALUES (null,'testname','testurl','testcomment'); Works INSERT INTO SITE (id,name,url,comment) VALUES (null,'$name','$url','$comment'); Does not when I've set $comment=null; If every field has a proper value (when everything had been filled in on the form), Everything works as expected. /Jonas --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.501 / Virus Database: 299 - Release Date: 2003-07-14 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP, MySQL and null?
Sorry, wrote wrong here so one more try. Well, no. But that's not where the problem is. If I was unclear - the id-field work as it should. It's when I try to use A variable in the query-string the problem pops up. IOW - INSERT INTO SITE (id,name,url,comment) VALUES (null,'testname','testurl',null) Works INSERT INTO SITE (id,name,url,comment) VALUES (null,'$name','$url','$comment') Does not when I've set $comment=null; If every field has a proper value (when everything had been filled in on the form), Everything works as expected. /Jonas --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.501 / Virus Database: 299 - Release Date: 2003-07-14 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php