jazzman1
Staff Alumni-
Posts
2,713 -
Joined
-
Last visited
-
Days Won
12
Everything posted by jazzman1
-
Good explanation, but..... why did you get different error messages ? Open up phpmyadmin, go to sql tab (on the top), and copy/paste this code, post out the result: SHOW GRANTS FOR 'root'@'localhost'; and SHOW GRANTS FOR 'testuser'@'localhost'
-
Which part of this statement does not work ? Did you replace it with your tables and columns name ?
-
This warning: there is nothing to do it with the host name. Do you have access to DB through any php web or desktop applications ?
-
No problem young lady Instead of your $query use this: $query = sprintf("INSERT INTO `t_documentos` SET `documento_titulo_esp` = '%s',`documento_titulo_cat` = '%s',`documento_path_esp` = '%s',`documento_path_ca` = '%s'", mysql_real_escape_string($documento_titulo_esp), mysql_real_escape_string($documento_titulo_cat), mysql_real_escape_string($filePath_1), mysql_real_escape_string($filePath_2));
-
According this result, string(11) "myfile1.pdf" string(11) "myfile1.pdf" string(23) "C:\wamp\tmp\phpF2CF.tmp" string(23) "C:\wamp\tmp\phpF2CF.tmp" you have to images with the same name, but it's no true, right ? Check the name of $fileName2 = $_FILES['documento_path_cat']['name']. There is something wrong
-
You want documento_path_esp to be "documento_path_esp = myfile1.pdf" or "documento_path_esp = ../uploads/myfile1.pdf" ? Get rid of this code, and check what result you get in DB: $filePath_1 = $uploadDir . $randName . '.' . $ext; $filePath_2 = $uploadDir . $randName . '.' . $ext; // Replace spaces with a '_' $filePath_1 = str_replace(" ", "_", $filePath_1); $filePath_2 = str_replace(" ", "_", $filePath_2); $result = move_uploaded_file($tmpName, $filePath_1); $result2 = move_uploaded_file($tmpName, $filePath_2); if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); $filePath_1 = addslashes($filePath_1); $fileName2 = addslashes($fileName2); $filePath_2 = addslashes($filePath_2); } $fileinsert[]=$filePath_1; $fileinsert[]=$filePath_2; }
-
Ok, everything is fine until here Could you explain me this code $filePath_1 = $uploadDir . $randName . '.' . $ext; I don't see you declare $randName and $ext php varibles, somewhere in your code
-
Good for you, I've started to learn php at 37 years old, now I'm 40 Ok, find this code: if($fileName=="" || $fileName2=="") { $filePath_1 = '../uploads/img/none.jpg'; $filePath_2 = '../uploads/img/none.jpg'; } else{ $filePath_1 = $uploadDir . $fileName; $filePath_2 = $uploadDir . $fileName2; } And replace with this. What result did you get ? <?php if($fileName=="" || $fileName2=="") { echo 'False'; exit; $filePath_1 = '../uploads/img/none.jpg'; $filePath_2 = '../uploads/img/none.jpg'; } else{ echo 'True'; exit; $filePath_1 = $uploadDir . $fileName; $filePath_2 = $uploadDir . $fileName2; }
-
Hm..... you need learn more of php Put in this code immediately before if($fileName=="" || $fileName2==""), and give us the results: echo '<pre>'.var_dump($fileName,$fileName2,$tmpName,$tmpName2).'</pre>';exit;
-
What a result, you expect to be ?
-
Add exit in the end, sorry : echo '<pre>'.var_dump($filePath_1, $filePath_2).'</pre>'; exit;
-
Ok, in this case you need to check the values before mysql_query sends them to DB. For example, add this code immediately before $query = "INSERT INTO t_documentos (documento_titulo_esp, documento_titulo_cat,documento_path_esp,documento_path_cat) ". "VALUES ('$documento_titulo_esp','$documento_titulo_cat','$filePath_1','$filePath_2')"; Give us a result, please. echo '<pre>'.var_dump($filePath_1, $filePath_2).'</pre>';
-
Could you post out entire mail sending script, please.
-
Try this: <?php $uploadDir = '../uploads/'; if(isset($_POST['upload'])) { foreach ($_FILES as $file) { $fileName = $_FILES['documento_path_esp']['name']; $fileName2 = $_FILES['documento_path_cat']['name']; $tmpName = $_FILES['documento_path_esp']['tmp_name']; $tmpName2 = $_FILES['documento_path_cat']['tmp_name']; $fileSize = $_FILES['documento_path_esp']['size']; $fileSize2 = $_FILES['documento_path_cat']['size']; $fileType = $_FILES['documento_path_esp']['type']; $fileType2 = $_FILES['documento_path_cat']['type']; if($fileName=="" || $fileName2=="") { $filePath_1 = '../uploads/img/none.jpg'; $filePath_2 = '../uploads/img/none.jpg'; } else{ $filePath_1 = $uploadDir . $fileName; $filePath_2 = $uploadDir . $fileName2; } $filePath_1 = $uploadDir . $randName . '.' . $ext; $filePath_2 = $uploadDir . $randName . '.' . $ext; // Replace spaces with a '_' $filePath_1 = str_replace(" ", "_", $filePath_1); $filePath_2 = str_replace(" ", "_", $filePath_2); $result = move_uploaded_file($tmpName, $filePath_1); $result2 = move_uploaded_file($tmpName, $filePath_2); if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); $filePath_1 = addslashes($filePath_1); $fileName2 = addslashes($fileName2); $filePath_2 = addslashes($filePath_2); } $fileinsert[]=$filePath_1; $fileinsert[]=$filePath_2; } $documento_titulo_esp = $_POST["documento_titulo_esp"]; $documento_titulo_cat=$_POST["documento_titulo_cat"]; $query = "INSERT INTO t_documentos (documento_titulo_esp, documento_titulo_cat,documento_path_esp,documento_path_cat) ". "VALUES ('$documento_titulo_esp','$documento_titulo_cat','$filePath_1','$filePath_2')"; mysql_query($query) or die('Error, query failed : ' . mysql_error()); header("Location: PC_documentos_display.php?documentoinserted=true"); } ?>
-
Could you post a form submission too.
-
mysql_result() expects parameter 1 to be resource
jazzman1 replied to whopunk123's topic in PHP Coding Help
Why did you put in die() in the end of the query string ? This does not make sense it supposed to be in the end of mysql_query function. -
Yes, you can do it without any problems. You need to insert the same value comes from drop down menu to different database columns. INSERT INTO tbl_name (col1,col2) VALUES('reception-room','reception-room');
-
The result of my query above is : To get the same result your variable could be: $displayheight = '5\\'.'\''.'10\\'.'"';
-
I've never tried this, but.... it could be something like this: $query = sprintf("INSERT INTO `tbl_name` SET `name` = '%s'", mysql_real_escape_string('5\\'.'\''.'10\\'.'"')); $result = mysql_query($query);
-
There is a newer version: 2.6.27
-
Accent is ok when displaying in phpMyAdmin, but not on the page
jazzman1 replied to tivrfoa's topic in MySQL Help
Before sending the query string to your database, add this: mysql_query('SET NAMES utf8"); http://forums.mysql.com/read.php?103,22311,249326 -
You need to go to the folder and to run find (search) engine in your windows explorer. I've never used windows in my life to tell you how to do this but you can google it. Take a look at this: http://www.wikihow.com/Find-the-Right-File-in-Windows-Explorer
-
Sorry, my EN grammar is not very proper. I just want to say, do you know how to find files and directories? In this case, just go to the project folder and run find command to find this class.
-
Have you been searched any files and directories before? Download a project into your local machine (or upload files into your IDE ) and run search.
-
Could you post the script from BaseTest class ?