Jump to content

Ch0cu3r

Staff Alumni
  • Posts

    3,404
  • Joined

  • Last visited

  • Days Won

    55

Everything posted by Ch0cu3r

  1. mysqli_fetch_array returns an numerically indexed and associative indexed array for each field returned from your query. Because you are using array chunk it is removing the associative keys from the associative array. if you set the 3rd argument for array_chunk to true the keys will be preserved. What I do not understand is why you are using array_chunk? if you dont want your data to be listed in different arrays then use either mysqli_fetch_row or mysqli_fetch_assoc
  2. In that case you dont need a placeholder for the subfolder column (remove the colon infront of the zero) $query = "INSERT into files(`filename`,`fsize`,`ftype`,`usid`,`subfolder`) VALUES(:filename,:fsize,:ftype,:usid,0)";
  3. What value are you binding to the :0 placeholder?
  4. mysql_query returns a result set the mysql_fetch_* functions is used to get the next row from the result set, eg the first time it is called the first row is returned from the results, the second call will return the second row and so on. I'm confused where you're using array_chunk. Can you post your code and the output you are trying to achieve
  5. Try using the full opening PHP tag <?php in conninfo2.php
  6. Can you post the full error message you're getting. Also post how $db is being defined.
  7. You have five placeholders in your query $query = "INSERT into files(`filename`,`fsize`,`ftype`,`usid`,`subfolder`) VALUES(:filename,:fsize,:ftype,:usid,:0)"; But you are only bounding the first three a value $stmt->bindParam( ':filename', $filename , PDO::PARAM_STR ); $stmt->bindParam( ':fsize', $fsize, PDO::PARAM_STR ); $stmt->bindParam( ':ftype', $ftype, PDO::PARAM_STR ); $stmt->execute(); You need to bound a value for the remianing two placeholders called :uid and :0
  8. It is because of the <br/> that is outside of the <td></td> tags on lines (9, 13 and 17).
  9. Use PHP date function to get the current year $year = date('Y'); // returns current year in YYYY format, eg 2014 Does the 14 here represent the year also? $fname[] = "xxxxxxxxx_".$cperiod."14_".$code; If it does you can again replace it with the date function, but instead of Y you'd use y to get the shorthand representation of the year $year_long = date('Y'); $year_short = date('y'); $command = array(); $fname = array(); foreach($cc as $code) { $fname[] = "xxxxxxxxx_{$cperiod}{$year_short}_{$code}"; $command[] = 'cd /home/xxxxxx/public_html/admin/files/ && java Autoingestion music.properties xxxxxxxxxxxx '.$code.' DRR '.$year_long.' '.$cperiod;;
  10. If you are allowing users to login to your site you don't use their login credentials as part of mysql_connect(). Instead you'd create a table in your database for storing the users profile, such as username, password, email address, etc. For logging in the user you'd create a script which will run a query and return the record that matches the users login credentials. If the query returns a matching record you'd then use sessions to create a logged in session variable. On any page you require the user to be logged you'd check for this session variable exists. If it does not exist you'd redirect the user to the login form. This is the very basic mechanic any website uses for authenticating users.
  11. Should be able to access it from your sites control panel? If not contact your web host for support. Alternatively try adding ini_set('display_errors',1); error_reporting(E_ALL); at the top of index.php (after the opening <?php tag) and to try an force the error message(s) to appear.
  12. Check your server error logs and check for any errors to find the cause.
  13. Yes. You will want to delete the following vars from your script as they are not used $fileName = $_FILES["myfile"]["name"]; $fileTmpLoc = $_FILES["myfile"]["tmp_name"]; $fileType = $_FILES["myfile"]["type"]; $fileSize = $_FILES["myfile"]["size"]; Also this remove . $newfilename from here if(move_uploaded_file($_FILES['myfile']['tmp_name'], $path . $newfilename)) You will end up with the filename being appended twice to $path. This is because you have already appended the filename to $path on this line $path = $path . basename($_FILES['myfile']['name']); // apoends the filename to $path
  14. You might want to start here then http://php.net/manual/en/language.variables.php Before doing anything you need to have a good understanding of the basics of the language such as know what variables, data types (strings, arrays, booleans, etc), operators (=, ==, <, > etc) and control structures (if, if/else, switch, for, while, foreach, etc) are. If read post #2 again I have hinted to you what your need to change the variable name to.
  15. How can the file name change when you have not defined this variable in your code. Do you know how to define and use variables?
  16. echo the users username inside the <legend> tag?
  17. an else statement can only be used after an an if statement. move_uploaded_file() on line 25 should be used as part of an if condition if(move_uploaded_file($_FILES['myfile']['tmp_name'], $path . $newfilename)) { echo "$newfilename has been uploaded"; } else { echo "There was an error uploading the file, please try again!"; } Also where is the variable $newfilename defined? You only have a variable called $filename defined $filename=basename($_FILES['myfile']['name']);
  18. Start your url with http:// otherwise the link will be treated as relative, ie the href value gets appended to the current url, thus you'll get links like http://site.com/site.com/whatver not http://site.com/whatver
  19. If you google "php graphs" you'll get a list of links to php scripts for creating graphs Read the docs for the chosen script, feed it the data for the x and y axis and it'll take care of the rest for you.
  20. So you want the value of $row['ENDTIME'] to be output only once for the first row of the returned result set and not for the 2nd, 3rd, 4th etc...rows? Then what you need is an if at the start of the loop while ($row = sqlsrv_fetch_array( $stmt_act, SQLSRV_FETCH_ASSOC) ) { $endtime = !isset($endtime) ? $row['ENDTIME'] : ''; $actcontacts[] = "N/A" . "," . $row['COMPANYNAME'] . "," . $row['CITY'] . "," . $row['STATE'] . "," . $row['CUST_Salesman_124705300'] . "," . $endtime . "," . "ACT"; echo "<tr>"; echo "<td>" . "<i>N/A</i>" . "</td>"; echo "<td>" . $row['COMPANYNAME'] . "</td>"; echo "<td>" . $row['CITY'] . "</td>"; echo "<td>" . $row['STATE'] . "</td>"; echo "<td>" . $row['CUST_Salesman_124705300'] . "</td>"; echo "<td>" . $endtime . "</td>"; // should only be output for the first row echo "<td>" . "ACT" . "</td>"; echo "</tr>"; }
  21. Yes, for something like that yes. But if you're dealing with more complex HTML you'd pass in the html string to the DOM object (or the simple html helper library) and the use the nesscary methods to get the data you require
  22. Try $url = file_get_html('http://website.com'); $text1 = $dom->find('div[class="ym-gl headingInnerDiv"] a', 0); $text2 = $dom->find('div[class="ym-grid ym-gl"] p', 0); echo "Text1: {$text1->innertext}<br />Text2: {$text2->innertext}";
  23. Why did you take on this project? How can you possibly learn a language and create a functional site in 3 days? Thats madness. I think what you are best of doing is using a something like Wordpress, Joomla or some other Content Management System (CMS). But if you want to continue this project then you will need to first learn the basics of PHP syntax. Then learn to use a PHP database function library such as PDO or MySQLi to interact with MySQL databases.
  24. Yes $image is a variable which holds an associative array, which contains 6 keys called post_id, title, content, image, url and url_openblank The image key has a string assigned to it. Only you will be able understand that the individual characters used in the string creates the mark-up for an HTML img tag. PHP will not it will just see it as a bunch of random characters.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.