BloodyMind
-
Posts
98 -
Joined
-
Last visited
Never
Posts posted by BloodyMind
-
-
Hi there,
I've tried this script for uploading and inserting projects details in the database
but this query doesn't work as u see i've tried all kinds of methods to write a query into php
I also echo the query and copy and paste it in PHPMyAdmin and it executes there perfectly
but it doesn't wanna work on php
if anyone got help please reply me ASAP
<?php public function addProject($in_projectName,$in_projectDesc){ try { // $user_id = $_SESSION['user_id']; $user_id = '1'; // get filename here $projectsDir = 'c:/wamp/www/computek/projects/'; $filename = Handles::uploadHandle('projectFile',$projectsDir,'Cannot upload Project.'); $parts = explode('/computek',$filename); $filename = $parts[1]; // verify the zip file if (substr($filename,-4,4)!=='.zip') { throw new Exception('We can only accept ZIP file format.'); } $filename = urlencode($filename); echo $in_projectName; echo "<br/>"; $prosql = <<<EOP INSERT INTO projects(pro_title,pro_file,user_id) VALUES('$in_projectName','$filename','$user_id') EOP; echo $filename; echo "<br/>"; /* $prosql = sprintf("INSERT INTO projects(pro_id, pro_title,pro_filename,user_id) VALUES('NULL','%s', '%s', '%d')",$in_projectName,$filename,$user_id);*/ // insert project's details into the projects table /*$prosql = "INSERT INTO projects(pro_title,pro_filename,user_id) VALUES('" . $in_projectName . "', '" . $filename . "', '" . $user_id . "');";*/ /* $prosql = <<<EOPRO INSERT INTO projects SET pro_title='{$in_projectName}',pro_filename='{$filename}',user_id='{$user_id}'; EOPRO;*/ echo $prosql; echo "<br>"; $results = $this->conn->query($prosql); if ($results == FALSE) { throw new Exception('Cannot Execute Project Query'); } } ?>
Thank you in Advance
-
mate just send an HTML MIME Email
google this: php html mime email tutorial or anything like that u'll find good ones
hope that helped
-
I have checked the arguments but everything seems fine
anyone got a clue ?!!!
-
Hey there,
I got a problem with the file upload in an advanced contact form which have attachments for Resume and such
my problem is when i upload the file
I get this Error:
Warning: move_uploaded_file(/home/xxx/public_html/test/attachments/) [function.move-uploaded-file]: failed to open stream: Is a directory in /home/xxx/public_html/test/contact.php on line 13
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpaOoPbE' to '/home/xxx/public_html/test/attachments/' in /home/xxx/public_html/test/contact.php on line 13
and i have the permission to attachments to '777'
does anyone got a clue?
thanx in advance for your support
-
I spotted the problem sorry for confusing you
and thanx alot for trying to help
it was just an = in an condition which made it non-object
-
It's a simple select query as u see nothing is wrong with it
and I didn't get u ionik actually I was trying to separate queries in a class so i can modify it easily later but i think i'll change this strategy now
and do it as i used to
-
<?php public function getUserLogin($in_username){ $this->query = <<<EOQUERY SELECT * FROM users WHERE username = '$in_username'; EOQUERY; $result = $this->db->query($this->query); try { if($result == FALSE){ throw new Exception('Error:Cannot execute check query'); } }catch (Exception $e){ echo $e->getMessage(); } if (is_object($result) == false) { echo "not object"; } return $result; } // here is where the function call gets the error private function confirmUserNamePasswd($in_user_name, $in_user_password,$in_db_conn = NULL){ /* - internal arg checking - get a connection - get the record for the username. - verify the password */ if ($in_db_conn == NULL) { $conn = $this->getConnection(); }else { $conn = $in_db_conn; } try { // 2. make sure incoming username is safe for queries. $user_name = $this->super_escape_string($in_user_name,$conn); // 3. get the record with this username if (!is_object($DA)) { $DA = new usersDataAccess(); } // here Supposed to return the object $results = $DA->getUserLogin($user_name); if ($results = FALSE) { throw new DatabaseErrorException($conn->Error); } // 4. re-confirm the name and the passwords match $login_ok = FALSE; // here when i try to use the passed $results I get the error while ($row = $results->fetch_assoc() !== NULL) { if (strcasecmp($row['username'],$user_name) == 0) { // good, name matched. does password? if (strcasecmp(md5($in_user_password),$row['password']) == 0) { $login_ok = TRUE; $user_id = $row['user_id']; }else { $login_ok = FALSE; } break; } } $results->close(); }catch (Exception $e){ if (isset($conn) and $in_db_conn === NULL) { $conn->close(); } throw $e; } // only clean up what we allocated // if there wasn't a db con we close it to clean if ($in_db_conn === NULL) { $conn->close(); } // throw on failure, or return the user ID on success if ($login_ok == FALSE) { throw new Exception('Invalid username/password'); } return $user_id; }
The Error
Fatal error: Call to a member function fetch_assoc() on a non-object in C:\wamp\www\computek\bizlogic\userManager.php on line 334 -
can I make a function that returns an object ?
coz I have made that using mysqliResult object and tried to pass it to a function but i get this error
Call to a member function fetch_assoc() on a non-object -
I use windows XP
WAMP bundle
no I just tried to change the permission via "folder properties" not chmod
and how can I use chmod for directories?
and I use windows xp pro. if that has something to do with my problem
thanx in advance!
hope anyone can help !
-
windows XP
I think it's something with apache modules
because I had a similar problem with files then I disabled a module called authz_files or something like that
it worked since then
but with directories i dunno what to do
-
I use WAMP and actually i can't modify
any directories write access
I remove the read only from the directory and then check the attributes again I find it read only
does anyone can help ?
-
well actually It's coz of permissions I use windows XP
and then if i edit the attributes of the file and uncheck the Read Only
then when i try to access it again I find read only checked
it's something with the apache I guess but I don't think the allow_url_fopen is a good idea
I solved it by disabling an apache extention which was authz_file or something like that i can't remember
but i'm not sure i'm doing the right solution.
and I still find the same issue with directories when i try to write a new file to a directory i always find it read only when i uncheck it I find it read only again :S
Thanx guys for trying to help
-
Problem:
fopen(C:/wamp/www/phpTask/dataAccess/data.txt) [function.fopen]: failed to open stream: No error in C:\wamp\www\phpTask\dataAccess\dataAccess.inc.php on line 26
Warning: fopen(http://localhost/phpTask/dataAccess/data.txt) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections
does anyone got a clue
I use windows XP btw if it is a problem with apache
-
thanks alot I can make a default value of a date to solve this
thanx alot for your help
-
now i have my database contains the table of bookings:has start date, and end date
but i want to know the logic to
check if some bikes are available or not!
-
maybe there is a problem with datatypes
would u explain your problem more ?
-
can u explain more ?
and btw
I see $result is always true
u can say
<?php if ($numrows > 0) { // do this }else { // do something else } ?>
-
thanx alot KeeB
I've been stuck of thinking of procedural programming
like bottom up planning and it was hard
but finally my latest method of planning
is to write the abstract functions of the system to subsystems
then break them down to classes
but this way seems better thanx again for the info
-
find PHP 5 unleashed it's useful or core web application developement with PHP/MySQL
but anyways streams as i know is the network streams or sockets
-
yes you made the function but you didn't call it and yes use if statement
and btw you got syntax errors better use a debugger like Zend Studio or PHP Designer
for example you should write something like this
if(checkmail($_POST['email']) !== FALSE && checkForm($name,$lname,$subject,$email,message) !== FALSE)){ mail($to, $subject, $message, $email); }else{ echo "Please fill in all fields correctly"; }
-
well actually i found out that these arguments are optional anyways but i dunno what the hell is going on!!
-
When I instantiate it like this:
$dom = new DOMDocument();I get this warning:
domdocument::domdocument() expects at least 1 parameter, 0 given
if I instantiate it like this
$dom = new DOMDocument('1.0', 'utf-8');I get this warning:
Warning: domdocument::domdocument() expects parameter 2 to be long
Then after both warnings I get this fatal error too:
Fatal error: Call to undefined method domdocument::load()
What shall I do?
Is that the domxml extention is hallucinating ?
Cannot Execute Query in PHP, Executes in PhpMyAdmin
in PHP Coding Help
Posted
this is just a part of a function in a class
but i just put the part with the bug just not to confuse you with alot of code!
if you'd like me to paste all the class it's okay but i use this function solely it just used the file handle static method that returns the uploaded file and i have no problem with it
the point is that I execute this query in PhpMyAdmin and it works and not working on the script itself !!
I've copied and pasted this query from php and pasted it in phpMyAdmin and it works
I'm losing my mind seriously
and I have rewritten it in several methods including spritntf(), heredoc and concatenation of vars and nothing is happening but catching this exception