jazzman1
Staff Alumni-
Posts
2,713 -
Joined
-
Last visited
-
Days Won
12
Everything posted by jazzman1
-
Can you give us the error which is spitting out from firebug, just copy/paste it to here, without any editing.
-
We could not help you if you do not post entire error log string coming from the server.
-
Well, check for empty space after or before a "/" symbol.
-
That's very weird, b/s the file is not php, the file format is CSV! Could you show us the entire error, please.
-
If I understand you correctly , you want every time to append a new content to the same directory and file name, right? But....actually the name of that directory would be change every time b/s of the timestamp.
-
Well, what values do you get to $timestamp and $decoded variables when the form has been submitted? You know that timestamp is a dynamic value, right? Example: // decode JSON string to PHP object $timestamp = json_decode($_POST["timestamp"]); $decoded = json_decode($_POST["json"]); echo $timestamp.' '. $decoded;
-
That's a part of my php.ini directive on the local machine, everything works just fine. file_uploads = On upload_max_filesize = 2048M max_file_uploads = 2M post_max_size = 2048M <?php error_reporting(-1); echo 'file count=', count($_FILES),"\n"; var_dump($_FILES); echo "\n"; ?> <form enctype="multipart/form-data" action="debug.php" method="POST"> Choose a file to upload: <input name="uploadedFile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> Results: The test has been made it with 36086115 bytes (34.4MB) video file.
-
Hm...that's weird Did you really increase the value of max_file_uploads in the php.ini directive?
-
How do you initialize your database name?
-
There are too much ifs,empties, strlens. I don't see arrays in your script.
-
Parse error: syntax error, unexpected 'or' (T_LOGICAL_OR)
jazzman1 replied to bleured27's topic in PHP Coding Help
But.... how is possible to get "Parse error: syntax error, unexpected 'or' (T_LOGICAL_OR)" without an "OR" operator in the connection.php file? Jessi, what do you think about that? -
Parse error: syntax error, unexpected 'or' (T_LOGICAL_OR)
jazzman1 replied to bleured27's topic in PHP Coding Help
By the way, read is a reserved word in mysql, you must use backticks. -
Parse error: syntax error, unexpected 'or' (T_LOGICAL_OR)
jazzman1 replied to bleured27's topic in PHP Coding Help
That one is not correct: $num_rows =0 Use double equal to compare to values. If you comment the code do you get the same error? Example: <?php require('connection.php'); /** $result = mysql_query("SELECT * FROM $table_messages where reciver='$user' and read !='1'", $con); $num_rows = mysql_num_rows($result); if($num_rows =0 ){echo " no messages";}else{ echo $num_rows." messages";} */ ?> -
Parse error: syntax error, unexpected 'or' (T_LOGICAL_OR)
jazzman1 replied to bleured27's topic in PHP Coding Help
No, you don't have it. I don't see "or" operator in your string. Do you have a "OR" operator somewhere in the connection.php file? -
Parse error: syntax error, unexpected 'or' (T_LOGICAL_OR)
jazzman1 replied to bleured27's topic in PHP Coding Help
Do you have something similar in your connection.php file: $conn = mysql_connect('localhost','jazzman','password', 3306); or die(mysql_error()); -
If that one is true, open the apple terminal and give it a full permission as root to an "dispatchreportsfolder" using a chmod unix command with recursive in the end. Example: [jazzman@localhost ~]$ chmod 777 /Library/WebServer/Documents/dispatchreports/dispatchreportsfolder -R
-
Well, "dispatchreports" is not the same to "DispatchReports". Can you explain as this ?
-
Why your while loop starts with capital "W" ?
-
I rewrote your scripts a little, Take a look at that example: form.php <?php require_once("models/config.php"); securePage($_SERVER['PHP_SELF']); require_once("models/header.php"); echo " <body> <div><img width='500px' src='images/logo_its_your_cloud.png' /></div> <div id='container'> <div id='innermenu'> "; include("nav.php"); echo " </div> <div id='innermain'> <table> <form method='post' action='addcar.php' enctype='multipart/form-data'> <tr> <td align='center'><h2>Car Details</h2></td> </tr> <tr> <td><label>Make</label></td> <td><input type='text' name='make'/></td> </tr> <tr> <td><label>Model</label></td> <td><input type='text' name='model'/></td> </tr> <tr> <td><label>Price</label></td> <td><input type='text' name='price'/></td> </tr> <tr> <td><label>Mileage</label></td> <td><input type='text' name='mileage' size=30 /></td> </tr> <tr> <td><label>Year</label></td> <td><input type='text' name='year' size=30 /></td> </tr> <tr> <td><label>Reg Number</label></td> <td><input type='text' name='reg' size=30 /></td> </tr> <tr> <td><label>Engine</label></td> <td><input type='text' name='engine' size=30 /></td> </tr> <tr> <td><label>Transmission</label></td> <td><input type='text' name='trans' size=30 /></td> </tr> <tr> <td><label>Fuel</label></td> <td><input type='text' name='fuel' size=30 /></td> </tr> <tr> <td><label>Doors</label></td> <td><input type='text' name='doors' size=30 /></td> </tr> <tr> <td><label>Seats</label></td> <td><input type='text' name='seats' size=30 /></td> </tr> <tr> <td><label>Owners</label></td> <td><input type='text' name='owners' size=30 /></td> </tr> <tr> <td><label>Colour</label></td> <td><input type='text' name='colour' size=30 /></td> </tr> <tr> <td><label>Interior</label></td> <td><input type='text' name='interior' size=30 /></td> </tr> <tr> <td><label>Exterior</label></td> <td><input type='text' name='exterior' size=30 /></td> </tr> <tr> <td><label>MOT</label></td> <td><input type='text' name='mot' size=30 /></td> </tr> <tr> <td><label>Tax</label></td> <td><input type='text' name='tax' size=30 /></td> </tr> <tr> <td><label>Aditional Information</label></td> <td><textarea type='text' name='info'></textarea></td> </tr> <tr> <td><label>Photo1</label></td> <td><input type='hidden' name='size' value='350000'><input type='file' name='photo[]'></td> </tr> <tr> <td><label>Photo2</label></td> <td><input type='hidden' name='size' value='350000'><input type='file' name='photo[]'></td> </tr> <tr> <td colspan='2' style='padding-top:50px'><input TYPE='submit' name='upload' title='Add data to the Database' value='Add Vechicle To The Database'/></td> </tr> </form> </table> </div> <div id='container'> <div id='mainbottom'>"; include("copy.php"); echo"</div> </div> </div> </body> </html>"; ?> addcar.php <?php error_reporting(-1); $conn = mysql_connect('localhost','jazzman','password', 3306) or die(mysql_error()); $db_name = mysql_select_db('test') or die(mysql_error()); //This is the directory where images will be saved $target = "../images/forsale"; //This gets all the other information from the form $make=$_POST['make']; $model=$_POST['model']; $price=$_POST['price']; $mileage=$_POST['mileage']; $year=$_POST['year']; $fuel=$_POST['fuel']; $trans=$_POST['trans']; $reg=$_POST['reg']; $engine=$_POST['engine']; $doors=$_POST['doors']; $seats=$_POST['seats']; $owners=$_POST['owners']; $colour=$_POST['colour']; $interior=$_POST['interior']; $exterior=$_POST['exterior']; $mot=$_POST['mot']; $tax=$_POST['tax']; $info=$_POST['info']; // use static values in that case $pic1= basename($_FILES['photo']['name'][0]); $pic2= basename($_FILES['photo']['name'][1]); if(!empty($_FILES['photo']['tmp_name'])) { // prepare insert query statement $sql = "INSERT INTO iyc_forsale (make,model,photo,photo1,price,mileage,year,fuel,trans,reg,engine,doors,seats,owners,colour,interior,exterior,mot,tax,info) VALUES ('$make', '$model', '$pic1', '$pic2', '$price', '$mileage', '$year', '$fuel', '$trans', '$reg', '$engine', '$doors', '$seats', '$owners', '$colour', '$interior', '$exterior', '$mot', '$tax', '$info')"; // Number of uploaded files $num_files = count($_FILES['photo']['tmp_name']); /** loop through the array of files ***/ for($i=0; $i < $num_files;$i++) { // check if there is a file in the array if(!is_uploaded_file($_FILES['photo']['tmp_name'][$i])) { $messages[] = 'No file uploaded'; } else { // move the file to the specified dir if(move_uploaded_file($_FILES['photo']['tmp_name'][$i],$target.'/'.$_FILES['photo']['name'][$i])) { $messages[] = $_FILES['photo']['name'][$i].' uploaded'; } else { // an error message $messages[] = 'Uploading '.$_FILES['photo']['name'][$i].' Failed'; } } } echo '<pre>'.print_r($sql, true).'</pre>'; echo '<pre>'.print_r($messages, 1).'</pre>'; // execute query... $result = mysql_query($sql) or die(mysql_error()); } ?> Results:
-
Well, it could be if he tries to create a virtual host using the apache server configuration - http://httpd.apache....s/examples.html But, in this particular example, I'm agree with you - localhost is not a real directory, it's a loopback address.
-
Well, I suppose that you are using an apple machine so I do not have any experience with it but.....try this: Create a new file called it - mkdir.php and place it , let's say into DispatchReports directory (it does not matter where is it b/s we are using an absolute path) The script below has to create a new directory, named - DispachReportFolder. Try, passthru("whoami"); $tims_path = "/Library/WebServer/Documents/DispatchReports/DispachReportFolder"; if ( !file_exists($tims_path) ) { mkdir ($tims_path, 0777); } if (is_dir($tims_path)) { die( "timstring, you cannot use fopen on a directory path." ); } //if the path is a directory and you want to put a new file there, you'll need to first check if it is writable: if (!is_writable($tims_path)) { die("timstring, " . $tims_path . " is not writable so you will not be able to write anything to it"); } $FileName = $tims_path . $System . ' ' . $EndMO . '.csv'; $fh = fopen($FileName, "w");
-
Using PHP to tell me how many rows are in a table
jazzman1 replied to gotornot's topic in PHP Coding Help
Well, we need to know what error(s) did you get? Have you ever used the mysql_error() function? -
Short description: To find the real path to web root directory, you could use the php realpath() function. Put this line of code to the DispatchReports and find absolute path: <?php echo 'The absolute path to this directory is <b>'.realpath(".").'</b>';
-
What is the file size uploading limit in your php.ini file?
-
and......they are?
- 15 replies
-
- login
- authentication
-
(and 1 more)
Tagged with: